(* ========================================================================== *)
(* FLYSPECK - BOOK FORMALIZATION *)
(* *)
(* Chapter: Fan *)
(* Author: Hoang Le Truong *)
(* Date: 2010-02-09 *)
(* ========================================================================= *)
module Conforming = struct
open Sphere;;
open Fan_defs;;
open Hypermap;;
open Vol1;;
open Fan;;
open Topology;;
open Fan_misc;;
open Planarity;;
let conforming_bijection_fan = new_definition `conforming_bijection_fan (x,V,E) <=>
!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\
s = dartset_leads_into_fan x V E f)`;;
let conforming_half_space_fan = new_definition `conforming_half_space_fan (x,V,E) <=>
!f. f IN face_set (hypermap1_of_fanx (x,V,E)) ==>
dartset_leads_into_fan x V E f =
INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN f}`;;
let conforming_solid_angle_fan = new_definition `conforming_solid_angle_fan (x,V,E) <=>
!f. f IN face_set (hypermap1_of_fanx (x,V,E)) ==>
(let U = dartset_leads_into_fan x V E f in
(!r. measurable (ball (x,r) INTER U)) /\
eventually_radial x U /\
sol x U = &2 * pi + sum (f) (\y. (azim_fan x V E (pr2 y) (pr3 y)) - pi))`;;
let conforming_diagonal_fan = new_definition `conforming_diagonal_fan (x,V,E) <=>
(!f y z. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ y IN f /\ z IN f /\ ~(y = z) ==>
~collinear {x, pr2 y, pr2 z} /\
((y = f1_fan x V E z) \/ (z = f1_fan x V E y) \/
aff_gt {x} {pr2 y, pr2 z} SUBSET (dartset_leads_into_fan x V E f)))`;;
let conforming_fan = new_definition `conforming_fan (x,V,E) <=>
(!v. v IN V==>CARD (set_of_edge v V E) >1)/\
fan80(x,V,E) /\
conforming_bijection_fan (x,V,E) /\
conforming_half_space_fan (x,V,E) /\
conforming_solid_angle_fan (x,V,E) /\
conforming_diagonal_fan (x,V,E)`;;
let N_FAN = new_definition `N_FAN (x,V,E) = nsum (face_set (hypermap1_of_fanx (x,V,E))) (\f. CARD f -3)`;;
let minimally_nonconforming_fan=new_definition`minimally_nonconforming_fan(x,V,E)<=>
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ ~(conforming_fan (x,V,E))
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))`;;
let GINGUAP=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)
/\ conforming_fan (x,V,E)
/\ ds IN face_set(hypermap1_of_fanx (x,V,E))
==> convex(dartset_leads_into_fan x V E ds)`,
REWRITE_TAC[conforming_fan;conforming_half_space_fan]
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 DISCH_THEN(LABEL_TAC"EM")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`)
THEN MATCH_MP_TAC CONVEX_INTERS
THEN REWRITE_TAC[IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[CONVEX_AFF_GT]);;
let fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v w.
FAN(x,V,E) /\ {v,w} IN E
/\ (!v. v IN V==>CARD (set_of_edge v V E) >1)
/\ fan80(x,V,E)
==> aff_gt {x, v,w} {sigma_fan x V E v w} =
aff_gt {x, v, w} {inverse1_sigma_fan x V E w v}`,
REPEAT STRIP_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`] THEN MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`] )
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`]
THEN REMOVE_THEN "EM" MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`] THEN DISCH_TAC THEN ASSUME_TAC th)
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 sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w: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 w: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)`;`sigma_fan x V E v w:real^3`;`v:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN ASSUME_TAC th)
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v w:real^3`; `w:real^3`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(w:real^3)`;`inverse1_sigma_fan x V E w v:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w v: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_TRIPLE]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v w:real^3`;]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w v:real^3`]);;
let IMAGE_F1_IN_FACE_IMP_IN_FACE=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)
/\ ds IN face_set (hypermap1_of_fanx (x,V,E))
/\ y IN ds
/\ y1 IN d_fan(x,V,E)
/\ f1_fan x V E y1= y
==> y1 IN ds`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
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;orbit_map]
THEN RESA_TAC
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_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 STRIP_TAC
THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) y1 IN
face_set (hypermap1_of_fanx (x,V,E))`ASSUME_TAC
THENL[
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face]
THEN EXISTS_TAC`y1:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];
MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) y1):real^3#real^3#real^3#real^3->bool`]
THEN SUBGOAL_THEN`?N:num. CARD (face (hypermap1_of_fanx (x,V,E)) y1)= SUC N /\ N>0`ASSUME_TAC
THENL[
EXISTS_TAC`CARD (face (hypermap1_of_fanx (x:real^3,V,E)) y1)-1`
THEN POP_ASSUM MP_TAC
THEN ARITH_TAC;
POP_ASSUM MP_TAC
THEN STRIP_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD (face (hypermap1_of_fanx (x,V,E)) y1):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`)
THEN STRIP_TAC
THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V,E)`;`y1:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[POWER;o_DEF;GSYM lemma_add_exponent_function]
THEN STRIP_TAC
THEN EXISTS_TAC`N+n:num`
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`N+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 MP_TAC(ARITH_RULE`n>=0/\ N>0==> N+n>=0`)
THEN ASM_REWRITE_TAC[]]]);;
let IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE=prove(`!m 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)
/\ ds IN face_set (hypermap1_of_fanx (x,V,E))
/\ y IN ds
/\ y1 IN d_fan(x,V,E)
/\ (f1_fan x V E POWER m) y1= y
==> y1 IN ds`,
INDUCT_TAC
THENL[
ASM_REWRITE_TAC[POWER;I_DEF]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN ASM_REWRITE_TAC[POWER;o_DEF]
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th[`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`;` (f1_fan x V E 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 MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN STRIP_TAC
THEN MRESAL_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`][POWER_1]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`)
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E y1):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`;]]);;
let REP_OF_INVERSE1_SIGMA_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y.
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) >1)
/\ ds IN face_set (hypermap1_of_fanx (x,V,E))
/\ y IN ds
==> f1_fan x V E (x,sigma_fan x V E (pr2 y) (pr3 y),(pr2 y),sigma_fan x V E (sigma_fan x V E (pr2 y) (pr3 y)) (pr2 y))=y `,
REPEAT STRIP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`ds SUBSET d1_fan (x,V,E) /\ y IN ds ==> y IN d1_fan (x,V,E)`)
THEN ASM_REWRITE_TAC[f1_fan;d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[pr2;pr3]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`));;
let REP_OF_INVERSE1_SIGMA_FAN_IN_D_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y.
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) >1)
/\ ds IN face_set (hypermap1_of_fanx (x,V,E))
/\ y IN ds
==> (x,sigma_fan x V E (pr2 y) (pr3 y),(pr2 y),sigma_fan x V E (sigma_fan x V E (pr2 y) (pr3 y)) (pr2 y)) IN
d_fan (x:real^3,V:real^3->bool,E)`,
REPEAT STRIP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`ds SUBSET d1_fan (x,V,E) /\ y IN ds ==> y IN d1_fan (x,V,E)`)
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[pr2;pr3]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`(sigma_fan x V E v w):real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`(sigma_fan x V E (sigma_fan x V E v w) v):real^3`
THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`w: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 w):real^3`;`v:real^3`]
THEN POP_ASSUM MP_TAC
THEN RESA_TAC);;
let DARTSET_LEADS_INTO_SUBSET_WDART_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y.
FAN(x,V,E)
/\ ds IN face_set (hypermap1_of_fanx (x,V,E))
/\ y IN ds
/\ conforming_fan (x,V,E)
==> (dartset_leads_into_fan x V E ds) SUBSET (w_dart_fan x V E y)`,
REWRITE_TAC[conforming_fan;conforming_half_space_fan]
THEN 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 REPEAT STRIP_TAC
THEN REMOVE_THEN "EM"(fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`)
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`y IN ds /\ ds SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V,E)`) THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN 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 FIND_ASSUM MP_TAC`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th) THEN FIND_ASSUM MP_TAC `(v:real^3) IN V` THEN DISCH_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th]) THEN STRIP_TAC)
THEN ASM_REWRITE_TAC[w_dart_fan;]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM1"))
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`w: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 w):real^3`;`v:real^3`]
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`v:real^3`;`w:real^3`;`(sigma_fan x V E v w):real^3`]
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`] THEN DISCH_TAC THEN ASSUME_TAC th)
THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`w:real^3`;`v:real^3`;`(sigma_fan x V E v w):real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;])
THEN SUBGOAL_THEN`x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w) v IN
d1_fan (x:real^3,V:real^3->bool,E)` ASSUME_TAC
THENL[ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`(sigma_fan x V E v w):real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`(sigma_fan x V E (sigma_fan x V E v w) v):real^3`
THEN ASM_REWRITE_TAC[SET_RULE`{A,B}={B,A}`];
MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E (x,sigma_fan x V E v w, v, sigma_fan x V E (sigma_fan x V E v w) v)):real^3#real^3#real^3#real^3)` ;`((x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w) v):real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[pr2;pr3;f1_fan]
THEN REWRITE_TAC[]
THEN STRIP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[pr2;pr3;f1_fan]
THEN REWRITE_TAC[INTERS;INTER;IN_ELIM_THM; SUBSET]
THEN REPEAT STRIP_TAC
THENL[POP_ASSUM(fun th-> MRESA1_TAC th `aff_gt {x, w, v} {sigma_fan x V E v w:real^3}` THEN POP_ASSUM MATCH_MP_TAC)
THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan]
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`]
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`];
POP_ASSUM(fun th-> MRESA1_TAC th `aff_gt {x, v, sigma_fan x V E v w} {w}` THEN POP_ASSUM MATCH_MP_TAC)
THEN EXISTS_TAC`(x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w:real^3) v):real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`)
THEN MRESAL_TAC REP_OF_INVERSE1_SIGMA_FAN[`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`][pr2;pr3]
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`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`;`(x,sigma_fan x V E v w,v,sigma_fan x V E (sigma_fan x V E v w:real^3) v):real^3#real^3#real^3#real^3`]
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`]
THEN REWRITE_TAC[]]]);;
let power_map_points_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v:real^3 w:real^3 n:num.
FAN(x,V,E)
/\ {v,w} IN E
==> {v,power_map_points sigma_fan x V E v w n} IN E`,
REPEAT STRIP_TAC
THEN MRESA_TAC i_IN_ORBITS_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w:real^3)`;`n:num`]
THEN MRESA_TAC ORBITS_SUBSET_EDGE_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` (w:real^3)`]
THEN MP_TAC (SET_RULE`power_map_points sigma_fan x V E v w n IN
set_of_orbits_points_fan x V E v w /\
set_of_orbits_points_fan x V E v w SUBSET set_of_edge v V E
==> power_map_points sigma_fan x V E v w n IN set_of_edge v V E`)
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC properties_of_set_of_edge_fan[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` ((power_map_points sigma_fan x V E v w n):real^3)`]);;
let SRPRNPL=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ conforming_fan (x,V,E)
==> simple_hypermap(hypermap1_of_fanx (x,V,E))`,
REPEAT STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN ASSUME_TAC th)
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[simple_hypermap;node;EXTENSION;INTER;IN_ELIM_THM;orbit_map]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THEN STRIP_TAC
THENL[POP_ASSUM MP_TAC
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 SUBGOAL_THEN`x' IN face (hypermap1_of_fanx (x:real^3,V,E)) x'`ASSUME_TAC
THENL[
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];
SUBGOAL_THEN `face (hypermap1_of_fanx (x,V,E)) x' IN
face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;orbit_map;face]
THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];
MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN REMOVE_THEN"EM"MP_TAC
THEN ASM_REWRITE_TAC[]
THEN DISCH_THEN(LABEL_TAC"EM")
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 REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`)
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN"EM"MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[d1_fan;]
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN MRESAL_TAC DARTSET_LEADS_INTO_SUBSET_WDART_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`;`x'':real^3#real^3#real^3#real^3`][pr2;pr3;]
THEN MRESAL_TAC DARTSET_LEADS_INTO_SUBSET_WDART_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`][pr2;pr3]
THEN MRESA_TAC power_map_points_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `w:real^3`; `n:num`]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) x'):real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC exists_point_in_component_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`(dartset_leads_into_fan x V E
(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w))):real^3->bool`]
THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E
(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)) SUBSET
w_dart_fan x V E
(x,
v,
power_map_points sigma_fan x V E v w n,
power_map_points sigma_fan x V E v w (SUC n))/\
dartset_leads_into_fan x V E
(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)) SUBSET
w_dart_fan x V E (x,v,w,sigma_fan x V E v w)
/\ z IN
dartset_leads_into_fan x V E
(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w))
==> ~(w_dart_fan x V E (x,v,w,sigma_fan x V E v w) INTER w_dart_fan x V E
(x,
v,
power_map_points sigma_fan x V E v w n,
power_map_points sigma_fan x V E v w (SUC n))
={})`)
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[power_map_points]
THEN STRIP_TAC
THEN MRESA_TAC disjoint_fan2[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`; `w:real^3`;`(power_map_points sigma_fan x V E v w n):real^3`]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;IN_SING])]];
POP_ASSUM MP_TAC
THEN REWRITE_TAC[IN_SING]
THEN RESA_TAC
THEN STRIP_TAC
THENL[
EXISTS_TAC `0`
THEN REWRITE_TAC[ARITH_RULE`0>=0`; POWER;I_DEF];
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC `0`
THEN REWRITE_TAC[ARITH_RULE`0>=0`; POWER;I_DEF]]]);;
let N_FAN_GE_0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) >1)
==> 0<= N_FAN(x,V,E) `,
REPEAT STRIP_TAC
THEN MRESA_TAC NSUM_EQ_0[`(\f:real^3#real^3#real^3#real^3->bool. 0)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`]
THEN MRESA_TAC NSUM_LE[`(\f:real^3#real^3#real^3#real^3->bool. 0)`;`(\f:real^3#real^3#real^3#real^3->bool. CARD f - 3)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`]
THEN REWRITE_TAC[N_FAN]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[FINITE_HYPERMAP_ORBITS]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`x':real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN ARITH_TAC);;
let NSUM_EQ_0_IFF = prove
(`!s f. FINITE s ==> (nsum s f = 0 <=> !x. x IN s ==> f x = 0)`,
REPEAT STRIP_TAC THEN EQ_TAC THEN ASM_SIMP_TAC[NSUM_EQ_0] THEN
ASM_MESON_TAC[ARITH_RULE `n = 0 <=> n <= 0`; NSUM_POS_BOUND]);;
let N_FAN_EQ_0_IMP_CARD_FACE_EQ_3=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)
/\ N_FAN(x,V,E)=0
/\ ds IN face_set (hypermap1_of_fanx (x,V,E))
==> CARD ds=3`,
REWRITE_TAC[N_FAN]
THEN REPEAT STRIP_TAC
THEN MRESAL_TAC NSUM_EQ_0_IFF[`face_set (hypermap1_of_fanx (x:real^3,V,E))`;`(\f:real^3#real^3#real^3#real^3->bool. CARD f -3)`][FINITE_HYPERMAP_ORBITS]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`ds:real^3#real^3#real^3#real^3->bool`)
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_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 MP_TAC
THEN POP_ASSUM MP_TAC
THEN ARITH_TAC);;
let version_JUTSTKG=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) U:real^3->bool.
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) >1)
/\ fan80(x,V,E)
/\ U IN topological_component_yfan (x,V,E)
==> ?f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\ dartset_leads_into_fan x V E f = U`,
REPEAT STRIP_TAC
THEN MRESA_TAC JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`U:real^3->bool`]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN ABBREV_TAC`y=(x,v,u:real^3,sigma_fan x V E v u)`
THEN ABBREV_TAC`ds=face (hypermap1_of_fanx (x:real^3,V,E)) y`
THEN EXISTS_TAC`ds:real^3#real^3#real^3#real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN SUBGOAL_THEN`y IN dart (hypermap1_of_fanx (x:real^3,V,E))`ASSUME_TAC
THENL[
REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;])
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 MRESAL_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`][d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`(sigma_fan x (V:real^3->bool) E v u):real^3`
THEN ASM_REWRITE_TAC[];
SUBGOAL_THEN `ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))`ASSUME_TAC
THENL[
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;face_set; IN_ELIM_THM;set_of_orbits;face])
THEN STRIP_TAC
THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];
SUBGOAL_THEN`y IN ds:real^3#real^3#real^3#real^3->bool`ASSUME_TAC
THENL[
EXPAND_TAC"ds"
THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];
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 EXPAND_TAC"y"
THEN REWRITE_TAC[pr2;pr3]]]]);;
let measurable_dartset_leads_into30_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds e.
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))
/\ CARD ds=3
==> measurable((dartset_leads_into_fan x V E ds) INTER ball (x,e))`,
REPEAT STRIP_TAC
THEN MRESA_TAC KVQWYDL_lemma10[`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-> REWRITE_TAC[SYM(th)])
THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B=B INTER A`]
THEN MESON_TAC[MEASURABLE_BALL_AFF_GT]);;
let DWFBRQY=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)
/\ N_FAN(x,V,E)=0
==> conforming_fan (x,V,E)`,
REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[conforming_fan]
THEN MRESA_TAC N_FAN_EQ_0_IMP_CARD_FACE_EQ_3[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN STRIP_TAC
THENL[
REWRITE_TAC[conforming_bijection_fan;EXISTS_UNIQUE]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`s:real^3->bool`]
THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC exists_point_dart_leads_into_fan [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;
`y:real^3#real^3#real^3#real^3->bool`;]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"MA")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`)
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`y' IN y /\ y SUBSET d_fan(x,V,E)==> y' IN d_fan(x,V,E)`)
THEN RESA_TAC
THEN MRESA_TAC KVQWYDL_lemma30[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f: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 REMOVE_THEN "MA" MP_TAC
THEN ASM_TAC
THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`][face]
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y':real^3#real^3#real^3#real^3`][face];
STRIP_TAC
THENL[
REWRITE_TAC[conforming_half_space_fan]
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`)
THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);])
THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN ASM_REWRITE_TAC[SET_RULE`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} | y IN {f1, f2, f3}}
= aff_gt {x, pr2 f1, pr3 f1} {pr3 (f1_fan x V E f1)} INTER aff_gt {x, pr2 f2, pr3 f2} {pr3 (f1_fan x V E f2)} INTER aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3)}`;SET_RULE`{pr2 y | y IN {f1, f2, f3}}={pr2 f1, pr2 f2, pr2 f3}`]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`pr2 f2:real^3`;`pr2 f3:real^3`])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr2 f2):real^3`;`(pr2 f3):real^3`]
THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`(pr3 f3):real^3`;`(pr3 f1):real^3`;`(pr3 f2):real^3`];
STRIP_TAC
THENL[
REWRITE_TAC[conforming_solid_angle_fan]
THEN REPEAT STRIP_TAC
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`]
THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`)
THEN MRESA_TAC measurable_dartset_leads_into30_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;]
THEN MRESA_TAC dartset_leads_into_fan_eventually_radial_norm[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[eventually_radial_norm;eventually_radial;radial_norm; radial;ball_eq_normball]
THEN DISCH_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC solid_of_dartset_leads_into_fan_triangle_fan
[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;];
REWRITE_TAC[conforming_diagonal_fan]
THEN REPEAT GEN_TAC
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "EM" (fun th-> MRESA1_TAC th `f:real^3#real^3#real^3#real^3->bool`)
THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f2):real^3`;`(pr2 f1):real^3`]
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f3):real^3`;`(pr2 f2):real^3`]
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f1):real^3`;`(pr2 f3):real^3`]
THEN REPEAT DISCH_TAC
THEN MP_TAC(SET_RULE`y IN {f1, f2, f3:real^3#real^3#real^3#real^3} /\ z IN {f1, f2, f3}/\ ~(y = z)
==> (y=f1 /\ z= f2) \/ (y=f1 /\ z= f3) \/ (y=f2 /\ z= f1) \/ (y=f2 /\ z= f3)\/ (y=f3 /\ z= f1) \/ (y=f3 /\ z= f2)` )
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_TAC[]]]]);;
let NEGLIGIBLE_AFF_3=prove(`!x:real^3 v:real^3 u:real^3.
negligible (aff {x,v,u})`,
MESON_TAC[NEGLIGIBLE_AFFINE_HULL_3;aff]);;
let NEGLIGIBLE_AFF_GE_2_1=prove(`!x:real^3 v:real^3 u:real^3.
~collinear {x,v,u}
==> negligible (aff_ge {x,v} {u})`,
REPEAT GEN_TAC THEN GEOM_ORIGIN_TAC `x:real^3` THEN
REPEAT STRIP_TAC
THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET
THEN EXISTS_TAC`{w:real^3| (w) dot (e2_fan (vec 0) v u)= &0}`
THEN MRESAL_TAC exp_aff_ge_by_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`][VECTOR_ARITH`A- vec 0=A`]
THEN REWRITE_TAC[SET_RULE`{w | w dot e2_fan (vec 0) v u = &0 /\ &0 <= w dot e1_fan (vec 0) v u} SUBSET
{w | w dot e2_fan (vec 0) v u = &0}`]
THEN ONCE_REWRITE_TAC[DOT_SYM]
THEN MATCH_MP_TAC NEGLIGIBLE_HYPERPLANE
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESAL_TAC properties_coordinate[`((vec 0):real^3)`;` (v:real^3)`;` (u:real^3)`][orthonormal;DOT_LZERO]
THEN ASM_TAC
THEN REAL_ARITH_TAC);;
let NEGLIGIBLE_AFF_GE_1_2=prove(`!x:real^3 v:real^3 u:real^3.
~collinear {x,v,u}
==> negligible (aff_ge {x} {v,u})`,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET
THEN EXISTS_TAC `aff_ge {x,v} {u:real^3}`
THEN MRESA_TAC aff_ge_inter_aff_ge[`x:real^3`;`v:real^3`;`u:real^3`]
THEN ASM_SIMP_TAC[SET_RULE`A INTER B SUBSET A`;NEGLIGIBLE_AFF_GE_2_1]);;
let NEGLIGIBLE_AFF_GT_1_2=prove(`!x:real^3 v:real^3 u:real^3.
~collinear {x,v,u}
==> negligible (aff_gt {x} {v,u})`,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET
THEN EXISTS_TAC `aff_ge {x} {v,u:real^3}`
THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]th3) THEN RESA_TAC
THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`u:real^3`]
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GE_1_2]);;
let MEASURE_AFF_3=prove(`!x:real^3 v:real^3 u:real^3.
measure (aff {x,v,u})= &0`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3]);;
let MEASURE_AFF_GT_2_1=prove(`!x:real^3 v:real^3 u:real^3.
~collinear {x,v,u}==> measure (aff_gt {x} {v,u})= &0`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2]);;
let NEGLIGIBLE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real.
negligible (aff {x,v,u} INTER normball x r)`,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET
THEN EXISTS_TAC `aff {x,v,u:real^3}`
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3; SET_RULE`A INTER B SUBSET A`]);;
let NEGLIGIBLE_AFF_GT_1_2_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real.
~collinear {x,v,u}
==> negligible (aff_gt {x} {v,u} INTER normball x r)`,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET
THEN EXISTS_TAC `aff_gt {x} {v,u:real^3}`
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2; SET_RULE`A INTER B SUBSET A`]);;
let MEASURE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real.
measure (aff {x,v,u} INTER normball x r)= &0`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3_INTER_BALL]);;
let MEASURE_AFF_GT_2_1_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real.
~collinear {x,v,u}==> measure (aff_gt {x} {v,u} INTER normball x r)= &0`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2_INTER_BALL]);;
let HAS_MEASURE_AFF_3_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real.
(aff {x,v,u} INTER normball x r) has_measure &0`,
REPEAT STRIP_TAC
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_3_INTER_BALL;HAS_MEASURE_0]);;
let HAS_MEASURE_AFF_GT_1_2_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real.
~collinear {x,v,u}==> (aff_gt {x} {v,u} INTER normball x r) has_measure &0`,
REPEAT STRIP_TAC
THEN ASM_SIMP_TAC[NEGLIGIBLE_AFF_GT_1_2_INTER_BALL;HAS_MEASURE_0]);;
let MEASURABLE_AFF_GT_2_1_INTER_BALL=prove(`!x:real^3 v:real^3 u:real^3 r:real.
~collinear {x,v,u}==> measurable (aff_gt {x} {v,u} INTER normball x r)`,
REPEAT STRIP_TAC
THEN ASM_SIMP_TAC[measurable;]
THEN EXISTS_TAC`&0`
THEN MRESA_TAC HAS_MEASURE_AFF_GT_1_2_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`r:real`]);;
let XFAN_EQ_UNIONS_AFF_GE_1_2=prove(`!x V E.
xfan(x,V,E) =UNIONS {y | ?e. e IN E /\ y = aff_ge {x} e}`,
REWRITE_TAC[xfan;UNIONS;IN_ELIM_THM]
THEN SET_TAC[]);;
let NEGLIGIBLE_XFAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool).
FAN (x,V,E) ==> negligible (xfan (x,V,E))`,
REPEAT STRIP_TAC THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2] THEN MATCH_MP_TAC NEGLIGIBLE_UNIONS
THEN MRESAL_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`][IN_ELIM_THM]
THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3->bool. aff_ge {x:real^3} e)`;`E:(real^3->bool)->bool`][IMAGE;]
THEN REPEAT STRIP_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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC "EM")
THEN STRIP_TAC
THEN REMOVE_THEN "EM" 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 ASM_MESON_TAC[NEGLIGIBLE_AFF_GE_1_2]);;
let NEGLIGIBLE_XFAN_INTER_BALL=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) r:real.
FAN (x,V,E) ==> negligible (xfan (x,V,E) INTER normball x r)`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET
THEN EXISTS_TAC`xfan ((x:real^3),(V:real^3->bool),(E:(real^3->bool)->bool))`
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[NEGLIGIBLE_XFAN;SET_RULE`xfan (x,V,E) INTER normball x r SUBSET xfan (x,V,E)`]);;
let MEASURE_XFAN=prove(`!x:real^3 V E.
FAN (x,V,E) ==> measure (xfan (x,V,E))= &0`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0
THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN]);;
let HAS_MEASURE_XFAN=prove(`!x:real^3 V E.
FAN (x,V,E) ==> (xfan (x,V,E)) has_measure &0`,
REPEAT STRIP_TAC
THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN;HAS_MEASURE_0]);;
let MEASURE_XFAN_INTER_BALL=prove(`!x:real^3 V E r.
FAN (x,V,E) ==> measure (xfan (x,V,E) INTER normball x r)= &0`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0
THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN_INTER_BALL]);;
let HAS_MEASURE_XFAN_INTER_BALL=prove(`!x:real^3 V E r.
FAN (x,V,E) ==> (xfan (x,V,E) INTER normball x r) has_measure &0`,
REPEAT STRIP_TAC
THEN ASM_SIMP_TAC[NEGLIGIBLE_XFAN_INTER_BALL;HAS_MEASURE_0]);;
let MEASURABLE_BALL_INTER_UNIV=prove(`!x r. measurable ((:real^3) INTER normball x r)`,
REWRITE_TAC[SET_RULE`(:real^3) INTER (A:real^3->bool)=A`;GSYM ball_eq_normball;MEASURABLE_BALL]);;
let MEASURE_YFAN_INTER_BALL=prove(`!x:real^3 V E r.
FAN(x,V,E)/\ &0<= r
==> measure ( (yfan (x,V,E)) INTER normball x r)= &4/ &3 *pi *r pow 3`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= normball x r DIFF (xfan (x,V,E) INTER normball x r)`]
THEN MRESAL_TAC HAS_MEASURE_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`][HAS_MEASURE_MEASURABLE_MEASURE;GSYM ball_eq_normball]
THEN MRESAL_TAC MEASURE_DIFF_SUBSET[`normball (x:real^3) (r:real)`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`xfan (x,V,E) INTER ball (x,r) SUBSET ball (x,r)`;]
THEN ASM_SIMP_TAC[VOLUME_BALL]
THEN REAL_ARITH_TAC);;
let MESURABLE_YFAN_INTER_BALL=prove(`!x:real^3 V E r.
FAN(x,V,E)/\ &0<= r
==> measurable ( (yfan (x,V,E)) INTER normball x r)`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= normball x r DIFF (xfan (x,V,E) INTER normball x r)`]
THEN MRESAL_TAC HAS_MEASURE_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`][HAS_MEASURE_MEASURABLE_MEASURE;GSYM ball_eq_normball]
THEN MRESAL_TAC MEASURABLE_DIFF[`normball (x:real^3) (r:real)`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`xfan (x,V,E) INTER ball (x,r) SUBSET ball (x,r)`;]);;
let RADIAL_DIFF=prove(`!r v0 A B:real^N->bool. radial_norm r v0 A /\ radial_norm r v0 B /\ A SUBSET B ==> radial_norm r v0 (B DIFF A)`,
REWRITE_TAC[radial_norm]
THEN REPEAT STRIP_TAC
THENL[
ASM_TAC THEN SET_TAC[];
MP_TAC(SET_RULE`v0 + u:real^N IN B DIFF A==> v0 + u IN B /\ ~(v0 + u IN A)`)
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC `!u:real^N. v0 + u IN B ==> (!t. t > &0 /\ t * norm u < r ==> v0 + t % u IN B)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `u:real^N` th))
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th)
THEN REPEAT STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `t:real`)
THEN FIND_ASSUM MP_TAC `!u:real^N. v0 + u IN A ==> (!t. t > &0 /\ t * norm u < r ==> v0 + t % u IN A)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `t% u:real^N` th))
THEN DISJ_CASES_TAC(SET_RULE`v0 + t % u IN A \/ ~(v0 + t % u:real^N IN A)`)
THENL[POP_ASSUM (fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th)
THEN REPEAT STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `inv t:real`)
THEN POP_ASSUM MP_TAC
THEN MP_TAC(REAL_ARITH`t> &0==> ~(t= &0) /\ &0<= t`) THEN RESA_TAC
THEN MRESA1_TAC REAL_ABS_REFL`t:real`
THEN MRESA1_TAC REAL_MUL_LINV`t:real`
THEN MRESAL1_TAC REAL_LT_INV `t:real`[REAL_ARITH`&0 A> &0`;NORM_MUL; REAL_ARITH`A*B*C=(A*B)*C`;REAL_ARITH`&1 *A=A`;VECTOR_ARITH`A % B%C=(A*B)%C`;VECTOR_ARITH`&1 %A=A`]
THEN MP_TAC(SET_RULE`B SUBSET normball v0 r /\ v0 + u:real^N IN B==> v0 + u IN normball v0 r`)
THEN ASM_REWRITE_TAC[normball;IN_ELIM_THM;dist;VECTOR_ARITH`(A+B)-A=B:real^N`]
THEN SET_TAC[];
ASM_TAC THEN SET_TAC[]]]);;
let RADIAL_UNION=prove(`!r v0 A B:real^N->bool. radial_norm r v0 A /\ radial_norm r v0 B ==> radial_norm r v0 (A UNION B)`,
REWRITE_TAC[radial_norm;IN_UNION]
THEN REPEAT STRIP_TAC
THEN ASM_TAC THEN SET_TAC[]);;
let RADIAL_EMPTY=prove(`!r v0:real^N. radial_norm r v0 {}`,
REWRITE_TAC[radial_norm;]
THEN SET_TAC[]);;
let RADIAL_UNIONS=prove(`!r v0 f:(real^N->bool)->bool.
FINITE f /\ (!s. s IN f ==> radial_norm r v0 s)
==> (radial_norm r v0 (UNIONS f))`,
GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN
MATCH_MP_TAC FINITE_INDUCT_STRONG THEN
SIMP_TAC[UNIONS_0; UNIONS_INSERT; RADIAL_EMPTY] THEN
REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THEN
MATCH_MP_TAC RADIAL_UNION THEN ASM_SIMP_TAC[]);;
let RADIAL_UNIV=prove(`!r x. r> &0 ==> radial_norm r x ((:real^N) INTER normball x r)`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[radial_norm]
THEN REPEAT STRIP_TAC
THENL
[ SET_TAC[];
UNDISCH_TAC `(x:real^N) + u IN (:real^N) INTER normball x r` THEN
ASM_SIMP_TAC[aff_normball;SET_RULE`(:real^N) INTER (A:real^N->bool)=A`]]);;
let RADIAL_AFF_GE_1_2 = prove(`!x u v r.
(DISJOINT {(x:real^B)} {u,v} /\ (r > &0) ) ==>
radial_norm r x (aff_ge {x} {u,v} INTER normball x r)`,
REWRITE_TAC[radial_norm]
THEN REPEAT STRIP_TAC
THENL[SET_TAC[];
UNDISCH_TAC `(x:real^B) + u' IN aff_ge {x} {u, v} INTER normball x r`
THEN ASM_SIMP_TAC[AFF_GE_1_2]
THEN REWRITE_TAC[IN_ELIM_THM;IN_INTER]
THEN REPEAT STRIP_TAC
THENL[EXISTS_TAC `&1 + (t:real) * t1 - t`
THEN EXISTS_TAC `(t:real) * t2`
THEN EXISTS_TAC `(t:real) * t3`
THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 + t * t1 - t) + t * t2 + t * t3 = &1 + t * (t1 + t2 +t3)-t `; REAL_ARITH`&1 + t * &1 - t = &1`;VECTOR_ARITH`(&1 + t * t1 - t) % x + (t * t2) % u + (t * t3) % v=x + t % (t1 % x + t2 % u + t3 % v) - t %x`;]
THEN MP_TAC(REAL_ARITH`t> &0 ==> &0<= t`) THEN RESA_TAC
THEN SUBGOAL_THEN `&0 <= t * t2 /\ &0 <= t * t3` (fun t -> REWRITE_TAC[t])
THENL[ ASM_MESON_TAC[REAL_LE_MUL];
REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN VECTOR_ARITH_TAC];
MATCH_MP_TAC aff_normball
THEN ASM_REWRITE_TAC[]]]);;
let RADIAL_AFF_GT_3_1 = prove_by_refinement(`!x u v w r.
(DISJOINT {(x:real^B),u,v} {w} /\ (r > &0) ) ==>
radial_norm r x (aff_gt {x,u,v} {w} INTER normball x r)`,
[
REWRITE_TAC[radial_norm];
REPEAT STRIP_TAC;
SET_TAC[];
UNDISCH_TAC `(x:real^B) + u' IN aff_gt {x,u,v} {w} INTER normball x r`;
ASM_SIMP_TAC[AFF_GT_3_1];
REWRITE_TAC[IN_ELIM_THM;IN_INTER];
REPEAT STRIP_TAC;
EXISTS_TAC `&1 + (t:real) * t1 - t`;
EXISTS_TAC `(t:real) * t2`;
EXISTS_TAC `(t:real) * t3`;
EXISTS_TAC `(t:real) * t4`;
SUBGOAL_THEN `&0 < t * t4` (fun t -> REWRITE_TAC[t]);
ASM_MESON_TAC[REAL_MUL_POS_LT;REAL_ARITH `r > &0 <=> &0 < r`];
CONJ_TAC;
SUBGOAL_THEN `(&1 + t * t1 - t) + t * t2 + t * t3 + t * t4 = &1 - t + t * (t1 + t2 + t3 + t4)` (fun t-> ASM_REWRITE_TAC[t]);
REAL_ARITH_TAC;
REAL_ARITH_TAC;
ONCE_REWRITE_TAC[ VECTOR_ARITH `( &1 + t * t1 - t) % (x:real^B) + (t * t2) % u + (t * t3) % v + (t * t4) % w = x - t % x + t % (t1 % x + t2 % u + t3 % v + t4 % w)`];
UNDISCH_TAC `(x:real^B) + u' = t1 % x + t2 % u + t3 % v + t4 % w`;
DISCH_THEN(fun thm -> ONCE_REWRITE_TAC[GSYM thm]);
VECTOR_ARITH_TAC;
MATCH_MP_TAC aff_normball;
ASM_REWRITE_TAC[];
]);;
let RADIAL_INTERS=prove(`!r v0 f:(real^N->bool)->bool.
FINITE f /\ (!s. s IN f ==> radial_norm r v0 (s INTER normball v0 r))/\ r> &0
==> (radial_norm r v0 (INTERS f INTER normball v0 r))`,
GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN
MATCH_MP_TAC FINITE_INDUCT_STRONG THEN
SIMP_TAC[ INTERS_0; INTERS_INSERT;RADIAL_UNIV;FORALL_IN_CLAUSES] THEN
REWRITE_TAC[IN_INSERT;SET_RULE`(x INTER INTERS f) INTER normball v0 r=(x INTER normball v0 r) INTER (INTERS f INTER normball v0 r)`] THEN REPEAT STRIP_TAC
THEN MATCH_MP_TAC inter_radial THEN ASM_SIMP_TAC[]);;
let XFAN_INTER_BALL_UNIONS=prove(`!x:real^N V E.
xfan(x,V,E) INTER normball x r= UNIONS {y | ?e. e IN E /\ y = (aff_ge {x} e) INTER normball x r}`,
REPEAT GEN_TAC
THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2]
THEN ONCE_REWRITE_TAC[ EXTENSION]
THEN REWRITE_TAC[UNIONS; INTER;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THENL[
STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC `{x' | x' IN aff_ge {x} e /\ x' IN normball (x:real^N) (r:real)}`
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN RESA_TAC THEN RESA_TAC
THEN EXISTS_TAC`e:real^N->bool`
THEN ASM_REWRITE_TAC[];
STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN RESA_TAC
THEN EXISTS_TAC `aff_ge {x:real^N} e `
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC `e:real^N->bool`
THEN ASM_REWRITE_TAC[]]);;
let RADIAL_XFAN_INTER_BALL=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) r.
FAN (x,V,E) /\ r> &0 ==> radial_norm r x (xfan (x,V,E) INTER normball x r)`,
REPEAT STRIP_TAC THEN REWRITE_TAC[XFAN_INTER_BALL_UNIONS]
THEN MATCH_MP_TAC RADIAL_UNIONS
THEN MRESAL_TAC set_edges_is_finite_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`][IN_ELIM_THM]
THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3->bool. aff_ge {x:real^3} e INTER normball x r)`;`E:(real^3->bool)->bool`][IMAGE;]
THEN REPEAT STRIP_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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC "EM")
THEN STRIP_TAC
THEN REMOVE_THEN "EM" 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 ASM_MESON_TAC[RADIAL_AFF_GE_1_2]);;
let RADIAL_NORM_YFAN_INTER_BALL=prove(`!x:real^3 V E r.
FAN(x,V,E) /\ r> &0
==> radial_norm r x ( (yfan (x,V,E)) INTER normball x r)`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[yfan;SET_RULE`((:real^3) DIFF xfan (x,V,E)) INTER normball x r= ((:real^3) INTER normball x r) DIFF (xfan (x,V,E) INTER normball x r)`]
THEN MRESA_TAC RADIAL_UNIV[`r:real`;`x:real^3`]
THEN MRESA_TAC RADIAL_XFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` r:real`]
THEN MRESAL_TAC RADIAL_DIFF[`r:real`;`x:real^3`;`(xfan ((x:real^3),V:real^3->bool,E) INTER normball x r)`;`(:real^3) INTER normball (x:real^3) (r:real)`;][SET_RULE`xfan (x,V,E) INTER normball x r SUBSET (:real^3) INTER normball x r`;]);;
let SOLID_ANGLE_YFAN=prove(`!x:real^3 V E.
FAN (x,V,E) ==> sol x (yfan (x,V,E))= &4 * pi`,
REPEAT STRIP_TAC
THEN MRESAL_TAC RADIAL_NORM_YFAN_INTER_BALL[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&1> &0`]
THEN MRESAL_TAC MESURABLE_YFAN_INTER_BALL
[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&0<= &1`]
THEN MRESAL_TAC MEASURE_YFAN_INTER_BALL
[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` &1:real`][REAL_ARITH`&0<= &1`]
THEN MRESAL_TAC sol[`x:real^3`;`yfan(x:real^3,V:real^3->bool,E)`;`&1`][REAL_ARITH`&1> &0`]
THEN REAL_ARITH_TAC);;
let SUM_SOL_IN_TOPOLOGICAL_COMPONENET_EQ_IN_FACE_SET=prove(`!x:real^3 V E.
FAN(x,V,E) /\ conforming_fan (x,V,E)
==> sum (topological_component_yfan (x,V,E)) (\f. sol x f) = sum (face_set (hypermap1_of_fanx (x,V,E))) (\f. sol x (dartset_leads_into_fan x V E f))`,
REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC SUM_IMAGE[`(\f. (dartset_leads_into_fan x V E f))`;`(\f. sol x f)`;`(face_set (hypermap1_of_fanx (x:real^3,V,E)))`]
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`(!x' y.
x' IN face_set (hypermap1_of_fanx (x,V,E)) /\
y IN face_set (hypermap1_of_fanx (x,V,E)) /\
dartset_leads_into_fan x V E x' = dartset_leads_into_fan x V E y
==> x' = y)`ASSUME_TAC
THENL[
REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC "A")
THEN 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)`;`x':real^3#real^3#real^3#real^3->bool`]
THEN REMOVE_THEN "A" (fun th-> MRESA1_TAC th`dartset_leads_into_fan (x:real^3) V E x'` )
THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3->bool` THEN MRESA1_TAC th`x':real^3#real^3#real^3#real^3->bool`);
POP_ASSUM (fun th-> REWRITE_TAC[th])
THEN REWRITE_TAC[FUN_EQ_THM;o_DEF;]
THEN SUBGOAL_THEN`(IMAGE (\f. dartset_leads_into_fan x V E f)
(face_set (hypermap1_of_fanx (x,V,E))))=topological_component_yfan (x,V,E)` ASSUME_TAC
THENL[
ONCE_REWRITE_TAC[EXTENSION]
THEN REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THENL[STRIP_TAC
THEN ASM_SIMP_TAC[dartset_leads_into_is_topological_component_yfan];
REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC "A")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "A" (fun th-> MRESA1_TAC th`x':real^3->bool` )
THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool`
THEN ASM_REWRITE_TAC[]];
ASM_REWRITE_TAC[]]]);;
let SOL_EMPTY=prove(`!x:real^3.
sol x {} = &0`,
GEN_TAC
THEN MRESAL_TAC sol[`x:real^3`;`{}:real^3->bool`;`&1`][REAL_ARITH`&1> &0`;SET_RULE`{} INTER normball x (&1)={}`;MEASURABLE_EMPTY;RADIAL_EMPTY;MEASURE_EMPTY]
THEN REAL_ARITH_TAC);;
let SOL_DISJOINT_UNION =prove(`!x:real^3 s t r. r > &0 /\ measurable (s INTER normball x r) /\ measurable (t INTER normball x r) /\ DISJOINT s t /\ radial_norm r x (s INTER normball x r) /\ radial_norm r x (t INTER normball x r)
==> sol x (s UNION t) = sol x s + sol x t`,
REPEAT STRIP_TAC
THEN MRESAL_TAC MEASURABLE_UNION[`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`]
THEN MP_TAC(SET_RULE`DISJOINT (s:real^3->bool) t
==>DISJOINT (s INTER normball x r) (t INTER normball x r)`)
THEN RESA_TAC
THEN MRESAL_TAC MEASURE_DISJOINT_UNION[`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`]
THEN MRESAL_TAC RADIAL_UNION[`r:real`;`x:real^3`;`(s INTER normball x r):real^3->bool`;`(t INTER normball x r):real^3->bool`][SET_RULE`(s INTER normball x r) UNION (t INTER normball x r):real^3->bool=((s UNION t) INTER normball x r):real^3->bool`]
THEN MRESA_TAC sol[`x:real^3`;`s:real^3->bool`;`r:real`]
THEN MRESA_TAC sol[`x:real^3`;`t:real^3->bool`;`r:real`]
THEN MRESA_TAC sol[`x:real^3`;`s UNION t:real^3->bool`;`r:real`]
THEN REAL_ARITH_TAC);;
let UNIONS_INTER=prove(`!f t:A->bool. UNIONS f INTER t= UNIONS {s INTER t| s IN f}`,
ONCE_REWRITE_TAC[EXTENSION]
THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THENL[
STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`{x | x IN u /\ x IN t}:A->bool`
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN EXISTS_TAC`u :A->bool`
THEN ASM_REWRITE_TAC[];
STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN RESA_TAC
THEN EXISTS_TAC`s :A->bool`
THEN ASM_REWRITE_TAC[]]);;
let UNIONS_INTER1=prove(`!f t:A->bool. UNIONS f INTER t= UNIONS {y | ?s. s IN f /\ y = s INTER t}`,
ONCE_REWRITE_TAC[EXTENSION]
THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THENL[
STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`{x | x IN u /\ x IN t}:A->bool`
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN EXISTS_TAC`u :A->bool`
THEN ASM_REWRITE_TAC[];
STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN RESA_TAC
THEN EXISTS_TAC`s :A->bool`
THEN ASM_REWRITE_TAC[]]);;
let MEASURABLE_UNIONS = prove
(`!f:(real^N->bool)->bool.
FINITE f /\ (!s. s IN f ==> measurable s)
==> measurable (UNIONS f)`,
REWRITE_TAC[IMP_CONJ] THEN
MATCH_MP_TAC FINITE_INDUCT_STRONG THEN
SIMP_TAC[UNIONS_0; UNIONS_INSERT; MEASURABLE_EMPTY] THEN
REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC THEN
MATCH_MP_TAC MEASURABLE_UNION THEN ASM_SIMP_TAC[]);;
let SOL_UNIONS=prove(`!r x f:(real^3->bool)->bool.
FINITE f /\ r> &0 /\
(!s. s IN f ==> measurable (s INTER normball x r) /\ radial_norm r x (s INTER normball x r)) /\
(!s t. s IN f /\ t IN f /\ ~(s = t) ==> DISJOINT s t)
==> sol x (UNIONS f) = sum f (\s. sol x s)`,
GEN_TAC THEN GEN_TAC THEN REWRITE_TAC[IMP_CONJ] THEN
MATCH_MP_TAC FINITE_INDUCT_STRONG THEN
SIMP_TAC[UNIONS_0; UNIONS_INSERT; SOL_EMPTY;SUM_CLAUSES]
THEN REWRITE_TAC[IN_INSERT] THEN REPEAT STRIP_TAC
THEN ASM_TAC THEN DISCH_THEN(LABEL_TAC"EM")
THEN ASM_REWRITE_TAC[SET_RULE`(!s. P s \/ Q s==> C s)<=> (!s. P s ==> C s) /\ (!s. Q s ==> C s)`;SET_RULE`(!s. P s /\ Q s) <=> (!s. P s) /\ (!s. Q s)`;
SET_RULE`(!s. E s ==> P s \/ Q s==> C s)<=> (!s. E s==> P s ==> C s) /\ (!s. E s ==> Q s ==> C s)`]
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "EM" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN DISCH_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN MATCH_MP_TAC SOL_DISJOINT_UNION
THEN EXISTS_TAC`r:real`
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM (fun th-> MP_TAC (SPEC `x':real^3->bool` th))`!s:real^3->bool. s = x'
==> measurable (s INTER normball x r) /\
radial_norm r x (s INTER normball x r)`
THEN REWRITE_TAC[]
THEN DISCH_TAC
THEN ASM_SIMP_TAC[UNIONS_INTER1]
THEN MRESAL_TAC FINITE_IMAGE[`(\s:real^3->bool. s INTER normball x r)`;`f:(real^3->bool)->bool`][IMAGE;]
THEN FIND_ASSUM MP_TAC`!s:real^3->bool. s IN f
==> measurable (s INTER normball x r) /\
radial_norm r x (s INTER normball x r)`
THEN REWRITE_TAC[SET_RULE`(!s. P s==> Q s /\ Q1 s)<=>(!s. P s==> Q s )/\ (!s. P s==> Q1 s)`]
THEN STRIP_TAC
THEN MRESAL_TAC RADIAL_UNIONS[`r:real`;`x:real^3`;`{y | ?s. s IN f /\ y = s INTER normball x r}:(real^3->bool)->bool`;][IN_ELIM_THM;SET_RULE`(!s. (?s'. s' IN f /\ s = P s') ==> Q s) <=> (!s. s IN f ==> Q (P s))`
]
THEN MRESAL_TAC MEASURABLE_UNIONS[`{y | ?s. s IN f /\ y = s INTER normball x r}:(real^3->bool)->bool`;][IN_ELIM_THM;SET_RULE`(!s. (?s'. s' IN f /\ s = P s') ==> Q s) <=> (!s. s IN f ==> Q (P s))`;DISJOINT]
THEN ONCE_REWRITE_TAC[SET_RULE`A INTER B= B INTER A`]
THEN REWRITE_TAC[UNIONS_INTER1]
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-> MRESAL1_TAC th `x':real^3->bool`[SET_RULE` (!t. t IN f ==> ~(x' = t) ==> DISJOINT x' t)
<=> (!t. t IN f /\ ~(x' = t) ==> DISJOINT x' t)`])
THEN FIND_ASSUM MP_TAC`~((x':real^3->bool) IN f)`
THEN REWRITE_TAC[SET_RULE`~(x' IN f)<=> (!t. t IN f ==> ~(x' = t))`]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` (!t. t IN f /\ ~(x' = t:real^3->bool) ==> DISJOINT x' t) /\
(!t. t IN f ==> ~(x' = t:real^3->bool))==> (!t. t IN f ==> DISJOINT x' t)`)
THEN ASM_REWRITE_TAC[DISJOINT]
THEN SET_TAC[]);;
let BOUNDED_INTER_BALL=prove(`!x:real^3 V E.
FAN(x,V,E) /\ conforming_fan (x,V,E)
==>(!f. f IN topological_component_yfan (x,V,E)
==> bounded (f INTER normball x r)) `,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC BOUNDED_SUBSET
THEN EXISTS_TAC`(normball x r):real^3->bool`
THEN SIMP_TAC[GSYM ball_eq_normball;BOUNDED_BALL]
THEN SET_TAC[]);;
let OPEN_AFF_GT_3_1=prove(`!x v u w:real^3.
(~coplanar {x,v,u,w}) ==> open (aff_gt {x,v,u} {w})`,
GEOM_ORIGIN_TAC `x:real^3` THEN
REPEAT STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN
MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN ASSUME_TAC th)
THEN MRESAL_TAC coplanar_cross_dot[`vec 0:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`]
THEN MP_TAC (REAL_ARITH`~((v cross u) dot w = &0)==> &0< (v cross u) dot w \/ &0< --((v cross u) dot w)`)
THEN RESA_TAC
THENL[POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th)
THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`v:real^3`;`u:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`;]
THEN REWRITE_TAC[REAL_ARITH`&0 A> &0`; OPEN_HALFSPACE_GT];
POP_ASSUM MP_TAC
THEN REWRITE_TAC[GSYM DOT_LNEG]
THEN ONCE_REWRITE_TAC[GSYM CROSS_SKEW]
THEN ASM_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN REPEAT DISCH_TAC
THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`(vec 0):real^3`;`u:real^3`;`v:real^3`;`w:real^3`][VECTOR_ARITH`A- vec 0=A`;]
THEN REWRITE_TAC[ REAL_ARITH`&0 A> &0`;OPEN_HALFSPACE_GT;] ]);;
let EQ_SET_THM=prove(`!f' f.{(f:A->B) y| y IN f'}= {t|(?y. y IN f' /\ t = f y)}`,
ONCE_REWRITE_TAC[EXTENSION] THEN REWRITE_TAC[IN_ELIM_THM]);;
let fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds 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
==> aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} =
aff_gt {x, pr2 y, pr3 y} {sigma_fan x V E (pr2 y) (pr3 y)}`,
REPEAT STRIP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
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 MRESA_TAC face_subset_dart_fan[`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`y IN ds /\ ds SUBSET d1_fan(x,V,E)==> y IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan]
THEN ASM_SIMP_TAC[fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan]);;
let OPEN_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 V E f.
FAN(x,V,E) /\ conforming_fan (x,V,E)/\ f IN topological_component_yfan (x,V,E)
==> open f`,
REWRITE_TAC[conforming_fan;conforming_bijection_fan;conforming_half_space_fan]
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"EM")
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th`f:real^3->bool`[EXISTS_UNIQUE])
THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3->bool`)
THEN MATCH_MP_TAC OPEN_INTERS
THEN ASM_REWRITE_TAC[IN_ELIM_THM;]
THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`]
THEN MRESAL_TAC FINITE_IMAGE[`(\y:real^3#real^3#real^3#real^3. aff_gt {x:real^3, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})`;`f':real^3#real^3#real^3#real^3->bool`][IMAGE;EQ_SET_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`]
THEN MATCH_MP_TAC OPEN_AFF_GT_3_1
THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
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 [`(pr2 y):real^3`;`(pr3 y):real^3`] )
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`]
THEN DISCH_TAC
THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`]
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`;`(pr2 y):real^3`;`(pr3 y):real^3`;]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN ASM_REWRITE_TAC[]);;
let OPEN_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL=prove(`!x:real^3 V E f.
FAN(x,V,E) /\ conforming_fan (x,V,E)/\ f IN topological_component_yfan (x,V,E)
==> open (f INTER normball x r)`,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC OPEN_INTER
THEN ASM_SIMP_TAC[GSYM ball_eq_normball;OPEN_BALL;]
THEN ASM_MESON_TAC[OPEN_TOPOLOGICAL_COMPONENT_YFAN]);;
let MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL=prove(`!x:real^3 V E r f.
FAN(x,V,E) /\ conforming_fan (x,V,E) /\ f IN topological_component_yfan (x,V,E)
==> measurable (f INTER normball x r) `,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC MEASURABLE_OPEN
THEN ASM_MESON_TAC[OPEN_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL;BOUNDED_INTER_BALL]);;
let RADIAL_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 V E r f.
FAN(x,V,E) /\ r> &0 /\ conforming_fan (x,V,E) /\ f IN topological_component_yfan (x,V,E)
==> radial_norm r x (f INTER normball x r) `,
REWRITE_TAC[conforming_fan;conforming_bijection_fan;conforming_half_space_fan]
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"EM")
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "EM" (fun th-> MRESAL1_TAC th`f:real^3->bool`[EXISTS_UNIQUE])
THEN REMOVE_THEN "YEU" (fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3->bool`)
THEN MATCH_MP_TAC RADIAL_INTERS
THEN ASM_REWRITE_TAC[IN_ELIM_THM;]
THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`]
THEN MRESAL_TAC FINITE_IMAGE[`(\y:real^3#real^3#real^3#real^3. aff_gt {x:real^3, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})`;`f':real^3#real^3#real^3#real^3->bool`][IMAGE;EQ_SET_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_dart_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`]
THEN MATCH_MP_TAC RADIAL_AFF_GT_3_1
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC properties_of_elements_in_face_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f':real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
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 [`(pr2 y):real^3`;`(pr3 y):real^3`] )
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(pr3 y):real^3`]
THEN DISCH_TAC
THEN MRESA_TAC properties_of_set_of_edge_fan [`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`(pr2 y):real^3`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`]
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E (pr2 y) (pr3 y)):real^3`;`(pr2 y):real^3`;`(pr3 y):real^3`;]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN ASM_REWRITE_TAC[]
THEN ASM_MESON_TAC[notcoplanar_disjoints]);;
let FINITE_TOPOLOGICAL_COMPONENT_YFAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) >1)
/\ fan80(x,V,E)
==> FINITE (topological_component_yfan (x,V,E))`,
REPEAT STRIP_TAC
THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V,E)`
THEN MRESAL_TAC FINITE_IMAGE[`(\f:real^3#real^3#real^3#real^3->bool. dartset_leads_into_fan x V E f)`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`][IMAGE;]
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`{y | ?f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\
y = dartset_leads_into_fan x V E f} =topological_component_yfan (x:real^3,V,E)` (fun th-> REWRITE_TAC[th])
THEN ONCE_REWRITE_TAC[EXTENSION]
THEN REWRITE_TAC[IN_ELIM_THM]
THEN GEN_TAC THEN EQ_TAC
THENL[
REPEAT STRIP_TAC
THEN ASM_SIMP_TAC[dartset_leads_into_is_topological_component_yfan];
REPEAT STRIP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`A=B<=> B=A`]
THEN ASM_SIMP_TAC[version_JUTSTKG]]);;
let SUM_SOL_TOPOLOGICAL_COMPONENT_YFAN_EQ_SOL_UNIONS=prove(`!x:real^3 V E.
FAN(x,V,E) /\ conforming_fan (x,V,E)
==> sol x (UNIONS (topological_component_yfan (x,V,E)))=sum (topological_component_yfan (x,V,E)) (\f. sol x f)`,
REPEAT STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan]; THEN ASSUME_TAC th THEN STRIP_TAC)
THEN MATCH_MP_TAC SOL_UNIONS
THEN MRESAL_TAC FINITE_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;][SET_RULE`(!s. P s==> Q s /\ R s)<=>(!s. P s==> Q s) /\(!s. P s==> R s)`]
THEN EXISTS_TAC`&1`
THEN MRESAL_TAC RADIAL_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`&1:real`][REAL_ARITH`&1> &0`]
THEN MRESA_TAC MEASURABLE_TOPOLOGICAL_COMPONENT_YFAN_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`&1:real`]
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DISJOINT;CONNECTED_COMPONENT_NONOVERLAP]);;
let UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN=prove(`!x:real^3 V E.
UNIONS (topological_component_yfan (x,V,E))= yfan(x,V,E)`,
ONCE_REWRITE_TAC[EXTENSION]
THEN REWRITE_TAC[UNIONS;topological_component_yfan;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THENL[
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN MATCH_MP_TAC(SET_RULE`!x B A. x IN B /\ B SUBSET A==> x IN A`)
THEN EXISTS_TAC`connected_component (yfan (x:real^3,V:real^3->bool,E)) (y:real^3)`
THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_SUBSET];
STRIP_TAC
THEN EXISTS_TAC`connected_component (yfan (x,V:real^3->bool,E)) x'`
THEN STRIP_TAC
THENL[EXISTS_TAC`x':real^3`
THEN ASM_REWRITE_TAC[];
ASM_REWRITE_TAC[IN;CONNECTED_COMPONENT_REFL_EQ]]]);;
let SUM_SOL_IN_FACE_SET_EQ_4PI=prove(`!x:real^3 V E.
FAN(x,V,E) /\ conforming_fan (x,V,E)
==> sum (face_set (hypermap1_of_fanx (x,V,E))) (\f. sol x (dartset_leads_into_fan x V E f))= &4 * pi`,
REPEAT STRIP_TAC
THEN MRESA_TAC SUM_SOL_IN_TOPOLOGICAL_COMPONENET_EQ_IN_FACE_SET[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC SUM_SOL_TOPOLOGICAL_COMPONENT_YFAN_EQ_SOL_UNIONS[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN])
THEN ASM_SIMP_TAC[SOLID_ANGLE_YFAN]);;
let DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET=prove(`!(H:(A)hypermap). dart H = UNIONS (face_set H)/\ dart H = UNIONS (node_set H)/\ dart H = UNIONS (edge_set H)`,
GEN_TAC THEN REWRITE_TAC[face_set;node_set;edge_set]
THEN REPEAT STRIP_TAC
THEN MATCH_MP_TAC lemma_partition
THEN REWRITE_TAC[hypermap_lemma]);;
let FINITE_NODE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds.
ds IN node_set(hypermap1_of_fanx (x,V,E))
==> FINITE ds `,
REWRITE_TAC[node_set;set_of_orbits;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[GSYM node;NODE_FINITE]);;
let lemma_properties_of_node_set_fan=prove(`!x V E f y y1. FAN (x,V,E) /\ (!v. v IN V==>CARD (set_of_edge v V E) >1)/\
f IN (node_set (hypermap1_of_fanx (x,V,E)) )
/\ y IN f /\ y1 IN f
==> pr2 y = pr2 y1 `,
REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_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 MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->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 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 REMOVE_ASSUM_TAC
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) `;`n':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`x':real^3#real^3#real^3#real^3`)
THEN FIND_ASSUM MP_TAC `x' IN d1_fan (x:real^3,V,E)`
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC power_n_fan[`n':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[pr2]);;
let lemma_node_identity_fan=prove(`!x V E f y. f IN (node_set (hypermap1_of_fanx (x,V,E)) )
/\ y IN f
==> f= node (hypermap1_of_fanx (x,V,E)) y`,
REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[node]
THEN MESON_TAC[lemma_orbit_identity; hypermap_lemma]);;
let node_subset_dart_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds.
FAN(x,V,E)
/\ ds IN node_set(hypermap1_of_fanx (x,V,E))
==> ds SUBSET d_fan (x,V,E)`,
REPEAT GEN_TAC THEN STRIP_TAC
THEN MRESA_TAC lemma_node_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`]
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 MRESA_TAC lemma_node_subset[`hypermap1_of_fanx(x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`]);;
let rep_node_set_fan=prove(`!x V E f y. FAN (x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) )
/\ y IN f
==> f = {z| ?i. i >= 0 /\ z=(x, pr2 y,power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) i, power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) (SUC i))}`,
REPEAT STRIP_TAC
THEN ASM_SIMP_TAC[lemma_node_identity_fan;]
THEN REWRITE_TAC[node;orbit_map;EXTENSION;IN_ELIM_THM]
THEN MRESA_TAC node_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MP_TAC(SET_RULE`y IN (f:real^3#real^3#real^3#real^3->bool) /\ f SUBSET d_fan(x,V,E)==> y IN d_fan(x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN ASSUME_TAC th)
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[pr2;pr3]
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 GEN_TAC
THEN EQ_TAC
THENL[
STRIP_TAC
THEN 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 REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`)
THEN MRESA_TAC power_n_fan[`n:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN RESA_TAC
THEN EXISTS_TAC`n:num`
THEN ASM_SIMP_TAC[];
REPEAT STRIP_TAC
THEN EXISTS_TAC`i:num`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`i:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`;]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3`)
THEN MRESA_TAC power_n_fan[`i:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN RESA_TAC]);;
let properties_of_elements_in_node_fully_surroundedfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y.
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) >1)
/\ ds IN node_set(hypermap1_of_fanx (x,V,E))
/\ y IN ds
==> {pr2 y, pr3 y} IN E`,
REPEAT GEN_TAC THEN STRIP_TAC
THEN MRESA_TAC node_subset_dart_fan[`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`y IN ds /\ ds SUBSET d_fan (x,V,E)==> y IN d_fan (x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[pr2;pr3]);;
let lemma_card_node_eq_set_of_orbits=prove(`!x V E f y. FAN (x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) )
/\ y IN f
==> CARD {z| ?i. i >= 0 /\ z=(x, pr2 y,power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) i, power_map_points (sigma_fan) x V E (pr2 y) (pr3 y) (SUC i))}= CARD( set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((pr2 y):real^3) ((pr3 y):real^3)
)`,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC BIJECTIONS_CARD_EQ
THEN EXISTS_TAC`pr3:real^3#real^3#real^3#real^3->real^3`
THEN EXISTS_TAC`(\z:real^3. x,pr2 y, z, sigma_fan x V E (pr2 y) z)`
THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
THEN MP_TAC (ISPECL[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(pr2 y):real^3`;` ((pr3 y):real^3)`]FINITE_ORBITS_SIGMA_FAN)
THEN RESA_TAC
THEN REWRITE_TAC[set_of_orbits_points_fan;IN_ELIM_THM; pr3]
THEN REWRITE_TAC[GSYM pr3]
THEN STRIP_TAC
THENL[
STRIP_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`0<= i <=> i>=0`;pr3;power_map_points]
THEN EXISTS_TAC`i:num`
THEN ASM_REWRITE_TAC[];
STRIP_TAC THEN STRIP_TAC THEN ASM_REWRITE_TAC[ARITH_RULE`i>=0 <=> 0<=i`;power_map_points]
THEN EXISTS_TAC`i:num`
THEN ASM_REWRITE_TAC[]]);;
let lemma_card_node_eq_set_of_edge=prove(`!x V E f y. FAN (x,V,E) /\ f IN (node_set (hypermap1_of_fanx (x,V,E)) )
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1) /\ y IN f
==> CARD (set_of_edge (pr2 y) V E)=CARD f `,
REPEAT STRIP_TAC
THEN MRESA_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC lemma_card_node_eq_set_of_orbits[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC CARD_SET_OF_ORBITS_POINTS_FAN[`(x:real^3)`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(pr2 y):real^3`;` ((pr3 y):real^3)`]);;
let mono_cyclic_power_sigma_fan=prove(`!x V E v u i j. FAN(x,V,E)/\ {v,u} IN E /\
i IN 0..CARD (set_of_edge (v) V E) - 1 /\
j IN 0..CARD (set_of_edge (v) V E) - 1 /\
power_map_points sigma_fan x V E (v) (u) i =
power_map_points sigma_fan x V E (v) (u) j
==> i = j`,
REWRITE_TAC[IN_NUMSEG_0]
THEN REPEAT STRIP_TAC
THEN DISJ_CASES_TAC(ARITH_RULE`i=j \/ i< j\/ j< i:num`)
THENL[
ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL[
MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`;
` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`j:num`;`i:num`]cyclic_power_sigma_fan)
THEN RESA_TAC
THEN ASM_TAC
THEN ARITH_TAC;
MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`;
` (E:(real^3->bool)->bool)`;` (v:real^3)`;` (u:real^3)`;`i:num`;`j:num`]cyclic_power_sigma_fan)
THEN RESA_TAC
THEN ASM_TAC
THEN ARITH_TAC]]);;
let SUM_AZIM_FAN_OF_NODE_EQ_SUM_AZIM_I_FAN=prove(`!x V E f y. FAN (x,V,E) /\ f IN node_set (hypermap1_of_fanx (x,V,E)) /\ y IN f /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
==> sum (0..CARD (set_of_edge (pr2 y) V E) - 1) (\i. azim_i_fan x V E (pr2 y) (pr3 y) i) =
sum f (\y1. azim_fan x V E (pr2 y1) (pr3 y1))`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC "EM")
THEN MRESA_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
THEN SUBGOAL_THEN`(!x' y1.
x' IN set_of_orbits_points_fan x V E (pr2 y) (pr3 y) /\
y1 IN set_of_orbits_points_fan x V E (pr2 y) (pr3 y) /\
x,pr2 y,x',sigma_fan x V E (pr2 y) x' =
x,pr2 y,y1,sigma_fan x V E (pr2 y) y1
==> x' = y1)`ASSUME_TAC
THENL[MESON_TAC[EQ_PAIR_4];
MRESAL_TAC SUM_IMAGE[`(\z:real^3. x,pr2 y, z, sigma_fan x V E (pr2 y) z)`;`(\y. azim_fan x V E (pr2 y) (pr3 y))`;`set_of_orbits_points_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) ((pr2 y):real^3) ((pr3 y):real^3)`][IMAGE]
THEN POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[set_of_orbits_points_fan]
THEN REWRITE_TAC[IN_ELIM_THM;SET_RULE`{y' | ?x'. (?i. 0 <= i /\
x' = power_map_points sigma_fan x V E (pr2 y) (pr3 y) i) /\
y' = x,pr2 y,x',sigma_fan x V E (pr2 y) x'} = {y' | ?i. 0 <= i /\
y' = x,pr2 y,power_map_points sigma_fan x V E (pr2 y) (pr3 y) i,sigma_fan x V E (pr2 y) (power_map_points sigma_fan x V E (pr2 y) (pr3 y) i)}`;power_map_points;ARITH_RULE`i>= 0<=> 0<= i`]
THEN RESA_TAC
THEN REWRITE_TAC[o_DEF;pr2;pr3]
THEN ASM_REWRITE_TAC[GSYM pr2; GSYM pr3;azim_fan;azim_i_fan]
THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr3 y):real^3)`;` ((pr2 y):real^3)`]
THEN REMOVE_ASSUM_TAC
THEN USE_THEN "EM"(fun th-> MP_TAC(ISPEC `(pr2 y):real^3` th) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN RESA_TAC)
THEN MRESA_TAC SIMP_ORBITS_POINTS_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr2 y):real^3)`;` ((pr3 y):real^3)`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MP_TAC(SPECL[`(x:real^3)`;` (V:real^3->bool)`;
` (E:(real^3->bool)->bool)`;` ((pr2 y):real^3)`;` ((pr3 y):real^3)`]mono_cyclic_power_sigma_fan
)
THEN RESA_TAC
THEN MRESAL_TAC SUM_IMAGE[`(\i:num. power_map_points sigma_fan x V E (pr2 y) (pr3 y) i)`;`(\x'. azim x (pr2 y) x' (sigma_fan x V E (pr2 y) x'))`;`0..CARD (set_of_edge (pr2 y) (V:real^3->bool) E) - 1`][IMAGE;o_DEF;power_map_points]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;IN_NUMSEG_0])
THEN MP_TAC(ARITH_RULE`CARD (set_of_edge (pr2 y) V E) > 1==> (!i. i <= CARD (set_of_edge (pr2 y) V E) - 1<=> i < CARD (set_of_edge (pr2 y) V E)) `)
THEN RESA_TAC
THEN SUBGOAL_THEN`{y1 | ?i. i < CARD (set_of_edge (pr2 y) V E) /\
y1 = power_map_points sigma_fan x V E (pr2 y) (pr3 y) i}
=
{power_map_points sigma_fan x V E (pr2 y) (pr3 y) i | i | i <
CARD
(set_of_edge
(pr2 y)
V
E)}
`(fun th-> REWRITE_TAC[th])
THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM]]);;
let exists_point_in_node=prove(`!x V E f. f IN node_set (hypermap1_of_fanx (x,V,E))
==> ?y. y IN f`,
REWRITE_TAC[node_set;set_of_orbits;IN_ELIM_THM] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3`
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[POWER;ARITH_RULE`0>=0`;I_DEF]);;
let SUM_AZIM_FAN_OF_NODE_EQ_2PI_I_FAN=prove(`!x V E f. FAN (x,V,E) /\ f IN node_set (hypermap1_of_fanx (x,V,E)) /\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
==>
sum f (\y. azim_fan x V E (pr2 y) (pr3 y))= &2 * pi`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC exists_point_in_node[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;]
THEN MRESA_TAC SUM_AZIM_FAN_OF_NODE_EQ_SUM_AZIM_I_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;])
THEN SUBGOAL_THEN`(\i. azim_i_fan x V E (pr2 y) (pr3 y) i)= azim_i_fan x V E (pr2 y) (pr3 y) `(fun th-> REWRITE_TAC[th])
THEN REWRITE_TAC[FUN_EQ_THM]
THEN MATCH_MP_TAC SUM_AZIMS_EQ_2PI_FAN
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC properties_of_elements_in_node_fully_surroundedfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`; `y:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((pr3 y):real^3)`;` ((pr2 y):real^3)`]
THEN REMOVE_ASSUM_TAC
THEN USE_THEN "EM"(fun th-> MP_TAC(ISPEC `(pr2 y):real^3` th) THEN POP_ASSUM (fun th-> REWRITE_TAC[th]) THEN RESA_TAC)
THEN ASM_REWRITE_TAC[ARITH_RULE`1 A>1`]
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge (pr2 y) V E = {(pr3 y):real^3})\/ ~(set_of_edge (pr2 y) V E = {pr3 y})`)
THENL[
MRESA_TAC CARD_SING[`(pr3 y):real^3`; `(set_of_edge (pr2 y) V E):real^3->bool`]
THEN FIND_ASSUM MP_TAC `CARD ((set_of_edge (pr2 y) V E):real^3->bool) >1`
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun TH-> REWRITE_TAC[TH])
THEN ARITH_TAC;
ASM_REWRITE_TAC[]]);;
let SUM_CARD_FACE_NODE_DART_FAN=prove(`!x V E.
FAN (x,V,E) /\ conforming_fan (x,V,E)
==> &2 * &(CARD (face_set (hypermap1_of_fanx (x,V,E)))) +
&2 * &(CARD (node_set (hypermap1_of_fanx (x,V,E)))) -
&(CARD (dart (hypermap1_of_fanx (x,V,E)))) = &4 `,
REPEAT STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan] THEN CONV_TAC(TOP_DEPTH_CONV let_CONV) THEN REWRITE_TAC[SET_RULE`(!s. P s ==> Q s /\ Q1 s/\ Q2 s) <=> (!s. P s ==> Q s ) /\ (!s. P s ==> Q1 s) /\ (!s. P s ==> Q2 s)`]
THEN ASSUME_TAC th THEN STRIP_TAC)
THEN MRESA_TAC SUM_SOL_IN_FACE_SET_EQ_4PI[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC SUM_EQ[`(\f. sol x (dartset_leads_into_fan (x:real^3) V E f))`;`(\f. (&2 * pi + sum f (\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi)))`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`]
THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V,E)`
THEN MRESA_TAC SUM_ADD[`(\f:real^3#real^3#real^3#real^3->bool. &2 * pi)`;`(\f. sum f (\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi))`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`]
THEN MRESA_TAC SUM_CONST[`&2 * pi`;`face_set (hypermap1_of_fanx (x:real^3,V,E))`]
THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;]
THEN SUBGOAL_THEN`(!t1 t2 y.
t1 IN face_set (hypermap1_of_fanx (x,V,E)) /\
t2 IN face_set (hypermap1_of_fanx (x,V,E)) /\
~(t1 = t2) /\
y IN t1 /\
y IN t2
==> azim_fan x V E (pr2 y) (pr3 y) - pi = &0)` ASSUME_TAC
THENL[
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN DISCH_THEN (LABEL_TAC "EM")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "EM" MP_TAC
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face];
MRESA_TAC SUM_UNIONS_NONZERO[` (\y. azim_fan x (V:real^3->bool) E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)) - pi)`;`face_set (hypermap1_of_fanx (x:real^3,V:real^3->bool,E))`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC SUM_SUB[`(\y. azim_fan x V E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)))`;`(\f:real^3#real^3#real^3#real^3. pi)`;`(UNIONS (node_set (hypermap1_of_fanx (x:real^3,V,E))))`]
THEN POP_ASSUM MP_TAC
THEN MRESA1_TAC DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET`(hypermap1_of_fanx (x:real^3,V:real^3->bool,E))`
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC SUM_CONST[`pi`;`(UNIONS (node_set (hypermap1_of_fanx (x:real^3,V,E))))`]
THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th;hypermap_lemma] THEN STRIP_TAC THEN POP_ASSUM (fun th -> REWRITE_TAC[th]) THEN REWRITE_TAC[th] THEN MP_TAC th THEN ASM_REWRITE_TAC[] THEN STRIP_TAC THEN ASSUME_TAC th THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC "MA"))
THEN RESA_TAC
THEN SUBGOAL_THEN`(!t1 t2 y.
t1 IN node_set (hypermap1_of_fanx (x,V,E)) /\
t2 IN node_set (hypermap1_of_fanx (x,V,E)) /\
~(t1 = t2) /\
y IN t1 /\
y IN t2
==> azim_fan x V E (pr2 y) (pr3 y) = &0)` ASSUME_TAC
THENL[
REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN DISCH_THEN (LABEL_TAC "EM")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "EM" MP_TAC
THEN MRESAL_TAC lemma_node_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][node]
THEN MRESAL_TAC lemma_node_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][node];
MRESAL_TAC SUM_UNIONS_NONZERO[` (\y. azim_fan x (V:real^3->bool) E (pr2 y) (pr3 (y:real^3#real^3#real^3#real^3)))`;`node_set (hypermap1_of_fanx (x:real^3,V:real^3->bool,E))`][FINITE_NODE_FAN]
THEN MRESA_TAC SUM_AZIM_FAN_OF_NODE_EQ_2PI_I_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;]
THEN MRESA_TAC SUM_EQ[`(\t:real^3#real^3#real^3#real^3->bool. sum t (\y. azim_fan x V E (pr2 y) (pr3 y)))`;`(\t:real^3#real^3#real^3#real^3->bool. &2 * pi)`;`(node_set (hypermap1_of_fanx (x:real^3,V,E)))`]
THEN MRESA_TAC SUM_CONST[`&2 * pi`;`node_set (hypermap1_of_fanx (x:real^3,V,E))`]
THEN REMOVE_THEN "MA"(fun th-> REWRITE_TAC[SYM th])
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[REAL_ARITH`A= A * &1`]
THEN MP_TAC(REAL_ARITH`&0< pi==> ~(pi= &0)`)
THEN ASM_REWRITE_TAC[PI_WORKS]
THEN STRIP_TAC
THEN MRESA1_TAC REAL_MUL_RINV`pi:real`
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;REAL_ARITH`(A+B-C)*D*E=(A*D+B*D-C*D)*E/\ (A*B)*C=B*A*C`;])
THEN REAL_ARITH_TAC]]);;
let nonconformin_fan_imp_n_fan_ge0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ ~(conforming_fan (x,V,E))
==> N_FAN(x,V,E)> 0`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM]
THEN ASM_SIMP_TAC[ARITH_RULE`~(A>0)<=> A=0`;DWFBRQY]);;
let nonconformin_fan_imp_exist_face_gt_3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ ~(conforming_fan (x,V,E))
==> ?ds. ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3`,
REPEAT STRIP_TAC
THEN MRESA_TAC nonconformin_fan_imp_n_fan_ge0[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[N_FAN]
THEN DISJ_CASES_TAC(SET_RULE`(!f. f IN face_set (hypermap1_of_fanx (x,V,E))==> CARD f -3=0)\/ ~(!f. f IN face_set (hypermap1_of_fanx (x:real^3,V,E))==> CARD f -3=0)`)
THENL[
ASM_SIMP_TAC[NSUM_EQ_0] THEN ARITH_TAC;
POP_ASSUM MP_TAC
THEN REWRITE_TAC[NOT_FORALL_THM;NOT_IMP;ARITH_RULE`~(A=0)<=> A>0`]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN ARITH_TAC]);;
let exists_face_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds.
ds IN face_set(hypermap1_of_fanx (x,V,E))
==> ?f1. f1 IN ds `,
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM;]
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);;
let exists_node_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds.
ds IN node_set(hypermap1_of_fanx (x,V,E))
==> ?f1. f1 IN ds `,
REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM;]
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);;
let identity_face_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1.
ds IN face_set(hypermap1_of_fanx (x,V,E))
/\ f1 IN ds
==> ds= face (hypermap1_of_fanx (x,V,E)) f1 `,
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_SIMP_TAC[GSYM face;]
THEN MESON_TAC[lemma_face_identity]);;
let identity_node_in_face_set=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1.
ds IN node_set(hypermap1_of_fanx (x,V,E))
/\ f1 IN ds
==> ds= node (hypermap1_of_fanx (x,V,E)) f1 `,
REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_SIMP_TAC[GSYM node;]
THEN MESON_TAC[lemma_node_identity]);;
let condition_f1_eq_fan=prove(`!x V E v u w.
FAN(x,V,E)
/\ {u,w} IN E /\ {v,u} IN E
/\ sigma_fan x V E u w = v
==> f1_fan x V E (x,v,u,sigma_fan x V E v u)=(x,u,w,v)`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN ASM_SIMP_TAC[INVERSE1_SIGMA_FAN]);;
let nonconformin_fan_imp_exist_3point_in_face=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)) /\ CARD ds >3
==> ?f1 f2 f3. {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ {pr2 f2, pr2 f3} IN E
/\ ~({pr2 f3, pr2 f1 } IN E)
/\ {pr2 f1, pr2 f2 } IN E
/\ sigma_fan x V E (pr2 f2) (pr2 f3)=pr2 f1
/\ pr2 f3= pr3 f2
/\ pr2 f2= pr3 f1`,
REPEAT STRIP_TAC
THEN MRESA_TAC exists_face_in_face_set[`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 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 MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN ABBREV_TAC`f2=f1_fan x V E (f1:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f3=f1_fan x V E (f2:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f4=f1_fan x V E (f3:real^3#real^3#real^3#real^3)`
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"VUT")
THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f4:real^3#real^3#real^3#real^3)` ;`(f3:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`f1 IN ds /\ f2 IN ds /\ f3 IN ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f1:real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f3:real^3#real^3#real^3#real^3)`)
THEN DISJ_CASES_TAC(SET_RULE`f3=f1 \/ ~(f3=f1:real^3#real^3#real^3#real^3)`)
THENL(*1*)[
MP_TAC(SET_RULE`f1=f3:real^3#real^3#real^3#real^3==> pr2 f1= pr2 f3`)
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th])
THEN REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`]
THEN REMOVE_ASSUM_TAC
THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1:real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (f3:real^3#real^3#real^3#real^3)`;
` pr2 (f2:real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC THEN RESA_TAC
THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E = {pr2 f3} \/ ~(set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E = {pr2 f3})`)
THENL[
MRESA_TAC CARD_SING[`(pr2 f3):real^3`; `(set_of_edge (pr2 (f2:real^3#real^3#real^3#real^3)) V E):real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)])
THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (f2:real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)`
THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (f2:real^3#real^3#real^3#real^3)) IN V`
THEN ARITH_TAC;
MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (f2:real^3#real^3#real^3#real^3)`;
` pr2 (f3:real^3#real^3#real^3#real^3)`]
THEN ASM_TAC THEN SET_TAC[]];(*1*)
DISJ_CASES_TAC(SET_RULE`f4=f1 \/ ~(f4=f1:real^3#real^3#real^3#real^3)`)
THENL(*2*)[
SUBGOAL_THEN(`((f1_fan (x:real^3) V E) POWER 3) f1=f1`) ASSUME_TAC
THENL(*3*)[
ASM_SIMP_TAC[ARITH_RULE`3= SUC(2)/\ 2= SUC(1) /\ 1= SUC(0)`;POWER;I_DEF;o_DEF];(*3*)
SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) f1=orbit_map (f1_fan x V E) f1`ASSUME_TAC
THENL(*4*)[
ASM_REWRITE_TAC[face;orbit_map;EXTENSION;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THEN STRIP_TAC
THEN MRESAL_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:real^3,V,E))) `][POWER_1;I_DEF]
THEN POP_ASSUM(fun th-> MRESA1_TAC th `f1:real^3#real^3#real^3#real^3`)
THEN EXISTS_TAC`n:num`
THEN ASM_REWRITE_TAC[];(*4*)
MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`][]
THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V E`;`3`;`f1:real^3#real^3#real^3#real^3`][ARITH_RULE`~(3=0)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM th])
THEN ASM_TAC THEN ARITH_TAC]];
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3`
THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3`
THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2:real^3#real^3#real^3#real^3)` ;`(f1: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)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]
THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) THEN ASSUME_TAC th)
THEN STRIP_TAC
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th] THEN MP_TAC th)
THEN REPEAT STRIP_TAC THEN ASSUME_TAC (SYM th))
THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr3 f1):real^3`;` (pr2 f3):real^3`]
THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th))
THEN REPEAT STRIP_TAC
THEN MRESA_TAC condition_f1_eq_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` (pr2 f3):real^3`;`(pr2 f1):real^3`;`(pr3 f1):real^3`;]
THEN REMOVE_THEN "EMYEU" MP_TAC
THEN REMOVE_THEN"VUT"(fun th-> REWRITE_TAC[SYM th])
THEN ASM_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN REPEAT (ASM_REWRITE_TAC[pr2;pr3] THEN STRIP_TAC THEN ASM_REWRITE_TAC[])
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC MONO_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v'':real^3`;`v:real^3`;`w'':real^3`;]]]);;
let condition_aff_gt_subset_yfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w.
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)
/\ ~({w,v} IN E)
==> aff_gt {x} {v,w} SUBSET yfan (x,V,E)`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[yfan;SET_RULE`A SUBSET (:real^3) DIFF B<=> A INTER B= {}`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[GSYM CONTRAPOS_THM]
THEN REWRITE_TAC[xfan;IN;SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESAL_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `w:real^3`][IN]);;
let segment_subset_aff_gt_union=prove(`!x:real^3 y z v u w.
~coplanar{x,v,u,w}
/\ y IN aff_gt {x} {v, u, w}
/\ z IN aff_gt {x} {w, v}
==> segment[y,z] SUBSET aff_gt {x} {w, v} UNION aff_gt {x} {v, u, w}`,
REWRITE_TAC[segment;UNION;SUBSET;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC(REAL_ARITH`u'<= &1==> u'= &1 \/ u'< &1`)
THEN RESA_TAC
THENL[
REWRITE_TAC[REAL_ARITH`&1- &1= &0`]
THEN REDUCE_VECTOR_TAC
THEN RESA_TAC;
STRIP_TAC
THEN MATCH_MP_TAC(SET_RULE`B==> A\/ B`)
THEN ASM_TAC
THEN DISCH_TAC
THEN MRESA_TAC notcoplanar_disjoints[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN MRESA_TAC AFF_GT_1_2[`x:real^3`;`w:real^3`;`v:real^3`;]
THEN MRESA_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN REWRITE_TAC[IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - u') % (t1 % x + t2 % v + t3 % u + t4 % w) +
u' % (t1' % x + t2' % w + t3' % v)
=((&1 - u') *t1 + u' *t1') % x + ((&1 - u')*t2+ u' * t3') % v + ((&1 - u')*t3) % u + ((&1 - u')*t4+ u' * t2') % w`]
THEN EXISTS_TAC`(&1 - u') * t1 + u' * t1':real`
THEN EXISTS_TAC`(&1 - u') * t2 + u' * t3':real`
THEN EXISTS_TAC`(&1 - u') * t3:real`
THEN EXISTS_TAC`(&1 - u') * t4 + u' * t2':real`
THEN ASM_REWRITE_TAC[REAL_ARITH` ((&1 - u') * t1 + u' * t1') +
((&1 - u') * t2 + u' * t3') +
(&1 - u') * t3 +
(&1 - u') * t4 +
u' * t2'
= (&1 - u') * (t1 + t2+ t3 + t4)+ u'*(t1' +t2'+t3')
`;REAL_ARITH`(&1 - u') * &1 + u' * &1 = &1`]
THEN STRIP_TAC
THENL[
MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0<=B ==> &0< A+B`)
THEN STRIP_TAC
THENL[MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`];
MATCH_MP_TAC REAL_LE_MUL
THEN ASM_TAC
THEN REAL_ARITH_TAC];
STRIP_TAC
THENL[
MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`];
MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0<=B ==> &0< A+B`)
THEN STRIP_TAC
THENL[
MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- u'<=> u'< &1`];
MATCH_MP_TAC REAL_LE_MUL
THEN ASM_TAC
THEN REAL_ARITH_TAC]]]]);;
let SEGMENT_CONNECTED=prove(`!a b. connected(segment [a,b])`,
REPEAT GEN_TAC THEN
MATCH_MP_TAC CONVEX_CONNECTED THEN
REWRITE_TAC[SEGMENT_CONVEX_HULL;CONVEX_CONVEX_HULL]);;
let AFF_GT_SUBSET_DART_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w.
FAN(x,V,E) /\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} 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} {w,v} SUBSET dart_leads_into x V E u w`,
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 MRESA_TAC notcoplanar_disjoints[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w: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)`;`u:real^3`; `w:real^3`]
THEN MRESA_TAC in_topological_component_yfan_is_connected[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`]
THEN MRESAL_TAC notcoplanar_4point_aff_gt_1_3_not_empty[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][SET_RULE`~(A={})<=> ?y. y IN A`]
THEN MP_TAC(SET_RULE`y IN aff_gt {x} {v, u, w}/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w
==> y IN dart_leads_into x V E u w`)
THEN RESA_TAC
THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`]
THEN MP_TAC(SET_RULE`dart_leads_into x V E u w SUBSET yfan (x,V,E)
/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w
==> aff_gt {x} {v, u, w} SUBSET yfan (x,V,E)`)
THEN RESA_TAC
THEN MRESA_TAC expand_element_in_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`;`y:real^3`]
THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`w:real^3`;`v:real^3`]
THEN MRESA_TAC condition_aff_gt_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 GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESA_TAC segment_subset_aff_gt_union[`x:real^3`;`y:real^3`;`y':real^3`;` v:real^3`;`u:real^3`;`w:real^3`;]
THEN MP_TAC(SET_RULE`
segment [y,y'] SUBSET aff_gt {x} {w, v} UNION aff_gt {x} {v, u, w}
/\ aff_gt {x} {w, v} SUBSET yfan (x,V:real^3->bool,E)
/\ aff_gt {x} {v, u, w} SUBSET yfan (x,V,E)
==> segment [y,y':real^3] SUBSET yfan(x,V,E)
`)
THEN RESA_TAC
THEN MRESA_TAC CONVEX_AFF_GT[`{x:real^3}`;`{ w,v:real^3}`]
THEN MRESA_TAC CONVEX_CONNECTED[`aff_gt {x} {w,v}:real^3->bool`]
THEN MRESA_TAC SEGMENT_CONNECTED[`y:real^3`;`y':real^3`]
THEN MRESA_TAC ENDS_IN_SEGMENT[`y:real^3`;`y':real^3`]
THEN MRESA1_TAC CONNECTED_IFF_CONNECTED_COMPONENT`segment[y,y':real^3]`
THEN POP_ASSUM (fun th-> MRESA_TAC th [`y:real^3`;`y':real^3`])
THEN MRESA_TAC CONNECTED_COMPONENT_OF_SUBSET[`segment [y,y':real^3]`;`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`;`y':real^3`]
THEN MRESAL_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`;`y':real^3`][IN]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC CONNECTED_COMPONENT_MAXIMAL[`yfan(x:real^3,V:real^3->bool,E)`;`aff_gt {x} {w,v}:real^3->bool`;`y':real^3`]);;
let STEP2_REDUCE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds f1 f2 f3 v u w.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
==> aff_gt {x} {v,w} SUBSET dartset_leads_into_fan x V E ds`,
REPEAT STRIP_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 MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan(x,V,E)==> f1 IN d1_fan(x,V,E)/\ f2 IN d1_fan(x,V,E) /\ f3 IN d1_fan(x,V,E) /\ f1 IN ds /\ f2 IN ds/\ f3 IN ds`)
THEN RESA_TAC
THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f3:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`]
THEN REMOVE_ASSUM_TAC
THEN MRESA_TAC AFF_GT_SUBSET_DART_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`]
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:real^3) V E (pr2 f2) (pr3 f2)`;`f2:real^3#real^3#real^3#real^3`]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]);;
let STEP3_REDUCE_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ E UNION {{v,w}}= E1
==> FAN (x,V,E1)`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u: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)`;
` (w:real^3)`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN 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 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 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 DWWUTKW[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;
`ds:real^3#real^3#real^3#real^3->bool`;]);;
let SET_OF_EDGE_UNION_GRAPH=prove(`!v V E1 E2. set_of_edge v V (E1 UNION E2)= (set_of_edge v V E1) UNION (set_of_edge v V E2)`,
ONCE_REWRITE_TAC[EXTENSION]
THEN REWRITE_TAC[set_of_edge;UNION;IN_ELIM_THM;SET_RULE`(A\/B)/\C<=>(A/\C)\/ (B/\C)`;]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THEN SET_TAC[]);;
let add_edge_imp_card_set_edge_ge1_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1.
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ E1=E UNION {{v,w}}
==>
(!v. v IN V==>CARD (set_of_edge v V E1) > 1)`,
REWRITE_TAC[FAN;fan1]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC remark_finite_fan1[`v':real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[SET_OF_EDGE_UNION_GRAPH;]
THEN STRIP_TAC
THEN MRESAL_TAC CARD_SUBSET[`(set_of_edge v' (V:real^3->bool) E):real^3->bool`;`(set_of_edge v' (V:real^3->bool) E UNION set_of_edge v' V {{v, w}}):real^3->bool`][SET_RULE`A SUBSET A UNION B`]
THEN POP_ASSUM MP_TAC
THEN FIRST_ASSUM (MP_TAC o SPEC `v':real^3`)
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN ARITH_TAC);;
let pr23=new_definition`pr23=(\(x,y,z,t). (y,z))`
;;
let PR23_OF_D1_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool.
IMAGE pr23 (d1_fan(x,V,E))={ (v,w) | {v,w} IN E}`,
REWRITE_TAC[IMAGE;d1_fan;IN_ELIM_THM;EXTENSION;]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THENL[
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[pr23;]
THEN RESA_TAC
THEN EXISTS_TAC `v:real^3`
THEN EXISTS_TAC `w:real^3`
THEN ASM_REWRITE_TAC[];
REPEAT STRIP_TAC
THEN EXISTS_TAC`x,v,w,sigma_fan x V E v w:real^3`
THEN ASM_REWRITE_TAC[pr23]
THEN EXISTS_TAC `x:real^3`
THEN EXISTS_TAC `v:real^3`
THEN EXISTS_TAC `w:real^3`
THEN EXISTS_TAC `sigma_fan x V E v w:real^3`
THEN ASM_REWRITE_TAC[]]);;
let PR23_OF_D20_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool.
IMAGE pr23 (d20_fan(x,V,E))={ (v,v) | v IN V/\ set_of_edge v V E={}}`,
REWRITE_TAC[IMAGE;d20_fan;IN_ELIM_THM;EXTENSION;]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THENL[
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[pr23;]
THEN RESA_TAC
THEN EXISTS_TAC `v:real^3`
THEN ASM_REWRITE_TAC[IN];
REPEAT STRIP_TAC
THEN EXISTS_TAC`(x:real^3),v,v,(v:real^3)`
THEN ASM_REWRITE_TAC[pr23]
THEN EXISTS_TAC `x:real^3`
THEN EXISTS_TAC `v:real^3`
THEN ASM_REWRITE_TAC[IN]
THEN ASM_TAC
THEN SIMP_TAC[IN]]);;
let add_edge_graph=prove(`!v w E. {v',w' | {v', w'} IN E UNION {{v, w}}}= {v',w' | {v', w'} IN E} UNION {(v',w')| {v',w'}={v,w}}`,
ONCE_REWRITE_TAC[EXTENSION]
THEN REWRITE_TAC[UNION;IN_ELIM_THM;IN_SING;SET_RULE`(A\/B)/\C<=>(A/\C)\/ (B/\C)`;]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THEN SET_TAC[]);;
let expand_set_edge_fan=prove(`!v w.{(v',w')| {v',w'}={v,w}}={(v,w), (w,v)}`,
REWRITE_TAC[SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`]
THEN SET_TAC[]);;
let DART_FANADD_EQ_DART_FAN_ADD_2DART=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ~(v=w)
/\ E UNION {{v,w}}=E1
==>
IMAGE pr23 (dart (hypermap1_of_fanx (x,V,E1)))
= (IMAGE pr23 (dart (hypermap1_of_fanx (x,V,E)))) UNION {(v,w),(w,v)}`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[d_fan;IMAGE_UNION;PR23_OF_D20_FAN;PR23_OF_D1_FAN]
THEN REMOVE_THEN"YEU"(fun th-> REWRITE_TAC[SYM th;add_edge_graph;expand_set_edge_fan;SET_OF_EDGE_UNION_GRAPH]));;
let pr23_inj_in_dfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) >1)
==> (!y y1.
y IN d_fan(x,V,E)
/\ y1 IN d_fan(x,V,E)
/\ pr23 y= pr23 y1
==> y=y1)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN REWRITE_TAC[PAIR_EQ;IN_ELIM_THM;d1_fan]
THEN STRIP_TAC
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[pr23;PAIR_EQ]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]);;
let condition_set_of_edge_eq_empty=prove(`!v:A V E1 E2.
~(v IN UNIONS E2)
==> set_of_edge v V E2= {}`,
REWRITE_TAC[set_of_edge;SET_RULE`A={}<=> !s. ~(s IN A)`;IN_ELIM_THM;DE_MORGAN_THM;]
THEN REPEAT STRIP_TAC
THEN MATCH_MP_TAC(SET_RULE`A==> A\/B`)
THEN POP_ASSUM MP_TAC
THEN MATCH_MP_TAC MONO_NOT
THEN STRIP_TAC
THEN REWRITE_TAC[UNIONS;IN_ELIM_THM]
THEN EXISTS_TAC`{v:A,s}`
THEN ASM_REWRITE_TAC[]
THEN SET_TAC[]);;
let SET_OF_EDGE_INVARIANT=prove(`!v V E1 E2.
~(v IN UNIONS E2)
==> set_of_edge v V (E1 UNION E2)= (set_of_edge v V E1)`,
SIMP_TAC[SET_OF_EDGE_UNION_GRAPH;condition_set_of_edge_eq_empty;SET_RULE`A UNION {}=A`]);;
let expand_unions=prove(`!v w:A. UNIONS {{v,w}}= {v,w}`,
SIMP_TAC[UNIONS;IN_SING;]
THEN ONCE_REWRITE_TAC[EXTENSION;]
THEN SIMP_TAC[IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THENL[SET_TAC[];
STRIP_TAC
THEN EXISTS_TAC`{v,w:A}`
THEN ASM_REWRITE_TAC[]]);;
let SIGMA_FAN_OF_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v w.
FAN(x,V,E)/\ FAN(x,V,E1)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ ~({v,w} IN E)
/\ E UNION {{v,w}}=E1
==> (!v1 w1. {v1,w1} IN E /\ ~(v1 IN {v,w})==> sigma_fan x V E1 v1 w1 = sigma_fan x V E v1 w1)
`,
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 add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v1:real^3`)
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v1 V E1 = {w1:real^3})\/ ~(set_of_edge v1 V E1 = {w1})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
POP_ASSUM MP_TAC
THEN MRESAL_TAC SET_OF_EDGE_INVARIANT[`v1:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` ({{v,w}}:(real^3->bool)->bool)`;][expand_unions]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v1:real^3`;`w1:real^3`;`sigma_fan x V E v1 w1:real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v1:real^3`;`w1:real^3`]
]);;
let add_edge_graph=prove(`!v w E E1.
E UNION {{v,w}}=E1
==> {w,v} IN E1/\ {v,w}IN E1`,
REPEAT STRIP_TAC
THENL
[ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SET_TAC[];
POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SET_TAC[]]);;
let not_in_set_of_edge=prove(`
!v w V E. ~({w,v} IN E)
==> ~(w IN set_of_edge v V E)`,
REPEAT GEN_TAC THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MATCH_MP_TAC MONO_NOT
THEN SIMP_TAC[set_of_edge;IN_ELIM_THM;SET_RULE`{A,B}={B,A}`]);;
let set_of_only_edge=prove(`!v w V. w IN V ==> set_of_edge v V {{v, w}}={w}`,
REWRITE_TAC[set_of_edge;IN_SING;SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`;EXTENSION;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]);;
let set_of_only_edge1=prove(`!v w V. v IN V ==> set_of_edge w V {{v, w}}={v}`,
REWRITE_TAC[set_of_edge;IN_SING;SET_RULE`{v',w'}={v,w}<=> (v=v' /\ w= w') \/ v= w' /\ w=v'`;EXTENSION;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]);;
let SIGMA_FAN_OF_FANADD_AT_POINT1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w.
FAN(x,V,E)/\ FAN(x,V,E1)
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} 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)
/\ E UNION {{v,w}}=E1
==> sigma_fan x V E1 v w = 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"YEU")
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 add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {w:real^3})\/ ~(set_of_edge v V E1 = {w})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
STRIP_TAC
THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(v:real^3)`]
THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`sigma_fan x V E v u:real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH])
THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th)
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
STRIP_TAC
THEN MRESA_TAC SIGMA_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"QUY")
THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`]
THEN MRESA_TAC not_in_set_of_edge[`v:real^3`;`w:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;]
THEN STRIP_TAC
THENL[
MATCH_MP_TAC (SET_RULE`!x y A. x IN A /\ ~(y IN A)==> ~(x=y)`)
THEN EXISTS_TAC`set_of_edge (v:real^3) V E`
THEN ASM_REWRITE_TAC[];
MRESA_TAC remark1_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 GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`]
THEN REPEAT STRIP_TAC
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 ABBREV_TAC`u1=sigma_fan x V E v u`
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u1:real^3)`;
`(v:real^3)`]
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`u1:real^3`]
THEN MATCH_MP_TAC(REAL_ARITH`!A B C D. A=B+C /\ A<= B+D ==> C<= D`)
THEN EXISTS_TAC`azim x v u (u1:real^3)`
THEN EXISTS_TAC`azim x v u (w:real^3)`
THEN ASM_REWRITE_TAC[]
THEN FIRST_X_ASSUM (fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"NHO"))
THEN DISJ_CASES_TAC(SET_RULE`(w1=u:real^3)\/ ~(w1=u)`)
THENL[
ASM_REWRITE_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 MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][DE_MORGAN_THM;]
THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][REAL_ARITH`A+B-A=B`;]
THEN MATCH_MP_TAC (REAL_ARITH`A A<=B`)
THEN SIMP_TAC[azim];
REMOVE_THEN"QUY" (fun th-> MRESA1_TAC th`w1:real^3`)
THEN MP_TAC(REAL_ARITH`azim x v u w + azim x v w u1 = azim x v u u1 /\ azim x v u u1 <= azim x v u w1
/\ &0<= azim x v w u1==> azim x v u w <= azim x v u w1`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN SIMP_TAC[azim]
THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`;
`(v:real^3)`]
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])]]]]);;
let SIGMA_FAN_OF_FANADD_AT_POINT2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w.
FAN(x,V,E)/\ FAN(x,V,E1)
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} 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)
/\ E UNION {{v,w}}=E1
==> sigma_fan x V E1 v u = w`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(v:real^3)`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {u:real^3})\/ ~(set_of_edge v V E1 = {u})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
STRIP_TAC
THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH])
THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;
`(w:real^3)`]
THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`]
THEN REPEAT STRIP_TAC
THENL[
REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th)
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {u:real^3})\/ ~(set_of_edge v V E = {u})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
STRIP_TAC
THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w1: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 POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC];
ASM_REWRITE_TAC[]
THEN REAL_ARITH_TAC]]);;
let XFAN_INTER_SET=prove(`!x:real^N V E s:real^N->bool.
xfan(x,V,E) INTER s = UNIONS {y | ?e. e IN E /\ y = (aff_ge {x} e) INTER s}`,
REPEAT GEN_TAC
THEN REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2]
THEN ONCE_REWRITE_TAC[ EXTENSION]
THEN REWRITE_TAC[UNIONS; INTER;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THENL[
STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC `{x' | x' IN aff_ge {x:real^N} e /\ x' IN s}`
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN RESA_TAC THEN RESA_TAC
THEN EXISTS_TAC`e:real^N->bool`
THEN ASM_REWRITE_TAC[];
STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN RESA_TAC
THEN EXISTS_TAC `aff_ge {x:real^N} e `
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC `e:real^N->bool`
THEN ASM_REWRITE_TAC[]]);;
let condition_azim_imp_edge_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1.
FAN(x,V,E)
/\ {v,u} IN E /\ {u,w} IN E /\ {w,w1} IN E
/\ sigma_fan x V E u w = v
/\ sigma_fan x V E w w1 = u
/\ fan80(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ azim x w v u = azim x w w1 u
==> {v,w} IN E`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_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 [`w:real^3`;`w1:real^3`] THEN 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)`;`u:real^3`;`w:real^3`;`w1: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 MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`]
THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`v: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,C,D,B}`]
THEN ASM_REWRITE_TAC[DE_MORGAN_THM;]
THEN RESA_TAC
THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`w1: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 RESA_TAC
THEN MRESA_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`u: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`;`w:real^3`;`u:real^3`;`w1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN REWRITE_TAC[REAL_ARITH`A-B=A-C<=> B=C`]
THEN STRIP_TAC
THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;`w1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN MATCH_MP_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`u:real^3`
THEN ASM_SIMP_TAC[SET_RULE`A INTER B= B INTER A`]
THEN MRESAL_TAC XFAN_INTER_SET[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`aff_gt {x:real^3} {v, w}`][IN;xfan]
THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM;SET_RULE`~(A={})<=> ?y. y IN A`]
THEN SUBGOAL_THEN`?y. y IN aff_gt {x:real^3} {v,w} INTER aff_ge {x} {w,w1}`ASSUME_TAC
THENL[
MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3,w:real^3}`;`{w1:real^3}`]
THEN MP_TAC(SET_RULE`v IN aff_gt {x, w} {w1} /\ aff_gt {x, w} {w1} SUBSET aff_ge {x, w} {w1}
==> v IN aff_ge {x, w} {w1:real^3}`)
THEN RESA_TAC
THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`w:real^3`;`w1: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
THENL[
POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{B,C}={C,B}`]
THEN STRIP_TAC
THEN MRESAL_TAC point_in_aff_ge[`x:real^3`;`w:real^3`;`w1:real^3`][INTER;IN_ELIM_THM]
THEN EXISTS_TAC`w1:real^3`
THEN ASM_REWRITE_TAC[];
MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`;
`(w:real^3)`]
THEN MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`w:real^3`;`w1:real^3`;`v:real^3`]
THEN ASM_SIMP_TAC[SET_RULE`A SUBSET B==> A INTER B= A`]
THEN MATCH_MP_TAC exists_in_aff_gt
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;
`(w:real^3)`]];
POP_ASSUM MP_TAC
THEN STRIP_TAC
THEN EXISTS_TAC `y:real^3`
THEN EXISTS_TAC `aff_gt {x} {v, w} INTER aff_ge {x} {w, w1:real^3}`
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`{w,w1:real^3}`
THEN ASM_SIMP_TAC[SET_RULE`A INTER B= B INTER A`;]
THEN ASM_TAC
THEN SIMP_TAC[IN]]);;
let condition_azim_le_pi=prove(
`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w.
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 w v u/\ azim x w v u < pi`,
REPEAT GEN_TAC
THEN 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 [`w:real^3`;`w1:real^3`] THEN 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 MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w: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}`]
THEN RESA_TAC
THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`u:real^3`;`v: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,C,D,B}`]
THEN ASM_REWRITE_TAC[DE_MORGAN_THM;]
THEN RESA_TAC
THEN MRESA_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`w:real^3`;`v:real^3`;`u: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,C,B}`]
THEN ASM_REWRITE_TAC[DE_MORGAN_THM;]
THEN RESA_TAC
THEN MP_TAC(ARITH_RULE`~(azim x w v u = &0) /\ &0<= azim x w v u==> &0< azim x w v u `)
THEN ASM_SIMP_TAC[azim]
THEN RESA_TAC
THEN DISJ_CASES_TAC(REAL_ARITH`pi<= azim x w v u \/ azim x w v u < pi`)
THENL[
MRESA_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`u: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(ARITH_RULE`~(azim x w v u = pi)/\ pi<= azim x w v u /\ azim x w v u < &2 * pi /\ azim x w v u = &2 * pi - azim x w u v
==> &0 < azim x w u v /\ azim x w u v< pi`)
THEN ASM_SIMP_TAC[azim]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `w:real^3`;`v:real^3`;`u: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[CROSS_SKEW]
THEN REWRITE_TAC[DOT_LNEG]
THEN ASM_TAC
THEN REAL_ARITH_TAC;
ASM_REWRITE_TAC[]]);;
let azim_trangle_le_azim_face_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1.
FAN(x,V,E)
/\ {v,u} IN E /\ {u,w} IN E /\ {w,w1} IN E /\ ~({v,w} IN E)
/\ sigma_fan x V E u w = v
/\ sigma_fan x V E w w1 = u
/\ fan80(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
==> azim x w v u < azim x w w1 u`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[REAL_ARITH`A ~(B<=A) `]
THEN 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 [`w:real^3`;`w1:real^3`] THEN MRESA_TAC th [`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC "YEU EM"))
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`w1: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 (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`] THEN DISCH_TAC THEN
MP_TAC th THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`] THEN DISCH_TAC THEN ASSUME_TAC th)
THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`;
`(w:real^3)`]
THEN MRESA_TAC condition_azim_imp_edge_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w1:real^3`]
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`v:real^3`;`w1:real^3`;`u: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 w v u = azim x w v w1 + azim x w w1 u
/\ azim x w w1 u <= azim x w v u /\ &0< azim x w w1 u /\ ~(azim x w v u = azim x w w1 u) ==> &0 < azim x w v w1 /\ azim x w v w1 < azim x w v u`)
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th))
THEN RESA_TAC
THEN MRESA_TAC condition_azim_le_pi[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN SUBGOAL_THEN`w1 IN wedge x w v (u:real^3)` ASSUME_TAC
THENL[
REWRITE_TAC[wedge;IN_ELIM_THM]
THEN ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`]
THEN RESA_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
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 RESA_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC th THEN ONCE_REWRITE_TAC[CROSS_TRIPLE] THEN DISCH_TAC THEN ASSUME_TAC th) THEN ASSUME_TAC th)
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`]
THEN MRESA_TAC invariant_crossr_dot_esilon_3piont[`x:real^3`;`u:real^3`;`w:real^3`;`v:real^3`;`w1:real^3`]
THEN POP_ASSUM MP_TAC
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ABBREV_TAC`h=t/ &2:real`
THEN MP_TAC(REAL_ARITH`&0< t/\ t< &1/\ h= t/ &2 ==> &0 <= h/\ &0< h/\ &0<= &1 -h /\ h< t`)
THEN RESA_TAC
THEN DISCH_THEN(fun th-> MRESA1_TAC th `h:real`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN REWRITE_TAC[INTER;IN_ELIM_THM]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN SUBGOAL_THEN`&0 < ((w - x) cross (v - x)) dot ((&1 - h) % w + h % w1 - x:real^3)/\ &0 < ((u - x) cross (w - x)) dot ((&1 - h) % w + h % w1 - x:real^3)` ASSUME_TAC
THENL[
REWRITE_TAC[VECTOR_ARITH`(&1 - h) % w + h % w1-x=(&1 - h) % (w-x) + h % (w1-x)`]
THEN REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_CROSS_SELF]
THEN REDUCE_ARITH_TAC
THEN STRIP_TAC
THEN MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[];
SUBGOAL_THEN`(&1 - h) % w + h % w1 IN aff_gt {x} {v,u,w:real^3}`ASSUME_TAC
THENL[
MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th;IN_ELIM_THM;INTER;VECTOR_ARITH`(A+B)-C=A+B-C:real^3`]);
SUBGOAL_THEN`(&1 - h:real) % w + h % (w1:real^3) IN aff_ge {x} {w,w1:real^3}`ASSUME_TAC
THENL[
MRESAL_TAC AFF_GE_1_2[`x:real^3`;`w:real^3`;` w1:real^3`][IN_ELIM_THM]
THEN EXISTS_TAC`&0`
THEN EXISTS_TAC`&1-h:real`
THEN EXISTS_TAC`h:real`
THEN ASM_REWRITE_TAC[REAL_ARITH`&0 + &1 - h + h = &1`]
THEN REDUCE_VECTOR_TAC;
MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v:real^3`;`u:real^3`;`w: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)`;`u:real^3`; `w:real^3`]
THEN MRESA_TAC topological_component_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dart_leads_into x V E u w):real^3->bool`]
THEN MP_TAC(SET_RULE`dart_leads_into x V E u w SUBSET yfan (x,V,E)
/\ aff_gt {x} {v, u, w} SUBSET dart_leads_into x V E u w
==> aff_gt {x} {v, u, w} SUBSET yfan (x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan]
THEN SET_TAC[]]]]]);;
let SIGMA_FAN_OF_FANADD_AT_POINT3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 v u w.
FAN(x,V,E)/\ FAN(x,V,E1)
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} 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)
/\ E UNION {{v,w}}=E1
==> sigma_fan x V E1 w v = u`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`{u,w:real^3} IN E /\ E UNION {{v,w}}=E1==> {u,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (u:real^3)`;
`(w:real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;
`(w:real^3)`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`)
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {v:real^3})\/ ~(set_of_edge w V E1 = {v})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
STRIP_TAC
THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH])
THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge1;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`]
THEN REPEAT STRIP_TAC
THEN ABBREV_TAC`w2=inverse1_sigma_fan x V E w u:real^3`
THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC(th))
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w2:real^3})\/ ~(set_of_edge w V E = {w2})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
STRIP_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w2:real^3)`;
`(w:real^3)`]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w2:real^3`]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th`w1:real^3`)
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(w1 = w2:real^3)\/ (w1 = w2)`)
THENL[
RESA_TAC
THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` w2:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u==> azim x w v u <= azim x w w2 u`)
THEN RESA_TAC
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`u: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 "ME1")
THEN MP_TAC(REAL_ARITH`azim x w w2 (u:real^3) = azim x w w2 v + azim x w v u
/\ azim x w w2 u <= azim x w w2 w1
/\ &0 <= azim x w v u
==> azim x w w2 v <= azim x w w2 w1 `)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN SIMP_TAC[azim]
THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`;
`(w:real^3)`]
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`w1:real^3`]
THEN MATCH_MP_TAC(REAL_ARITH`!B A C. A+C<=A+B==>C<=B`)
THEN EXISTS_TAC`azim x w w2 (v:real^3)`
THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th;])
THEN REMOVE_THEN "ME1"(fun th -> ASM_REWRITE_TAC[SYM th;]);
STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` w2:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u==> azim x w v u <= azim x w w2 u`)
THEN RESA_TAC
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`;`u: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 MATCH_MP_TAC(REAL_ARITH`!B A C. A+C<=A+B==>C<=B`)
THEN EXISTS_TAC`azim x w w2 (v:real^3)`
THEN POP_ASSUM (fun th -> REWRITE_TAC[SYM th;]
THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w w2 u /\
azim x w w2 u = azim x w w2 v + azim x w v u
==> ~(azim x w w2 v = &0)`)
THEN ASM_REWRITE_TAC[SYM th]
THEN STRIP_TAC)
THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;`w2:real^3`;`v:real^3`][REAL_ARITH`A+ B-A=B`]
THEN MATCH_MP_TAC(REAL_ARITH`!a b. a< b==> a<= b`)
THEN SIMP_TAC[azim]]]]);;
let elements_in_ds2_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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ f10=(x,w,v,u)
/\ E UNION {{v,w}}= E1
==> f10 IN ds2`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN REWRITE_TAC[face;orbit_map; IN_ELIM_THM]
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[POWER;ARITH_RULE`0>=0`;I_DEF;EQ_PAIR_4]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]);;
let SIGMA_FAN_OF_FANADD_AT_POINT4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1.
FAN(x,V,E)/\ FAN(x,V,E1)
/\ fan80(x,V,E)
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ ~(u=w1)
/\ {v,w1} IN E
/\ sigma_fan x V E u w = v
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ E UNION {{v,w}}=E1
==> sigma_fan x V E1 v w1 = sigma_fan x V E v w1`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
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 add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E1 = {w1:real^3})\/ ~(set_of_edge v V E1 = {w1})`)
THENL(*1*)[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;(*1*)
STRIP_TAC
THEN MP_TAC(SET_RULE`{v,w1:real^3} IN E /\ E UNION {{v,w}}=E1==> {v,w1} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1: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 MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w1:real^3`;`sigma_fan x V E v w1:real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN REMOVE_THEN "YEU"(fun th -> MRESA1_TAC th`v:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th)
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge v V E = {w1:real^3})\/ ~(set_of_edge v V E = {w1})`)
THENL(*2*)[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;(*2*)
STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;
`(w:real^3)`]
THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH])
THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`]
THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`]
THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w1:real^3`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"MA")
THEN REPEAT STRIP_TAC
THENL(*3*)[
REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`w1':real^3`);(*3*)
ASM_REWRITE_TAC[]
THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`u:real^3`)
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`u:real^3`]
THEN DISJ_CASES_TAC(SET_RULE`~(sigma_fan x V E v u = w1)\/ (sigma_fan x V E v u = w1)`)
THENL(*4*)[
ASM_REWRITE_TAC[]
THEN MRESA_TAC
MONO_AZIM_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w1: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 sum4_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`(sigma_fan x V E v 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 MP_TAC(REAL_ARITH`azim x v w1 (sigma_fan x V E v u) =
azim x v w1 u + azim x v u (sigma_fan x V E v u)
/\ azim x v u w <= azim x v u (sigma_fan x V E v u)
==> azim x v w1 u+ azim x v u w<= azim x v w1 (sigma_fan x V E v u)
`)
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 ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH` azim x v w1 (sigma_fan x V E v u)< &2 * pi
/\ azim x v w1 u+ azim x v u w<= azim x v w1 (sigma_fan x V E v u)
==>
azim x v w1 u+ azim x v u w< &2 * pi
`)
THEN ASM_SIMP_TAC[azim]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w} IN E1`) THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`]
THEN MRESA_TAC sum3_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`w:real^3`]
THEN MATCH_MP_TAC(REAL_ARITH`!A B C.A<=B /\ &0<= C ==>A<= B+C`)
THEN ASM_SIMP_TAC[azim];(*4*)
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 MRESA_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;` u:real^3`;`w1:real^3`]
THEN MP_TAC(REAL_ARITH`
azim x v w1 u + azim x v u (sigma_fan x V E v u) = &2 * pi
/\ azim x v u w <= azim x v u (sigma_fan x V E v u)
==> azim x v w1 u+ azim x v u w<= &2 * pi
`)
THEN POP_ASSUM(fun th -> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th])
THEN ASM_REWRITE_TAC[]
THEN DISJ_CASES_TAC(SET_RULE`azim x v u w1 = &0\/ ~(azim x v u w1 = &0)`)
THENL(*5*)[
MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`v:real^3`;` u:real^3`;`w1:real^3`];(*5*)
ASM_REWRITE_TAC[REAL_ARITH`A-B+B=A`]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w} IN E1`) THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`]
THEN MP_TAC(REAL_ARITH`azim x v w1 u + azim x v u w <= &2 * pi
==> azim x v w1 u + azim x v u w < &2 * pi\/ azim x v w1 u + azim x v u w = &2 * pi`)
THEN RESA_TAC THENL(*6*)[
MRESA_TAC sum3_azim_fan[`x:real^3`;`v:real^3`;`w1:real^3`;`u:real^3`;`w:real^3`]
THEN MATCH_MP_TAC(REAL_ARITH`!A B C.A<=B /\ &0<= C ==>A<= B+C`)
THEN ASM_SIMP_TAC[azim];(*6*)
POP_ASSUM MP_TAC
THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`v:real^3`;` u:real^3`;`w1:real^3`][REAL_ARITH`A-C+D=A<=> C=D`]
THEN STRIP_TAC
THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`v:real^3`;`u:real^3`;`w1:real^3`;`w:real^3`]
THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`]
THEN MRESA_TAC AZIM_EQ_0_GE[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`]
THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`w1:real^3`;`w:real^3`] decomposition_planar_by_angle_fan)
THEN RESA_TAC
THENL(*7*)[
MRESA_TAC aff_gt3_subset_aff_gt[`x:real^3`;`v:real^3`;`w:real^3`;`w1:real^3`]
THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w1:real^3`]
THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w1:real^3`;]
THEN SUBGOAL_THEN`aff_gt {x} {v, w1:real^3} SUBSET xfan(x,V:real^3->bool,E)` ASSUME_TAC
THENL(*8*)[
REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM]
THEN GEN_TAC
THEN STRIP_TAC
THEN EXISTS_TAC`{v,w1}:real^3->bool`
THEN MP_TAC(SET_RULE`x' IN aff_gt {x}{v,w1}/\ aff_gt {x} { v,w1} SUBSET aff_ge {x} {v, w1}
==> x' IN aff_ge {x:real^3} {v, w1}`)
THEN RESA_TAC
THEN ASM_TAC
THEN SIMP_TAC[IN];(*8*)
MP_TAC(SET_RULE`aff_gt {x} {v, w1} SUBSET aff_gt {x} {v, w}/\y IN aff_gt {x} {v, w1}
/\ aff_gt {x} {v, w1} SUBSET xfan (x,V,E)
==> ~(aff_gt {x:real^3} {v, w} INTER xfan (x,V:real^3->bool,E) ={})`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[xfan;IN ]
THEN STRIP_TAC
THEN MRESAL_TAC AFF_GT_CUT_XFAN_IMP_EDGE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`; `v:real^3`; `u:real^3`; `w:real^3`][IN]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_TAC
THEN SIMP_TAC[IN] ];(*7*)
MRESA_TAC aff_gt12_subset_aff_ge[`x:real^3`;`v:real^3`;`w1:real^3`;`w:real^3`]
THEN SUBGOAL_THEN`aff_gt {x} {w, v:real^3} SUBSET xfan(x,V:real^3->bool,E)` ASSUME_TAC
THENL(*8*)[
REWRITE_TAC[xfan;SUBSET;IN_ELIM_THM]
THEN GEN_TAC
THEN STRIP_TAC
THEN EXISTS_TAC`{v,w1}:real^3->bool`
THEN MP_TAC(SET_RULE`x' IN aff_gt {x}{w,v}/\ aff_gt {x} {w, v} SUBSET aff_ge {x} {v, w1}
==> x' IN aff_ge {x:real^3} {v, w1}`)
THEN RESA_TAC
THEN ASM_TAC
THEN SIMP_TAC[IN];
MRESA_TAC condition_aff_gt_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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REWRITE_TAC[yfan]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`w:real^3`;`v:real^3`]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]]]]]]]]]);;
let SIGMA_FAN_OF_FANADD_AT_POINT5=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1.
FAN(x,V,E)/\ FAN(x,V,E1)
/\ fan80(x,V,E)
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ ~(w1=inverse1_sigma_fan x V E w u )
/\ {w,w1} IN E
/\ sigma_fan x V E u w = v
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ E UNION {{v,w}}=E1
==> sigma_fan x V E1 w w1 = sigma_fan x V E w w1`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC remark1_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 POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`{w:real^3, w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, w1} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1:real^3)`;
`(w:real^3)`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`;
`(w:real^3)`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`)
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {w1:real^3})\/ ~(set_of_edge w V E1 = {w1})`)
THENL(*1*)[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;(*1*)
STRIP_TAC
THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC(th))
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1:real^3})\/ ~(set_of_edge w V E = {w1})`)
THENL(*2*)[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;(*2*)
STRIP_TAC
THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC "MA")
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((sigma_fan x V E w w1):real^3)`;`(w:real^3)`]
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN MP_TAC(SET_RULE`{w:real^3, sigma_fan x V E w w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, sigma_fan x V E w w1} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` ((sigma_fan x V E w w1):real^3)`;`(w:real^3)`]
THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`sigma_fan x V E w w1:real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH])
THEN ASM_SIMP_TAC[SET_RULE`x IN A==> x IN A UNION B`]
THEN ASM_SIMP_TAC[UNION;IN_ELIM_THM;set_of_only_edge;IN_SING;SET_RULE`((A \/ B)/\ (~ B)) <=>A /\ ~ B`]
THEN REPEAT STRIP_TAC
THENL(*3*)[
REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`w1':real^3`);(*3*)
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;`(v:real^3)`]
THEN ASM_SIMP_TAC[set_of_only_edge;IN_SING]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` ((inverse1_sigma_fan x V E w u):real^3)`;`(w:real^3)`]
THEN REMOVE_THEN "MA"(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w (u:real^3)`)
THEN MRESA_TAC MONO_AZIM_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`]
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(u=w1:real^3)\/ u=w1`)
THENL(*4*)[
ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u: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_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u
==>
azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`]
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u: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 MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u =
azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u
/\ &0<= azim x w v u
==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u
`)
THEN ASM_SIMP_TAC[azim]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) v <=
azim x w (inverse1_sigma_fan x V E w u) u
/\ azim x w w1 u =
azim x w w1 (inverse1_sigma_fan x V E w u) +
azim x w (inverse1_sigma_fan x V E w u) u
/\ azim x w w1 u< &2 *pi
==> azim x w w1 (inverse1_sigma_fan x V E w u) +
azim x w (inverse1_sigma_fan x V E w u) v < &2 *pi
`)
THEN SIMP_TAC[azim]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC sum3_azim_fan[`x:real^3`;`w:real^3`;`w1:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`]
THEN MATCH_MP_TAC (REAL_ARITH`!A B C. A<= B/\ &0<= C==> A<= B +C`)
THEN ASM_SIMP_TAC[azim];(*4*)
POP_ASSUM(fun th -> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u
==>
azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`]
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u: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 MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u =
azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u
/\ &0<= azim x w v u
==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u
`)
THEN ASM_SIMP_TAC[azim]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) v <=
azim x w (inverse1_sigma_fan x V E w u) u
==> azim x w u (inverse1_sigma_fan x V E w u) +
azim x w (inverse1_sigma_fan x V E w u) v <=
azim x w u (inverse1_sigma_fan x V E w u) +
azim x w (inverse1_sigma_fan x V E w u) u
`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`azim x w (inverse1_sigma_fan x V E w u) u = &0\/ ~(azim x w (inverse1_sigma_fan x V E w u) (u:real^3) = &0)`)
THENL(*5*)[
MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`x:real^3`;` (V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`];
MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`][REAL_ARITH`A-B+B=A`]
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SYM th;REAL_ARITH`A<=B<=> A A<= B +C`)
THEN ASM_SIMP_TAC[azim];
POP_ASSUM MP_TAC
THEN MRESAL_TAC AZIM_COMPL[`x:real^3`;`w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`;`u:real^3`][REAL_ARITH`A-B+C=A<=> B=C`]
THEN STRIP_TAC
THEN MRESA_TAC AZIM_EQ_ALT[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u:real^3`;`v:real^3`]
THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`]
THEN MRESA_TAC AZIM_EQ_0_PI_IMP_COPLANAR[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
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 EM1"))
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,D,B,C}`]
THEN ASM_REWRITE_TAC[]]]]]]]);;
let SIGMA_FAN_OF_FANADD_AT_POINT6=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) v u w w1.
FAN(x,V,E)/\ FAN(x,V,E1)
/\ fan80(x,V,E)
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E) /\ w1=inverse1_sigma_fan x V E w u
/\ {w,w1} IN E
/\ sigma_fan x V E u w = v
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ E UNION {{v,w}}=E1
==> sigma_fan x V E1 w w1 = v`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC add_edge_graph[`v:real^3`;`w:real^3`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC remark1_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 POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`{w:real^3, w1} IN E /\ E UNION {{v,w}}=E1 ==>{w, w1} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w1:real^3)`;
`(w:real^3)`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w1:real^3)`;
`(w:real^3)`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`)
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E1 = {w1:real^3})\/ ~(set_of_edge w V E1 = {w1})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
STRIP_TAC
THEN REMOVE_THEN "YEU"(fun th-> MRESA1_TAC th`w:real^3` THEN POP_ASSUM MP_TAC THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"YEU"))
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1:real^3})\/ ~(set_of_edge w V E = {w1})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
DISCH_THEN(LABEL_TAC"LINHYEU")
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` v:real^3`;`(w:real^3)`]
THEN MRESA_TAC UNIQUE_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`;`v:real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`]
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN STRIP_TAC
THENL[
STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN REMOVE_THEN "EM"(fun th -> REWRITE_TAC[SYM th;SET_OF_EDGE_UNION_GRAPH])
THEN REWRITE_TAC[UNION;IN_ELIM_THM;IN_SING]
THEN REPEAT STRIP_TAC
THENL[(*4*)
REMOVE_THEN "LINHYEU" MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(set_of_edge w V E = {w1':real^3})\/ ~(set_of_edge w V E = {w1'})`)
THENL[
ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC;
STRIP_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`w1:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`w1':real^3`)
THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`]
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(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u
==>
azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`)
THEN RESA_TAC
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u: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 MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u =
azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u
/\ &0<= azim x w v u
==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u
`)
THEN ASM_SIMP_TAC[azim]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC];
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_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 MRESAL_TAC set_of_only_edge1[`v:real^3`;`w:real^3`;`V:real^3->bool`][IN_SING]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN REAL_ARITH_TAC]]]]);;
let f1_fan_of_f10_eq_f20=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ f10=(x,w,v,u)
/\ f20=(x,v,u,w)
/\ E UNION {{v,w}}= E1
==> f20=f1_fan x V E1 f10`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE`{v,u:real^3} IN E /\ E UNION {{v,w}}= E1
==> {v,u} IN E1`) THEN RESA_TAC THEN RESA_TAC);;
let f1_fan_of_f20_eq_f30=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ f20=(x,v,u,w)
/\ f30=(x,u,w,v)
/\ E UNION {{v,w}}= E1
==> f30=f1_fan x V E1 f20`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`)
THEN RESA_TAC
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`)
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE`{u:real^3,w} IN E /\ E UNION {{v,w}}= E1
==> {u,w} IN E1`) THEN RESA_TAC THEN RESA_TAC);;
let f1_fan_of_f30_eq_f10=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ f10=(x,w,v,u)
/\ f30=(x,u,w,v)
/\ E UNION {{v,w}}= E1
==> f10=f1_fan x V E1 f30`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`; `u:real^3`;`w:real^3` ]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MP_TAC(SET_RULE` E UNION {{v,w:real^3}}= E1
==> {v,w} IN E1`)
THEN RESA_TAC THEN RESA_TAC);;
let f10_in_d1_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ f10=(x,w,v,u)
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> f10 IN d1_fan (x,V,E1)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ]
THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ]
THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`; `u:real^3`;`w:real^3` ][d1_fan; IN_ELIM_THM]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3`
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th])
THEN SET_TAC[]);;
let pair_disjoint_f10_f20_f30=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ f10=(x,w,v,u)
/\ f20=(x,v,u,w)
/\ f30=(x,u,w,v)
/\ E UNION {{v,w}}= E1
==> ~(f10= f20)/\ ~(f20= f30)/\ ~(f30=f10)`,
REPEAT GEN_TAC THEN STRIP_TAC
THEN ASM_REWRITE_TAC[EQ_PAIR_4;SET_RULE`~(A/\B)<=> ~ A\/ ~ B`]
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)`]);;
let n_fan_permutes_prime=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) p.
FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E)))
==> (p n_fan) permutes (d_fan (x,V,E))`,
REPEAT STRIP_TAC
THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (n_fan x V E) (d1_fan (x:real^3,V,E))`]
THEN STRIP_TAC
THENL[
REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[];
MRESA_TAC into_domain_n_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN REPEAT STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`)
THENL[
EXISTS_TAC`y:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[res];
MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`)
THEN REWRITE_TAC[res]
THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN ASM_TAC THEN SET_TAC[]]]);;
let f1_fan_permutes_prime=prove(`!x:real^3 V:real^3->bool (E:(real^3->bool)->bool) p.
FAN(x,V,E) /\ p = ( \ t. res (t x V E ) (d1_fan (x,V,E)))
==> (p f1_fan) permutes (d_fan (x,V,E))`,
REPEAT STRIP_TAC
THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN MRESA_TAC PERMUTES_FINITE_SURJECTIVE[`d_fan (x:real^3,V,E)`;`res (f1_fan x V E) (d1_fan (x:real^3,V,E))`]
THEN STRIP_TAC
THENL[
REWRITE_TAC[res;d_fan;UNION;IN_ELIM_THM;DE_MORGAN_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[];
MRESA_TAC into_domain_f1_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN REPEAT STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(y IN d1_fan (x,V,E) )\/ (y IN d1_fan (x:real^3,V,E))`)
THENL[
EXISTS_TAC`y:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[res];
MRESA_TAC permuters_of_enf_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`)
THEN REWRITE_TAC[res]
THEN EXISTS_TAC`b:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC subset_d_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN ASM_TAC THEN SET_TAC[]]]);;
let card_ds2_fanadd_eq3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> CARD ds2=3`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ]
THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM YEU")
THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`; `u:real^3`;`w:real^3` ][face;orbit_map]
THEN MRESA_TAC f10_in_d1_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`3:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` )
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`2:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` )
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` )
THEN MRESAL_TAC card_orbit_le[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`3:num`;`(f10:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(3=0)`;ARITH_RULE`3=SUC 2`;POWER_2;POWER;o_DEF]
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "EM YEU"(fun th -> REWRITE_TAC[SYM th;ARITH_RULE`SUC 2=3`;])
THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`0:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f10:real^3#real^3#real^3#real^3)`]
[POWER;I_DEF]
THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`1:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`]
[POWER_1]
THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`2:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`]
[POWER_2;o_DEF]
THEN MP_TAC(SET_RULE`f10 IN orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10
/\ f1_fan x V E1 f10 IN
orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10
/\ f1_fan x V E1 (f1_fan x V E1 f10) IN
orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10
==>
{f10, f1_fan x V E1 f10,f1_fan x V E1 (f1_fan x V E1 f10)} SUBSET
orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10`)
THEN RESA_TAC
THEN MRESA_TAC pair_disjoint_f10_f20_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ]
THEN SUBGOAL_THEN(`CARD {f10,f20,f30:real^3#real^3#real^3#real^3}=3`)ASSUME_TAC
THENL[
SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ASM_REWRITE_TAC[]
THEN ARITH_TAC;
POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC f1_fan_permutes_prime[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`]
THEN MRESA_TAC lemma_orbit_finite[`d1_fan(x:real^3,V,E1)`;`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(f10:real^3#real^3#real^3#real^3)`]
THEN MRESAL_TAC CARD_SUBSET_LE[`{f10, f1_fan x V E1 f10, f1_fan (x:real^3) V E1 (f1_fan x V E1 f10)}`;`orbit_map (res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))) f10`;][orbit_map]
]);;
let reperentation_of_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> ds2={f10,f20,f30}`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC f1_fan_of_f10_eq_f20[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)` ]
THEN MRESA_TAC f1_fan_of_f20_eq_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC f1_fan_of_f30_eq_f10[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f30:real^3#real^3#real^3#real^3)`; ]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM YEU")
THEN MRESAL_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`; `u:real^3`;`w:real^3` ][face;orbit_map]
THEN MRESA_TAC f10_in_d1_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`3:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` )
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`2:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` )
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`f10:real^3#real^3#real^3#real^3` )
THEN MRESAL_TAC card_orbit_le[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`3:num`;`(f10:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(3=0)`;ARITH_RULE`3=SUC 2`;POWER_2;POWER;o_DEF]
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "EM YEU"(fun th -> REWRITE_TAC[SYM th;ARITH_RULE`SUC 2=3`;])
THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`0:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f10:real^3#real^3#real^3#real^3)`]
[POWER;I_DEF]
THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`1:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`]
[POWER_1]
THEN MRESAL_TAC in_orbit_lemma[`res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))`;`2:num`;`(f10:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`]
[POWER_2;o_DEF]
THEN MP_TAC(SET_RULE`f10 IN orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10
/\ f1_fan x V E1 f10 IN
orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10
/\ f1_fan x V E1 (f1_fan x V E1 f10) IN
orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10
==>
{f10, f1_fan x V E1 f10,f1_fan x V E1 (f1_fan x V E1 f10)} SUBSET
orbit_map (res (f1_fan x V E1) (d1_fan (x,V,E1))) f10`)
THEN RESA_TAC
THEN MRESA_TAC pair_disjoint_f10_f20_f30[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ]
THEN SUBGOAL_THEN(`CARD {f10,f20,f30:real^3#real^3#real^3#real^3}=3`)ASSUME_TAC
THENL[
SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ASM_REWRITE_TAC[]
THEN ARITH_TAC;
POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC f1_fan_permutes_prime[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC finite_d_fan[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`]
THEN MRESA_TAC lemma_orbit_finite[`d1_fan(x:real^3,V,E1)`;`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(f10:real^3#real^3#real^3#real^3)`]
THEN MRESAL_TAC CARD_SUBSET_LE[`{f10, f1_fan x V E1 f10, f1_fan (x:real^3) V E1 (f1_fan x V E1 f10)}`;`orbit_map (res (f1_fan x V E1) (d1_fan (x:real^3,V,E1))) f10`;][orbit_map]]);;
let edge_not_in_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ f10=(x,w,v,u)
/\ f20=(x,v,u,w)
/\ f30=(x,u,w,v)
/\ E UNION {{v,w}}=E1
==> ~((x,v,w,sigma_fan x V E1 v w) IN ds2)`,
REPEAT GEN_TAC THEN STRIP_TAC
THEN MRESAL_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ][SET_RULE`~(a IN {b,c,d})<=> ~(a=b)/\ ~(a=c)/\ ~(a=d) `;EQ_PAIR_4;SET_RULE`~(A/\B)<=> ~ A\/ ~ B`]
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 ASM_TAC
THEN DISJ_CASES_TAC(SET_RULE`v=w \/ ~(v=w:real^3)`)
THEN ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;
` w:real^3`]
THEN FIND_ASSUM (MP_TAC)`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)`
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> MP_TAC (ISPEC `u:real^3` th) )
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY]
THEN ARITH_TAC);;
let disjoint_ds1_and_ds2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> ~(ds1=ds2)`,
REPEAT GEN_TAC THEN STRIP_TAC
THEN MRESA_TAC edge_not_in_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ]
THEN POP_ASSUM MP_TAC
THEN MATCH_MP_TAC MONO_NOT
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]);;
let card_eq_image_in_d_fan=prove(`!x V E ds.
FAN(x,V,E) /\
(!v. v IN V==>CARD (set_of_edge v V E) >1)/\
ds SUBSET d_fan(x,V,E)
==>
CARD(IMAGE pr23 ds)= CARD ds`,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC CARD_IMAGE_INJ
THEN MRESA_TAC finite_d_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN MRESA_TAC FINITE_SUBSET[`ds:real^3#real^3#real^3#real^3->bool`; `d_fan(x:real^3,V,E):real^3#real^3#real^3#real^3->bool`]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE`x' IN ds /\ y IN ds /\ ds SUBSET d_fan(x,V,E)==> x' IN d_fan(x:real^3,V,E)/\ y IN d_fan(x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN REWRITE_TAC[d_fan;UNION;d1_fan;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[pr23;PAIR_EQ]
THEN RESA_TAC);;
let trans=new_definition`trans (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) E1=(\(x,y:real^3,z,sigma_fan x V E y z). (x,y,z,sigma_fan x V E1 y z))`
;;
let tran=new_definition`tran x V E1=(\(x,y:real^3,z,w). (x,y,z,sigma_fan x V E1 y z))`
;;
let tranf=new_definition`tranf x V E E1 ds=(@f. ?y. f = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds)`
;;
let exists_tranf_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
==> ?f. ?y. f = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MP_TAC(SET_RULE` ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
==> ds0 IN face_set (hypermap1_of_fanx (x,V,E)) `)
THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM;]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN DISCH_THEN(LABEL_TAC"EM")
THEN REMOVE_THEN "YEU" MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN "EM" MP_TAC
THEN RESA_TAC
THEN EXISTS_TAC`face (hypermap1_of_fanx (x:real^3,V,E1)) (tran x V E1 (x':real^3#real^3#real^3#real^3))`
THEN EXISTS_TAC`x':real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[tran;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]);;
let TRANF=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
==>
?y. tranf x V E E1 ds0 = face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0`,
REPEAT GEN_TAC THEN STRIP_TAC THEN ONCE_REWRITE_TAC[tranf]
THEN MRESA_TAC exists_tranf_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ]
THEN SELECT_ELIM_TAC
THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool`
THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3` THEN ASM_REWRITE_TAC[]);;
let exists_edge_not_edge_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n:num.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ y IN d_fan(x,V,E)
==>
?y1. y1 IN d_fan(x,V,E)/\ ~(pr2 y1 IN {v,w})/\
face (hypermap1_of_fanx (x,V,E)) y1= face (hypermap1_of_fanx (x,V,E)) y
`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(pr2 y IN {v,w})\/ pr2 y IN {v,w}`)
THENL[
EXISTS_TAC`y:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B\/ A=C`]
THEN STRIP_TAC
THENL[ EXISTS_TAC`f1_fan x V E (y:real^3#real^3#real^3#real^3)`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`)
THEN SUBGOAL_THEN`f1_fan x V E y IN face (hypermap1_of_fanx (x:real^3,V,E)) y` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[face;IN_ELIM_THM;orbit_map;]
THEN EXISTS_TAC`1:num`
THEN REWRITE_TAC[ARITH_RULE`1>=0`;]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` )
THEN REWRITE_TAC[POWER_1];
MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E y):real^3#real^3#real^3#real^3`]
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[d1_fan; IN_ELIM_THM;]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[f1_fan;pr2]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU EM")
THEN 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 REMOVE_THEN"YEU EM" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]];
EXISTS_TAC`f1_fan x V E (y:real^3#real^3#real^3#real^3)`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `y:real^3#real^3#real^3#real^3`)
THEN SUBGOAL_THEN`f1_fan x V E y IN face (hypermap1_of_fanx (x:real^3,V,E)) y` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[face;IN_ELIM_THM;orbit_map;]
THEN EXISTS_TAC`1:num`
THEN REWRITE_TAC[ARITH_RULE`1>=0`;]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` )
THEN REWRITE_TAC[POWER_1];
MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E y):real^3#real^3#real^3#real^3`]
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[d1_fan; IN_ELIM_THM;]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[f1_fan;pr2]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU EM")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN"YEU EM" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w':real^3)`;
`(v':real^3)`]]]]);;
let TRAN_COMMUTATIVE_F1_FAN1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ~(pr3 y IN {v,w})
/\ y IN d_fan(x,V,E)
==>
tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ]
THEN REMOVE_THEN"EMYEU" MP_TAC
THEN ASM_REWRITE_TAC[pr3]
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`w':real^3`;`(inverse1_sigma_fan (x:real^3) V E w' v')`])
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REPEAT RESA_TAC
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(RAND_CONV o ONCE_DEPTH_CONV)[SYM th])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w':real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w' (v':real^3)`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w' v', w'} IN E
/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E w' v', w'} IN E1`)
THEN REPEAT RESA_TAC);;
let TRAN_COMMUTATIVE_F1_FAN2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ~(pr2 y= u)
/\ pr3 y = w
/\ y IN d_fan(x,V,E)
==>
tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU EM")
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ]
THEN REMOVE_THEN"EMYEU" MP_TAC
THEN ASM_REWRITE_TAC[pr3]
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN REMOVE_THEN"YEU EM" MP_TAC
THEN ASM_REWRITE_TAC[pr2]
THEN RESA_TAC
THEN SUBGOAL_THEN(`~(inverse1_sigma_fan (x:real^3) V E w v'=inverse1_sigma_fan x V E w u)`) ASSUME_TAC
THENL[
POP_ASSUM MP_TAC
THEN MATCH_MP_TAC MONO_NOT
THEN STRIP_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3`
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th
THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"LINH"))
THEN RESA_TAC
THEN MRESA1_TAC th`v':real^3`
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC));
MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`)
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN ASM_REWRITE_TAC[]
THEN ASSUME_TAC th)
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w v'):real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E w (v':real^3)`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w v', w} IN E
/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E w v', w} IN E1`)
THEN REPEAT RESA_TAC]);;
let TRAN_COMMUTATIVE_F1_FAN3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ~(pr2 y= sigma_fan x V E v u)
/\ pr3 y = v
/\ y IN d_fan(x,V,E)
==>
tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU EM")
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ]
THEN REMOVE_THEN"EMYEU" MP_TAC
THEN ASM_REWRITE_TAC[pr3]
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN REMOVE_THEN"YEU EM" MP_TAC
THEN ASM_REWRITE_TAC[pr2]
THEN RESA_TAC
THEN SUBGOAL_THEN(`~(u=inverse1_sigma_fan (x:real^3) V E v v')`) ASSUME_TAC
THENL[
POP_ASSUM MP_TAC
THEN MATCH_MP_TAC MONO_NOT
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th
THEN RESA_TAC));
MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[SYM th] THEN ASSUME_TAC th
THEN RESA_TAC ))
THEN STRIP_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E v v'):real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`] THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`inverse1_sigma_fan x V E v (v':real^3)`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E v v', v} IN E
/\ E1= E UNION {{v,w}}==> {inverse1_sigma_fan x V E v v', v} IN E1`)
THEN REPEAT RESA_TAC]);;
let TRAN_COMMUTATIVE_F1_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ~(y IN ds)
/\ y IN d_fan(x,V,E)
==>
tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`
((pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/
((pr2 y= u)/\ pr3 y = w)\/
(~(pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/
(~(pr2 y= u)/\ pr3 y = w)\/
~(pr3 y IN {v,w})`)
THENL[
POP_ASSUM MP_TAC
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN DISCH_THEN(LABEL_TAC"YEU EM")
THEN REMOVE_THEN "LINH" ( fun th->MP_TAC th
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN MP_TAC th THEN RESA_TAC)
THEN RESA_TAC
THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ]
THEN REMOVE_THEN"EMYEU" MP_TAC
THEN ASM_REWRITE_TAC[pr2]
THEN RESA_TAC
THEN REMOVE_THEN"YEU EM" MP_TAC
THEN ASM_REWRITE_TAC[pr3]
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN DISCH_THEN(LABEL_TAC"YEU EM")
THEN STRIP_TAC
THEN STRIP_TAC
THEN REMOVE_THEN"YEU EM" MP_TAC
THEN REMOVE_THEN"EMYEU" MP_TAC
THEN RESA_TAC THEN STRIP_TAC
THEN SUBGOAL_THEN`f1= f1_fan x V E (y:real^3#real^3#real^3#real^3)`ASSUME_TAC
THENL[
ASM_REWRITE_TAC[f1_fan]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`u:real^3` )
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN d1_fan (x,V,E) `)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC)`pr2 f1 =v:real^3`
THEN FIND_ASSUM(MP_TAC)`pr3 f1= u :real^3`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th;pr2;pr3])
THEN RESA_TAC
THEN RESA_TAC;
POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN DISCH_THEN(fun th-> ASSUME_TAC(SYM th))
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f1 IN ds `)
THEN RESA_TAC
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]];
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL[
POP_ASSUM MP_TAC
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN DISCH_THEN(LABEL_TAC"YEU EM")
THEN REMOVE_THEN "LINH" ( fun th->MP_TAC th
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN MP_TAC th THEN RESA_TAC)
THEN RESA_TAC
THEN ASM_REWRITE_TAC[f1_fan;tran;PAIR_EQ]
THEN REMOVE_THEN"EMYEU" MP_TAC
THEN ASM_REWRITE_TAC[pr2]
THEN RESA_TAC
THEN REMOVE_THEN"YEU EM" MP_TAC
THEN ASM_REWRITE_TAC[pr3]
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN DISCH_THEN(LABEL_TAC"YEU EM")
THEN STRIP_TAC
THEN STRIP_TAC
THEN REMOVE_THEN"YEU EM" MP_TAC
THEN REMOVE_THEN"EMYEU" MP_TAC
THEN RESA_TAC THEN STRIP_TAC
THEN SUBGOAL_THEN`f2= (y:real^3#real^3#real^3#real^3)`ASSUME_TAC
THENL[
MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds /\ ds SUBSET d1_fan (x,V,E)==> {f1,f2,f3} SUBSET (ds:real^3#real^3#real^3#real^3->bool)/\ f2 IN d1_fan (x,V,E) `)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC)`pr2 f2 =u:real^3`
THEN FIND_ASSUM(MP_TAC)`pr3 f2= w :real^3`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th;pr2;pr3])
THEN RESA_TAC
THEN RESA_TAC;
POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN DISCH_TAC
THEN MP_TAC(SET_RULE`{f1,f2,f3:real^3#real^3#real^3#real^3} SUBSET ds ==> f2 IN ds `)
THEN RESA_TAC];
MRESA_TAC TRAN_COMMUTATIVE_F1_FAN3
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`];
MRESA_TAC TRAN_COMMUTATIVE_F1_FAN2
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`];
MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`]]]);;
let f1_fan_power_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y n.
FAN(x,V,E)/\
(!v. v IN V ==> CARD (set_of_edge v V E) > 1) /\
ds IN face_set (hypermap1_of_fanx (x,V,E))/\
y IN d1_fan (x,V,E)
/\ ~(y IN ds)
==> ~((f1_fan x V E POWER n) y IN ds)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[]
THEN MATCH_MP_TAC MONO_NOT
THEN SPEC_TAC (`n:num`,`n:num`)
THEN INDUCT_TAC
THENL[
ASM_REWRITE_TAC[POWER;I_DEF];
REWRITE_TAC[COM_POWER;o_DEF]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN 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`y:real^3#real^3#real^3#real^3`)
THEN MP_TAC(SET_RULE`(f1_fan x V E POWER n) y IN d1_fan (x,V,E)/\
d_fan (x,V,E)=d1_fan (x,V,E) UNION d20_fan (x,V,E)
==> (f1_fan x V E POWER n) y IN d_fan (x,V,E)`)
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[d_fan]
THEN RESA_TAC
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E ((f1_fan x V E POWER n) y)):real^3#real^3#real^3#real^3`;`((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3`]]);;
let f1_fan_power_in_face_imp_in_face=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y n.
FAN(x,V,E)/\
(!v. v IN V ==> CARD (set_of_edge v V E) > 1) /\
ds IN face_set (hypermap1_of_fanx (x,V,E))/\
y IN d1_fan (x,V,E)
/\ ((f1_fan x V E POWER n) y IN ds)
==>
(y IN ds)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN SPEC_TAC (`n:num`,`n:num`)
THEN INDUCT_TAC
THENL[
ASM_REWRITE_TAC[POWER;I_DEF];
REWRITE_TAC[COM_POWER;o_DEF]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN 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`y:real^3#real^3#real^3#real^3`)
THEN MP_TAC(SET_RULE`(f1_fan x V E POWER n) y IN d1_fan (x,V,E)/\
d_fan (x,V,E)=d1_fan (x,V,E) UNION d20_fan (x,V,E)
==> (f1_fan x V E POWER n) y IN d_fan (x,V,E)`)
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[d_fan]
THEN RESA_TAC
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E ((f1_fan x V E POWER n) y)):real^3#real^3#real^3#real^3`;`((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3`]]);;
let TRAN_COMMUTATIVE_F1_FAN0=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ((~(pr2 y= sigma_fan x V E v u)/\ pr3 y = v)\/
(~(pr2 y= u)/\ pr3 y = w) \/ ~(pr3 y IN {v,w}))
/\ y IN d_fan(x,V,E)
==>
tran x V E1 ((f1_fan x V E ) y)=(f1_fan x V E1 ) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN2
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN3
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`]);;
let TRAN_COMMUTATIVE_F1_FAN_POWER=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ~(y IN ds)
/\ y IN d_fan(x,V,E)
==>
tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN SPEC_TAC (`n:num`,`n:num`)
THEN INDUCT_TAC
THENL[
REWRITE_TAC[POWER;I_DEF];
REWRITE_TAC[COM_POWER;o_DEF]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN 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`y:real^3#real^3#real^3#real^3`)
THEN ASM_SIMP_TAC[f1_fan_power_in_face]]);;
let TRAN_COMMUTATIVE_F1_FAN_POWER1=prove(
`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ y IN d_fan(x,V,E)
/\ (!m. m < n ==> ~(pr3 ((f1_fan x V E POWER m) y) IN {v,w}))
==>
tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN SPEC_TAC (`n:num`,`n:num`)
THEN INDUCT_TAC
THENL[
REWRITE_TAC[POWER;I_DEF];
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINK")
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN DISCH_TAC
THEN SUBGOAL_THEN`(!m. m < n ==> ~(pr3 ((f1_fan x V E POWER m) y) IN {v, w:real^3}))` ASSUME_TAC
THENL[ REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`];
REMOVE_THEN "LINH" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN DISCH_TAC
THEN REWRITE_TAC[COM_POWER;o_DEF]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`])
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN1
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN STRIP_TAC
THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN 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`y:real^3#real^3#real^3#real^3`)
THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);;
let TRAN_COMMUTATIVE_F1_FAN_POWER2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ y IN d_fan(x,V,E)
/\ (!m. m < n ==> ((~(pr2 ((f1_fan x V E POWER m) y)= sigma_fan x V E v u)/\ pr3 ((f1_fan x V E POWER m) y) = v)\/
(~(pr2 ((f1_fan x V E POWER m) y)= u)/\ pr3 ((f1_fan x V E POWER m) y) = w))
)
==>
tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN SPEC_TAC (`n:num`,`n:num`)
THEN INDUCT_TAC
THENL[
REWRITE_TAC[POWER;I_DEF];
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINK")
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN DISCH_TAC
THEN SUBGOAL_THEN`(!m. m < n ==> ((~(pr2 ((f1_fan x V E POWER m) y)= sigma_fan x V E v u)/\ pr3 ((f1_fan x V E POWER m) y) = v)\/
(~(pr2 ((f1_fan x V E POWER m) y)= u)/\ pr3 ((f1_fan x V E POWER m) y) = w:real^3))
)` ASSUME_TAC
THENL[
REPEAT STRIP_TAC
THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`];
REMOVE_THEN "LINH" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN DISCH_TAC
THEN REWRITE_TAC[COM_POWER;o_DEF]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`])
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN0
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN STRIP_TAC
THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN 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`y:real^3#real^3#real^3#real^3`)
THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);;
let TRAN_COMMUTATIVE_F1_FAN_POWER3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y n.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ y IN d_fan(x,V,E)
/\ (!m. m < n ==> (~(pr2 ((f1_fan x V E POWER m) y) = sigma_fan x V E v u) /\
pr3 ((f1_fan x V E POWER m) y) = v) \/
(~(pr2 ((f1_fan x V E POWER m) y) = u) /\
pr3 ((f1_fan x V E POWER m) y) = w) \/
~(pr3 ((f1_fan x V E POWER m) y) IN {v, w}))
==>
tran x V E1 ((f1_fan x V E POWER n) y)=(f1_fan x V E1 POWER n) (tran x V E1 y)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN SPEC_TAC (`n:num`,`n:num`)
THEN INDUCT_TAC
THENL[
REWRITE_TAC[POWER;I_DEF];
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINK")
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN DISCH_TAC
THEN SUBGOAL_THEN`(!m. m < n ==> (~(pr2 ((f1_fan x V E POWER m) y) = sigma_fan x V E v u) /\
pr3 ((f1_fan x V E POWER m) y) = v) \/
(~(pr2 ((f1_fan x V E POWER m) y) = u) /\
pr3 ((f1_fan x V E POWER m) y) = w) \/
~(pr3 ((f1_fan x V E POWER m) y) IN {v, w})
)` ASSUME_TAC
THENL[
REPEAT STRIP_TAC
THEN MRESA_TAC (ARITH_RULE`!m n. m m< SUC n`)[`m:num`;`n:num`];
REMOVE_THEN "LINH" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN DISCH_TAC
THEN REWRITE_TAC[COM_POWER;o_DEF]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`n:num`[ARITH_RULE`n< SUC n`])
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN0
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(((f1_fan x V E POWER n) y):real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN STRIP_TAC
THEN REMOVE_THEN "LINK" MP_TAC THEN ASM_REWRITE_TAC[] THEN 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`y:real^3#real^3#real^3#real^3`)
THEN ASM_SIMP_TAC[f1_fan_power_in_face]]]);;
let unique_tranf_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 f 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ f= face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)/\ y IN ds0
/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
==> tranf x V E E1 ds0 = f`,
REPEAT STRIP_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASSUME_TAC th)
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ]
THEN FIND_ASSUM(MP_TAC) `ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`
THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN SUBGOAL_THEN`orbit_map (res (f1_fan x V E) (d1_fan (x,V,E))) x'=face (hypermap1_of_fanx (x:real^3,V,E)) x'`(fun th-> REWRITE_TAC[th])
THENL[
ASM_REWRITE_TAC[face];
STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC lemma_face_subset[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`]
THEN MP_TAC(SET_RULE`face (hypermap1_of_fanx (x,V,E)) x' SUBSET d1_fan (x,V,E)
/\ y IN face (hypermap1_of_fanx (x,V,E)) x' ==> y IN d1_fan(x,V,E)`)
THEN RESA_TAC
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN DISCH_TAC
THEN REMOVE_THEN "EM" MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[face;]
THEN ASM_REWRITE_TAC[IN_ELIM_THM;orbit_map]
THEN STRIP_TAC
THEN 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`y:real^3#real^3#real^3#real^3` )
THEN RESA_TAC
THEN MRESA_TAC identity_face_in_face_set[`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 TRAN_COMMUTATIVE_F1_FAN_POWER
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;`n:num`]
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x:real^3,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)))):real^3#real^3#real^3#real^3->bool`;`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))) IN
face_set (hypermap1_of_fanx (x:real^3,V,E1))`ASSUME_TAC
THENL[
ASM_REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face]
THEN EXISTS_TAC`(f1_fan (x:real^3) V E1 POWER n) (tran x V E1 (y:real^3#real^3#real^3#real^3))`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`)
THEN POP_ASSUM MATCH_MP_TAC
THEN FIND_ASSUM(MP_TAC)`y IN d1_fan (x:real^3,V,E)`
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[tran]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v':real^3`
THEN EXISTS_TAC`w':real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)`
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`;
MRESA_TAC f1_fan_power_in_face_imp_in_face[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;
`(face (hypermap1_of_fanx (x,V,E1)) ((f1_fan x V E1 POWER n) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)))):real^3#real^3#real^3#real^3->bool`;`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)` ;`n:num`]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN STRIP_TAC
THENL[
FIND_ASSUM(MP_TAC)`y IN d1_fan (x:real^3,V,E)`
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[tran]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v':real^3`
THEN EXISTS_TAC`w':real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)`
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`;
EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]]]]);;
let tran_in_dart_newfan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 y .
FAN(x,V,E)/\ FAN(x,V,E1)
/\ E SUBSET E1
/\ y IN d1_fan(x,V,E)
==> tran x V E1 y IN d1_fan(x,V,E1)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN REWRITE_TAC[tran]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v (w:real^3)`
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN SET_TAC[]);;
let INJ_TRAN_D1_FAN=prove(` !x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 y y1.
FAN(x,V,E)/\ FAN(x,V,E1)
/\ E SUBSET E1
/\ y IN d1_fan(x,V,E)
/\ y1 IN d1_fan(x,V,E)
/\
tran x V E1 y = tran x V E1 y1
==> y =y1`,
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[tran;PAIR_EQ]
THEN RESA_TAC);;
let INJ_TRANF_FACE_DELETE_DS= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 ds0'.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
/\ ds0' IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
/\ tranf x V E E1 ds0=tranf x V E E1 ds0'
==>
ds0 = ds0'`,
REPEAT STRIP_TAC
THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ]
THEN SUBGOAL_THEN`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)) IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 y)`ASSUME_TAC
THENL[
REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];
POP_ASSUM MP_TAC
THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0':real^3#real^3#real^3#real^3->bool` ]
THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM(MP_TAC)`ds0' IN face_set (hypermap1_of_fanx (x:real^3,V,E)) DELETE ds`
THEN REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN RESA_TAC
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`y' IN ds0'/\ ds0' SUBSET d1_fan (x:real^3,V,E)==> y' IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN FIND_ASSUM(MP_TAC)`ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E)) DELETE ds`
THEN REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN RESA_TAC
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`y IN ds0/\ ds0 SUBSET d1_fan (x:real^3,V,E)==> y IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN MP_TAC(SET_RULE`E UNION {{v:real^3,w}}= E1==> E SUBSET E1`)
THEN RESA_TAC
THEN MRESA_TAC tran_in_dart_newfan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`;
`y':real^3#real^3#real^3#real^3`]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`tran (x:real^3) V E1 (y':real^3#real^3#real^3#real^3)`)
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`;`y':real^3#real^3#real^3#real^3`]
THEN MRESA_TAC identity_face_in_face_set[`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 POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y':real^3#real^3#real^3#real^3)`;`n:num`]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN 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`(y':real^3#real^3#real^3#real^3)`)
THEN MRESA_TAC INJ_TRAN_D1_FAN
[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`;
`y:real^3#real^3#real^3#real^3`;`(f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0':real^3#real^3#real^3#real^3->bool`;`y':real^3#real^3#real^3#real^3`]
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x:real^3,V,E)) ((f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3))):real^3#real^3#real^3#real^3->bool`;` (y':real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MATCH_MP_TAC
THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V,E)) ((f1_fan x V E POWER n) y') IN
face_set (hypermap1_of_fanx (x,V,E))`ASSUME_TAC
THENL[
REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`(f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3)`
THEN ASM_REWRITE_TAC[face];
MRESA_TAC f1_fan_power_in_face_imp_in_face[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`(face (hypermap1_of_fanx (x,V,E)) ((f1_fan x V E POWER n) (y':real^3#real^3#real^3#real^3))):real^3#real^3#real^3#real^3->bool`;`(y':real^3#real^3#real^3#real^3)` ;`n:num`]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]]]);;
let ds1_in_face_set_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> ds1 IN face_set (hypermap1_of_fanx (x,V,E1))`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[face_set;face;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`(x,v:real^3,w,sigma_fan x V E1 v w)`
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v w:real^3`
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`);;
let ds2_in_face_set_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> ds2 IN face_set (hypermap1_of_fanx (x,V,E1))`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[face_set;face;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`(x,w:real^3,v,sigma_fan x V E1 w v)`
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3`
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING] THEN ASM_REWRITE_TAC[])` E UNION {{v:real^3,w}}= E1`
THEN SET_TAC[]);;
let condition_f1_fan_power_in_face_set=prove(`!n:num x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) y y1 ds.
FAN(x,V,E)
/\ y = (f1_fan x V E POWER n) y1
/\ ds IN face_set (hypermap1_of_fanx (x,V,E))
/\ d_fan (x,V,E) =d1_fan (x,V,E)
/\ y1 IN ds
==> y IN ds`,
INDUCT_TAC
THENL[MESON_TAC[POWER;I_DEF];
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "LINH"(fun th-> MRESAL_TAC th[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f1_fan x V E POWER n) y1:real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`;`ds:real^3#real^3#real^3#real^3->bool`;][COM_POWER;o_DEF])
THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f1_fan x V E ((f1_fan x V E POWER n) y1):real^3#real^3#real^3#real^3)` ;`((f1_fan x V E POWER n) y1:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`]]);;
let SUR_TRANF_FACE_DELETE_DS =prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ f IN (face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 ) DELETE ds2
==> ?ds0. ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
/\ tranf x V E E1 ds0=f`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;face_set;set_of_orbits;]
THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC) `x' IN d1_fan (x:real^3,V,E1)`
THEN GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[d1_fan;]
THEN REWRITE_TAC[IN_ELIM_THM;]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"NHO")
THEN SUBGOAL_THEN`{v', w':real^3} IN E`ASSUME_TAC
THENL(*1*)[
FIND_ASSUM(MP_TAC) `{v', w':real^3} IN E1`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;IN_SING;SET_RULE`{v', w'} = {v, w}<=> (v'=v/\ w'=w)\/ (v'=w/\ w'=v)`]) `E UNION {{v:real^3, w}} = E1`
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM (fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC)
THEN FIND_ASSUM(fun th -> ASM_TAC THEN ASM_REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC)`face_map (hypermap1_of_fanx (x:real^3,V,E1)) =
res (f1_fan x V E1) (d1_fan (x,V,E1))`
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN SET_TAC[];(*1*)
ABBREV_TAC`y=(x,(v':real^3),w',sigma_fan x V E v' w')`
THEN SUBGOAL_THEN`y IN d1_fan(x:real^3,V,E)`ASSUME_TAC
THENL(*2*)[
ASM_REWRITE_TAC[face;d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v':real^3`
THEN EXISTS_TAC`w':real^3`
THEN EXISTS_TAC`sigma_fan x V E v' (w':real^3)`
THEN EXPAND_TAC"y"
THEN ASM_REWRITE_TAC[];(*2*)
EXISTS_TAC`face (hypermap1_of_fanx (x:real^3,V,E)) (y:real^3#real^3#real^3#real^3)`
THEN SUBGOAL_THEN `((?x'. x' IN d1_fan (x,V,E) /\
face (hypermap1_of_fanx (x,V,E)) y =
orbit_map (res (f1_fan x V E) (d1_fan (x,V,E))) x') /\
~(face (hypermap1_of_fanx (x,V,E)) y = ds)) ` ASSUME_TAC
THENL(*3*)[
STRIP_TAC
THENL(*4*)[
EXISTS_TAC`y:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[face];(*4*)
STRIP_TAC
THEN MP_TAC(SET_RULE`{f1, f2, (f3:real^3#real^3#real^3#real^3)} SUBSET ds ==> f2 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"ME")
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`)
THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`y:real^3#real^3#real^3#real^3`]
THEN MP_TAC(ARITH_RULE`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num>3
==> ~((CARD (ds:real^3#real^3#real^3#real^3->bool)):num =0)`)
THEN RESA_TAC
THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E) (d1_fan (x:real^3,V,E)))`;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`y:real^3#real^3#real^3#real^3`]
THEN REMOVE_THEN "ME"(fun th-> REWRITE_TAC[SYM th;face;])
THEN ASM_REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(ARITH_RULE`k=0 \/ k=1\/ k>=2`)
THENL(*5*)[
ASM_REWRITE_TAC[POWER;I_DEF]
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 STRIP_TAC THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC)`pr2 f2 = u:real^3`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th]
THEN EXPAND_TAC"y"
THEN REWRITE_TAC[pr2]
THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC)`pr3 f2 = w`
THEN REWRITE_TAC[th]
THEN EXPAND_TAC"y"
THEN REWRITE_TAC[pr3]
THEN STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`)
THEN RESA_TAC
THEN RESA_TAC
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f30 IN ds2`)
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;` (f30:real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC)
THEN ASM_MESON_TAC[];(*5*)
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL(*6*)[
ASM_REWRITE_TAC[POWER_1]
THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`][POWER_1]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`)
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 STRIP_TAC
THEN MRESA_TAC face_subset_dart_fan[`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`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds
==> f1 IN d1_fan(x,V,E)`)
THEN RESA_TAC
THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (y:real^3#real^3#real^3#real^3)`])
THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th]
THEN EXPAND_TAC"y"
THEN REWRITE_TAC[pr2]
THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u`
THEN REWRITE_TAC[th]
THEN EXPAND_TAC"y"
THEN REWRITE_TAC[pr3]
THEN STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_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 ASM_REWRITE_TAC[]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f20 IN ds2`)
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;` (f20:real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC)
THEN ASM_MESON_TAC[];(*6*)
SUBGOAL_THEN`?m. k=SUC (SUC m)/\ m>=0`ASSUME_TAC
THENL(*7*)[
EXISTS_TAC`k-2:num`
THEN REWRITE_TAC[ARITH_RULE`SUC n= n+1`]
THEN POP_ASSUM MP_TAC
THEN ARITH_TAC;(*7*)
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN REPEAT RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC (SUC m):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`][POWER_1]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`)
THEN REMOVE_ASSUM_TAC THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REWRITE_TAC[COM_POWER;o_DEF]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"CHUYEN")
THEN DISCH_TAC
THEN REMOVE_THEN "CHUYEN" MP_TAC
THEN ASM_REWRITE_TAC[ARITH_RULE`SUC n= n+1`]
THEN REMOVE_ASSUM_TAC
THEN STRIP_TAC
THEN MP_TAC(ARITH_RULE`(m + 1) + 1 < CARD (ds:real^3# real^3#real^3#real^3->bool)==> m< CARD ds -2`)
THEN ASM_REWRITE_TAC[]
THEN REMOVE_ASSUM_TAC
THEN STRIP_TAC
THEN ASM_TAC
THEN SPEC_TAC (`m:num`,`m:num`)
THEN INDUCT_TAC
THENL(*8*)[
ASM_REWRITE_TAC[POWER;I_DEF]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC face_subset_dart_fan[`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`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds
==> f1 IN d1_fan(x,V,E)`)
THEN RESA_TAC
THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th` y:real^3#real^3#real^3#real^3`)
THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (f1_fan x V E y:real^3#real^3#real^3#real^3)`])
THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th]
THEN EXPAND_TAC"y"
THEN REWRITE_TAC[pr2;f1_fan]
THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u`
THEN REWRITE_TAC[th]
THEN EXPAND_TAC"y"
THEN REWRITE_TAC[pr3;f1_fan]
THEN STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC THEN ASSUME_TAC th)
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w':real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v':real^3`)
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN SUBGOAL_THEN`((x,v:real^3,w,sigma_fan x V E1 v w)=f1_fan x V E1 x')`ASSUME_TAC
THENL(*9*)[
ASM_REWRITE_TAC[f1_fan;PAIR_EQ]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`)
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1`
THEN RESA_TAC;(*9*)
SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)`ASSUME_TAC
THENL(*10*)[
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*10*)
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN FIND_ASSUM(MP_TAC)`x' IN d1_fan (x:real^3,V,E1)`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`x' = (x'',v',v,(w1:real^3)):real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`f1_fan x V E1 x':real^3#real^3#real^3#real^3`;`x':real^3#real^3#real^3#real^3`]
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`]
THEN FIND_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC)
)`x' = (x'',v',v,(w1:real^3)):real^3#real^3#real^3#real^3`
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC)
THEN ASM_MESON_TAC[]](*10*)](*9*);(*8*)
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"A")
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 POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"NHO")
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "A" MP_TAC
THEN MP_TAC(ARITH_RULE`SUC m < CARD (ds:real^3# real^3#real^3#real^3->bool) - 2==> m < CARD ds - 2`)
THEN RESA_TAC
THEN ASM_REWRITE_TAC[ARITH_RULE`m>=0`]
THEN STRIP_TAC
THEN ABBREV_TAC`y1=(f1_fan (x:real^3) V E POWER SUC(m)) y`
THEN STRIP_TAC
THEN MRESA_TAC face_subset_dart_fan[`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`ds SUBSET d1_fan (x,V,E) /\ {f1, f2, f3} SUBSET ds
==> f1 IN d1_fan(x,V,E)`)
THEN RESA_TAC
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC m:num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`)
THEN MRESA_TAC into_domain1_f1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th` y1:real^3#real^3#real^3#real^3`)
THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (f1_fan x V E y1:real^3#real^3#real^3#real^3)`])
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN ASSUME_TAC th THEN STRIP_TAC)
THEN ASM_REWRITE_TAC[f1_fan]
THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC)`pr2 f1 = v:real^3`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th]
THEN REWRITE_TAC[pr2;]
THEN STRIP_TAC
THEN FIND_ASSUM(MP_TAC)`pr3 f1 = u`
THEN REWRITE_TAC[pr3;th]
THEN STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "NHO" MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN DISCH_THEN(LABEL_TAC"AN") THEN DISCH_THEN(LABEL_TAC"NHO") THEN STRIP_TAC THEN ASSUME_TAC th)
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v'':real^3`)
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN SUBGOAL_THEN`((x,v:real^3,w,sigma_fan x V E1 v w)=f1_fan x V E1 (x,sigma_fan x V E1 v w,v,sigma_fan x V E1 v'' v))`ASSUME_TAC
THENL(*9*)[
ASM_REWRITE_TAC[f1_fan;PAIR_EQ]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`w:real^3`)
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1`
THEN RESA_TAC;(*9*)
SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)`ASSUME_TAC
THENL(*10*)[
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*10*)
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN SUBGOAL_THEN`x,v'',v,sigma_fan x V E1 v'' v IN d1_fan (x:real^3,V,E1)`ASSUME_TAC
THENL(*11*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v'':real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v'' v:real^3`
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM;] THEN ASM_REWRITE_TAC[IN_SING])` E UNION {{v:real^3,w}}= E1`;(*11*)
MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`f1_fan x V E1 (x,v'',v,sigma_fan x V E1 v'' v):real^3#real^3#real^3#real^3`;`(x,v'',v,sigma_fan x V E1 v'' v):real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`(x,v'',v,sigma_fan x V E1 v'' v)=tran x V E1 (y1:real^3#real^3#real^3#real^3)`ASSUME_TAC
THENL(*12*)[
ASM_REWRITE_TAC[tran];(*12*)
ASM_REWRITE_TAC[]
THEN REMOVE_THEN "NHO" MP_TAC
THEN FIND_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC
THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[SYM th])
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"NHO")
THEN ASSUME_TAC (SYM th)
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"AN")
)`y1 = (x''',v'',v,(w1':real^3)):real^3#real^3#real^3#real^3`
THEN MRESAL_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`1:num`;][POWER_1]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` THEN MRESA1_TAC th`y1:real^3#real^3#real^3#real^3`)
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;`SUC m:num`]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`]
THEN MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E)) )`]
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 MP_TAC (SET_RULE`{f1, f2:real^3#real^3#real^3#real^3, f3} SUBSET ds==> f2 IN ds`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E (f1_fan x V E y1)):real^3#real^3#real^3#real^3`;`f1_fan x V E y1:real^3#real^3#real^3#real^3`;]
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E y1):real^3#real^3#real^3#real^3`;` y1:real^3#real^3#real^3#real^3`;]
THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;]
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'''':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]
THEN MRESA_TAC lemma_segment_orbit[`d1_fan (x:real^3,V,E)`;`res (f1_fan x V E) (d1_fan ((x:real^3),V,E))`;`(y:real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[face] THEN STRIP_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;lemma_def_inj_orbit])
THEN REMOVE_ASSUM_TAC
THEN MP_TAC(ARITH_RULE `SUC (m:num) < CARD (ds:real^3#real^3#real^3#real^3->bool) - 2 ==> CARD ds -1 < CARD ds /\ SUC (m:num) <= CARD (ds:real^3#real^3#real^3#real^3->bool) - 1 /\ SUC( SUC(SUC (m:num))) <= CARD (ds:real^3#real^3#real^3#real^3->bool) - 1`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `CARD (ds:real^3#real^3#real^3#real^3->bool) -1 :num`)
THEN SUBGOAL_THEN`!m'. m' < SUC m==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC
THENL(*13*)[
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN REPEAT STRIP_TAC
THENL(*14*)[
POP_ASSUM MP_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`y: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 m:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` )
THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th [`SUC (m:num)`;`m':num`;]);(*14*)
POP_ASSUM MP_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`y: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 (SUC(SUC m:num))`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`y:real^3#real^3#real^3#real^3` )
THEN MP_TAC (ARITH_RULE`m'< SUC m ==> m'< SUC(SUC(SUC m)) `)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN REMOVE_THEN "LINH"(fun th-> MRESA_TAC th [`SUC (SUC (SUC (m:num)))`;`m':num`;])
THEN REMOVE_THEN "AN" MP_TAC
THEN DISCH_TAC THEN REMOVE_ASSUM_TAC
THEN EXPAND_TAC"y1"
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[COM_POWER;o_DEF;SET_RULE`~(A=B)<=> ~(B=A)`]](*14*);(*13*)
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN SUBGOAL_THEN`!m'. m' < SUC m
==> (~(pr2 ((f1_fan x V E POWER m') y) = v'') /\
pr3 ((f1_fan x V E POWER m') y) = v) \/
(~(pr2 ((f1_fan x V E POWER m') y) = u) /\
pr3 ((f1_fan x V E POWER m') y) = w) \/
~(pr3 ((f1_fan x V E POWER m') y) IN {v, w})` ASSUME_TAC
THENL(*14*)[
REPEAT STRIP_TAC
THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`m':num`)
THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;]
THEN MRESA_TAC condition_f1_fan_power_in_face_set[`m':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`f1_fan x V E (f1_fan x V E y1) IN ds /\ (f1_fan x V E POWER m') y IN ds/\ ds SUBSET d1_fan (x,V,E)==> (f1_fan x V E POWER m') y IN d1_fan (x:real^3,V,E) /\ f1_fan x V E (f1_fan x V E y1) IN d1_fan (x:real^3,V,E)`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ]
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "AN"(fun th-> REWRITE_TAC[SYM th;pr2;pr3])
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[];(*14*)
ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN ASM_REWRITE_TAC[POWER] THEN STRIP_TAC
THEN MRESAL_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;` ((f1_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) POWER SUC m) (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)))`;`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)`;][POWER]
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;tran])`x,(v':real^3),w',sigma_fan x V E v' w' = y`
THEN ASM_REWRITE_TAC[]
THEN REMOVE_THEN "NHO" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th)]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`x':real^3#real^3#real^3#real^3`]
THEN ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC THEN ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;face] THEN REPEAT STRIP_TAC)
)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;] THEN REPEAT STRIP_TAC)
THEN ASM_MESON_TAC[]](*14*)](*13*)](*12*)](*11*)](*10*)](*9*)]
(*8*)](*7*)](*6*)](*5*)](*4*);(*3*)
ASM_REWRITE_TAC[]
THEN MRESAL_TAC unique_tranf_fan
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
; `(face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool`
;`(f:real^3#real^3#real^3#real^3->bool)`
;`(y:real^3#real^3#real^3#real^3)`;][face]
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;tran;face])
THEN ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THENL(*4*)[
REWRITE_TAC[orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*4*)
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;face_set;set_of_orbits]
THEN EXISTS_TAC`x''':real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
]]]]);;
let DOMAIN_TRANF_FACE_DELETE_DS=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
==> tranf x V E E1 ds0 IN
face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 DELETE ds2`,
REWRITE_TAC[DELETE;IN_ELIM_THM;]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN DISCH_THEN(LABEL_TAC"LINK")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESAL_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ][DELETE;IN_ELIM_THM]
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`y IN ds0/\ ds0 SUBSET d1_fan (x:real^3,V,E)==> y IN d1_fan (x,V,E)`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC (SYM th) THEN DISCH_THEN(LABEL_TAC"NHO"))
THEN ASSUME_TAC th)
THEN MP_TAC(SET_RULE`{v', w'} IN E /\ E UNION {{v, w}} = E1==> {v', w':real^3} IN E1 /\ {v, w:real^3} IN E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THENL(*1*)[
REWRITE_TAC[face_set;face;IN_ELIM_THM;set_of_orbits]
THEN EXISTS_TAC`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`
THEN ASM_REWRITE_TAC[]
THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th;tran;d1_fan;IN_ELIM_THM])
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v':real^3`
THEN EXISTS_TAC`w':real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v' (w':real^3)`
THEN ASM_REWRITE_TAC[];(*1*)
REMOVE_THEN "LINH" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 (y:real^3#real^3#real^3#real^3))` ASSUME_TAC
THENL(*2*)[
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`ds1 = face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`face (hypermap1_of_fanx (x,V,E1)) ((x:real^3),v,w,sigma_fan x V E1 v w) = ds1`
THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*2*)
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`tran x V E1 (y:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)` ASSUME_TAC
THENL(*3*)[
REMOVE_THEN "NHO" (fun th-> REWRITE_TAC[SYM th;tran;d1_fan;IN_ELIM_THM])
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v':real^3`
THEN EXISTS_TAC`w':real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3`
THEN ASM_REWRITE_TAC[];(*3*)
MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`n:num`;`( \ t. res (t (x:real^3) V E1 ) (d1_fan (x:real^3, V:real^3->bool, (E1:(real^3->bool)->bool))))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`)
THEN DISJ_CASES_TAC(ARITH_RULE`n=0\/ n=1\/ n:num>1`)
THENL(*4*)[
REMOVE_THEN"NHO"(fun th-> ASM_REWRITE_TAC[SYM th;tran;POWER;I_DEF;EQ_PAIR_4])
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN FIND_ASSUM MP_TAC`{v':real^3, w'} IN E`
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*4*)
POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w= f1_fan x V E1 (x,sigma_fan x V E1 v w,v, sigma_fan x V E1 (sigma_fan x V E1 v w) v )` ASSUME_TAC
THENL(*5*)[
REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`);(*5*)
SUBGOAL_THEN`x,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v IN
d1_fan (x,V,E1)` ASSUME_TAC
THENL(*6*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 (sigma_fan x V E1 v w ) v :real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`v:real^3`]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` sigma_fan x V E1 v (w:real^3)`;
`v:real^3`];(*6*)
SUBGOAL_THEN `f1= f1_fan x V E (x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v)` ASSUME_TAC
THENL(*7*)[
REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u :real^3`
THEN ASM_REWRITE_TAC[];(*7*)
SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN
d1_fan (x,V,E)` ASSUME_TAC
THENL(*8*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3`
THEN ASM_REWRITE_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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MRESA_TAC sigma_fan_in_set_of_edge[`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`];(*8*)
MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;]
THEN STRIP_TAC
THENL(*9*)[
ASM_REWRITE_TAC[POWER_1]
THEN STRIP_TAC
THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x:real^3,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)`;`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`])
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "NHO"(fun th-> ASM_REWRITE_TAC[SYM th;tran;EQ_PAIR_4] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHO" ))
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_THEN"NHO" MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC identity_face_in_face_set[`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 identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`];(*9*)
SUBGOAL_THEN`?m. n=SUC (SUC m)/\ m>=0`ASSUME_TAC
THENL(*10*)[
EXISTS_TAC`n-2:num`
THEN REWRITE_TAC[ARITH_RULE`SUC n= n+1`]
THEN POP_ASSUM MP_TAC
THEN ARITH_TAC;(*10*)
POP_ASSUM MP_TAC
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[COM_POWER]
THEN REWRITE_TAC[o_DEF]
THEN STRIP_TAC
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC m:num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`)
THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA_TAC th[`(x:real^3,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)`;`(f1_fan x V E1 POWER SUC m) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`])
THEN POP_ASSUM MP_TAC
THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v)`
THEN DISJ_CASES_TAC(SET_RULE`~((y:real^3#real^3#real^3#real^3) IN ds)\/ y IN ds`)
THENL(*11*)[
SUBGOAL_THEN`!m'. m' < SUC m==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC
THENL(*12*)[
REPEAT STRIP_TAC
THENL(*13*)[
MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`m':num`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;];(*13*)
MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`m':num`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f2:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;](*13*)];(*12*)
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN SUBGOAL_THEN`!m'. m' < SUC m
==> (~(pr2 ((f1_fan x V E POWER m') y) = sigma_fan x V E v u) /\
pr3 ((f1_fan x V E POWER m') y) = v) \/
(~(pr2 ((f1_fan x V E POWER m') y) = u) /\
pr3 ((f1_fan x V E POWER m') y) = w) \/
~(pr3 ((f1_fan x V E POWER m') y) IN {v, w})` ASSUME_TAC
THENL(*13*)[
REPEAT STRIP_TAC
THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`m':num`)
THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;]
THEN MP_TAC(SET_RULE`f1_fan x V E (f1_fan x V E y1) IN ds /\ (f1_fan x V E POWER m') y IN ds0/\ ds SUBSET d1_fan (x,V,E) /\ ds0 SUBSET d1_fan (x,V,E)==> (f1_fan x V E POWER m') y IN d1_fan (x:real^3,V,E) /\ f1_fan x V E (f1_fan x V E y1) IN d1_fan (x:real^3,V,E)`)
THEN FIND_ASSUM (fun th->REWRITE_TAC[SYM th])`f1 = f1_fan x V E (y1:real^3#real^3#real^3#real^3)`
THEN MRESA_TAC condition_f1_fan_power_in_face_set[`m':num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds0:real^3#real^3#real^3#real^3->bool`]
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ]
THEN POP_ASSUM MP_TAC
THEN EXPAND_TAC"y1"
THEN REWRITE_TAC[pr2;pr3]
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[];(*13*)
MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;`SUC m:num`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SUBGOAL_THEN`(x,sigma_fan x V E1 v w,v,sigma_fan x V E1 (sigma_fan x V E1 v w) v)=tran x V E1 (y1:real^3#real^3#real^3#real^3)`ASSUME_TAC
THENL(*14*)[
EXPAND_TAC"y1"
THEN REWRITE_TAC[tran]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ];(*14*)
ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC condition_f1_fan_power_in_face_set[`SUC m:num`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER (SUC m)) y):real^3#real^3#real^3#real^3` ;` y:real^3#real^3#real^3#real^3`;`ds0:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE` (f1_fan x V E POWER (SUC m)) y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)/\ E UNION {{v, w}} = E1 ==> (f1_fan x V E POWER (SUC m)) y IN d1_fan (x:real^3,V,E) /\ E SUBSET E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC INJ_TRAN_D1_FAN
[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`;
`y1:real^3#real^3#real^3#real^3`;`(f1_fan x V E POWER (SUC m)) (y:real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m`; `x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`y1:real^3#real^3#real^3#real^3`;` y:real^3#real^3#real^3#real^3`;]](*14*)](*13*)](*12*);(*11*)
MRESA_TAC identity_face_in_face_set[`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 identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]](*11*)](*10*)](*9*)](*8*)](*7*)](*6*)](*5*)](*4*)](*3*)](*2*);(*1*)
REMOVE_THEN "LINH" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN SUBGOAL_THEN`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3) IN ds2` ASSUME_TAC
THENL(*2*)[
ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`0 >=0 `;POWER;I_DEF];(*2*)
POP_ASSUM MP_TAC
THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3) IN {f10, (f20:real^3#real^3#real^3#real^3), f30}==> tran x V E1 y =f10 \/ tran x V E1 y =f20 \/ tran x V E1 y = f30`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THENL(*3*)[
POP_ASSUM MP_TAC
THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran])
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,w,v,u = f10:real^3#real^3#real^3#real^3`
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN FIND_ASSUM MP_TAC`{w, v:real^3} IN E`
THEN FIND_ASSUM MP_TAC`~({w, v:real^3} IN E)`
THEN SET_TAC[];(*3*)
POP_ASSUM MP_TAC
THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran]THEN ASSUME_TAC (SYM(th)))
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,v,u,w = f20:real^3#real^3#real^3#real^3`
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN SUBGOAL_THEN `f1=y:real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*4*)[
ASM_REWRITE_TAC[]
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u :real^3`
THEN ASM_REWRITE_TAC[];(*4*)
MP_TAC(SET_RULE`f1=y /\ f1 IN ds ==> (y:real^3#real^3#real^3#real^3) IN ds`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC identity_face_in_face_set[`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 identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]](*4*);(*3*)
POP_ASSUM MP_TAC
THEN REMOVE_THEN"NHO"(fun th-> REWRITE_TAC[SYM th;tran]THEN ASSUME_TAC (SYM(th)))
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,u,w,v = f30:real^3#real^3#real^3#real^3`
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN SUBGOAL_THEN `f2=y:real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*4*)[
ASM_REWRITE_TAC[]
THEN MRESA_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f2:real^3#real^3#real^3#real^3`;`(x,u,w,w1):real^3#real^3#real^3#real^3`;]
THEN POP_ASSUM MATCH_MP_TAC
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3])`x,u,w,v = f30:real^3#real^3#real^3#real^3`
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v :real^3`
THEN ASM_REWRITE_TAC[];(*4*)
MP_TAC(SET_RULE`f2=y /\ f2 IN ds ==> (y:real^3#real^3#real^3#real^3) IN ds`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC identity_face_in_face_set[`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 identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`;` (y:real^3#real^3#real^3#real^3)`]]]]]);;
let EQ_CARD_FACE_FAN_AND_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> CARD ((face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 ) DELETE ds2 )= CARD (face_set (hypermap1_of_fanx (x,V,E)) DELETE ds) `,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC CARD_IMAGE_INJ_EQ
THEN EXISTS_TAC`tranf (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (E1:(real^3->bool)->bool):(real^3#real^3#real^3#real^3->bool)->real^3#real^3#real^3#real^3->bool`
THEN MRESAL1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`[FINITE_DELETE;EXISTS_UNIQUE]
THEN STRIP_TAC
THENL[
REPEAT STRIP_TAC
THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(x':real^3#real^3#real^3#real^3->bool)`;];
REPEAT STRIP_TAC
THEN MRESA_TAC SUR_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3->bool)`;]
THEN EXISTS_TAC`ds0:real^3#real^3#real^3#real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC INJ_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y':real^3#real^3#real^3#real^3->bool)`;`(ds0:real^3#real^3#real^3#real^3->bool)`]]);;
let CARD_DART_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ~(v=w)
/\ E UNION {{v,w}}=E1
==>
CARD (dart (hypermap1_of_fanx (x,V,E1)))
= CARD (dart (hypermap1_of_fanx (x,V,E))) +2`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESAL_TAC card_eq_image_in_d_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`;
`d1_fan (x,V,E1):real^3#real^3#real^3#real^3->bool`][SET_RULE`d1_fan (x,V,E1) SUBSET d1_fan (x,V,E1)`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESAL_TAC card_eq_image_in_d_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;
`d1_fan (x,V,E):real^3#real^3#real^3#real^3->bool`][SET_RULE`d1_fan (x,V,E) SUBSET d1_fan (x,V,E)`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC DART_FANADD_EQ_DART_FAN_ADD_2DART[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`]
THEN MRESA_TAC FINITE_IMAGE[`pr23:real^3#real^3#real^3#real^3->real^3#real^3`;`(d1_fan ((x:real^3),V,E))`]
THEN MRESA_TAC CARD_UNION[`IMAGE pr23 (d1_fan ((x:real^3),V,E))`;`{(v,w), (w,(v:real^3))}`]
THEN POP_ASSUM MP_TAC
THEN ASM_SIMP_TAC[HAS_SIZE; CARD_CLAUSES; FINITE_INSERT; FINITE_EMPTY;
IN_INSERT; NOT_IN_EMPTY;PAIR_EQ;SET_RULE`v = w /\ w = v <=> v=w`;ARITH_RULE`SUC(SUC 0)=2`]
THEN STRIP_TAC
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[EXTENSION;INTER;IN_ELIM_THM;NOT_IN_EMPTY;PR23_OF_D1_FAN;SET_RULE`x' IN {(v,w), (w,v)}
<=> x'=(v,w) \/ x'=(w,v)`]
THEN GEN_TAC
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[PAIR_EQ]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]);;
let ZSZIUQE_LEMMA=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> N_FAN (x,V,E1)< N_FAN(x,V,E)`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN REWRITE_TAC[N_FAN]
THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`
THEN MRESA1_TAC FINITE_HYPERMAP_ORBITS`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`
THEN MRESA_TAC NSUM_CONST[`3:num`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`]
THEN MRESA_TAC NSUM_CONST[`3:num`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`]
THEN SUBGOAL_THEN`!y. y IN (face_set (hypermap1_of_fanx ((x:real^3),V,E1)))==> (\x. CARD x - 3 + 3) y=(\x. CARD x ) y` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN ARITH_TAC;
SUBGOAL_THEN`!y. y IN (face_set (hypermap1_of_fanx ((x:real^3),V,E)))==> (\x. CARD x - 3 + 3) y=(\x. CARD x ) y` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`y:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN ARITH_TAC;
MP_TAC(SET_RULE` E UNION {{v,w:real^3}}= E1
==> {v,w} IN E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(v:real^3)`]
THEN MRESA_TAC NSUM_EQ[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3+3)`;`(\(f:real^3#real^3#real^3#real^3->bool). CARD f)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`]
THEN MRESA_TAC NSUM_EQ[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3+3)`;`(\(f:real^3#real^3#real^3#real^3->bool). CARD f)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`]
THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`]
THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`]
THEN MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`;`( \ t. res (t x V E ) (d1_fan (x:real^3,V,E)) )`]
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 MRESA_TAC AAUHTVE[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`;`( \ t. res (t x V E1 ) (d1_fan (x:real^3,V,E1)) )`]
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 MRESA_TAC card_partition_formula[`dart (hypermap1_of_fanx (x:real^3,V,E1))`;`face_map (hypermap1_of_fanx (x:real^3,V,E1))`]
THEN MRESA_TAC NSUM_ADD[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3)`;`(\(f:real^3#real^3#real^3#real^3->bool). 3)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`]
THEN POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[face_set]
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC card_partition_formula[`dart (hypermap1_of_fanx (x:real^3,V,E))`;`face_map (hypermap1_of_fanx (x:real^3,V,E))`]
THEN MRESA_TAC NSUM_ADD[`(\(f:real^3#real^3#real^3#real^3->bool). CARD f - 3)`;`(\(f:real^3#real^3#real^3#real^3->bool). 3)`;`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`]
THEN POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[face_set]
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC CARD_DART_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC EQ_CARD_FACE_FAN_AND_FANADD
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E)))`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E1)))`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN SUBGOAL_THEN `ds2 IN (face_set (hypermap1_of_fanx ((x:real^3),V,E1))) DELETE (ds1:real^3#real^3#real^3#real^3->bool)`ASSUME_TAC
THENL[
REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];
MRESAL_TAC CARD_MINUS_ONE[`(face_set (hypermap1_of_fanx ((x:real^3),V,E1))) DELETE (ds1:real^3#real^3#real^3#real^3->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`][FINITE_DELETE]
THEN ARITH_TAC]]]);;
let ZSZIUQE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> ~(ds1= ds2)/\ CARD ds2=3 /\ ds2={f10,f20,f30} /\ N_FAN (x,V,E1)< N_FAN(x,V,E)`,
REPEAT STRIP_TAC
THENL[
POP_ASSUM MP_TAC
THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];
MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];
MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];
MRESA_TAC ZSZIUQE_LEMMA[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]]);;
let FAN80_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> fan80(x,V,E1)`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN REPEAT GEN_TAC
THEN FIND_ASSUM (fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th] THEN REWRITE_TAC[IN_ELIM_THM;UNION;IN_SING])`E UNION {{v, w:real^3}} = E1`
THEN STRIP_TAC
THENL(*1*)[
FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`u':real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH"))
THEN DISJ_CASES_TAC(SET_RULE`
~(v' IN {v, w:real^3})\/ (v'=v/\ u'=u)\/ (v'=v/\ ~(u'=u))\/ (v'=w/\ u'= inverse1_sigma_fan x V E w u)\/ (v'=w/\ ~(u'=inverse1_sigma_fan x V E w u))`)
THENL(*2*)[
MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`; `w: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 STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`u':real^3`] );(*2*)
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL(*3*)(*4GOAL*)[
ASM_REWRITE_TAC[]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MATCH_MP_TAC properties_of_fully_surrounded1_fan
THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`u: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`];(*3*)
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`];(*3*)
ASM_REWRITE_TAC[]
THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH"))
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 INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`]
THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`]
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(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u
==>
azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`;
`(w:real^3)`]
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u: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 MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u =
azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u
/\ &0<= azim x w v u
==> azim x w (inverse1_sigma_fan x V E w u) v<=azim x w (inverse1_sigma_fan x V E w u) u
`)
THEN ASM_SIMP_TAC[azim]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC (SYM th) THEN DISCH_THEN(LABEL_TAC"YEUEMLINH"))
THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`] )
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`
azim x w (inverse1_sigma_fan x V E w u) v <=
azim x w (inverse1_sigma_fan x V E w u) u
/\ azim x w (inverse1_sigma_fan x V E w u) u < pi
==> azim x w (inverse1_sigma_fan x V E w u) (v:real^3) < pi`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u) u =
azim x w (inverse1_sigma_fan x V E w u) v + azim x w v u
/\ azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u
==> &0 < azim x w (inverse1_sigma_fan x V E w u) v
`)
THEN ASM_REWRITE_TAC[];(*3*)
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;`u':real^3`]](*3*)](*2*);(*1*)
MP_TAC(SET_RULE`{v', u':real^3} = {v, w}==> (v'=v /\ u'=w) \/ (v'=w /\ u'=v)`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THENL[
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH"))
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 MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][DE_MORGAN_THM;]
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 ABBREV_TAC`u1=sigma_fan x V E v u`
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 sigma_fan_in_set_of_edge[`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) `;` (u1:real^3)`;
`(v:real^3)`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`u1:real^3`]
THEN REMOVE_THEN "NHOLINH"(fun th-> MRESA_TAC th[`v:real^3`;`u:real^3`] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"NHOLINH"))
THEN MP_TAC(REAL_ARITH` azim x v u w + azim x v w u1< pi/\ &0 <= azim x v u w /\ &0 <= azim x v w u1
==> azim x v w (u1:real^3) azim x v w u1 = &0\/ &0{v, w} IN E1 /\ {v, u1} IN E1`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC UNIQUE_AZIM_0_POINT_FAN[`(x:real^3)`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`(v:real^3)`;`(w:real^3)`;`u1:real^3`]
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC)
THEN FIND_ASSUM MP_TAC`{v,w:real^3} IN E`
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;]
THEN MRESA_TAC condition_azim_le_pi[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`]]]);;
let FANADD_CONFORMING=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==>
conforming_fan (x,V,E1)`,
REPEAT STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(E1:(real^3->bool)->bool)`)
THEN POP_ASSUM MATCH_MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC ZSZIUQE_LEMMA[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);;
let dartset_leads_in_fanadd_topological_component_yfan =prove( `!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0.
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
==> dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) IN topological_component_yfan (x,V,E1)`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(ds0:real^3#real^3#real^3#real^3->bool)`;]
THEN MP_TAC(SET_RULE`tranf (x:real^3) V (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool) IN face_set (hypermap1_of_fanx (x,V,E1)) DELETE ds1 DELETE ds2
==> tranf (x:real^3) V E E1 (ds0:real^3#real^3#real^3#real^3->bool) IN face_set (hypermap1_of_fanx ((x:real^3),V,E1))`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf (x:real^3) V (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`]);;
let INVARANT_SIGMA_FAN_ADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ~(y IN ds)
/\ y IN d_fan(x,V,E)
==>
sigma_fan x V E1 (pr2(y)) (pr3(y))= sigma_fan x V E (pr2(y)) (pr3(y))`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC th THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC THEN MP_TAC th THEN ASM_REWRITE_TAC[] THEN STRIP_TAC)
THEN ASM_REWRITE_TAC[pr2;pr3]
THEN DISJ_CASES_TAC(SET_RULE`
~(v' IN {v, w:real^3})\/ (v'=v/\ w'=u)\/ (v'=v/\ ~(w'=u))\/ (v'=w/\ w'= inverse1_sigma_fan x V E w u)\/ (v'=w/\ ~(w'=inverse1_sigma_fan x V E w u))`)
THENL[
MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`; `w: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 STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`] );(*1*)
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL[
SUBGOAL_THEN`y= f1:real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
ASM_REWRITE_TAC[]
THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN ASM_REWRITE_TAC[pr3;pr2]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]);
MP_TAC(SET_RULE`y=(f1:real^3#real^3#real^3#real^3) /\ f1 IN ds ==> y IN ds`)
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN SET_TAC[]];
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;`w':real^3`];
SUBGOAL_THEN`y=f3:real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN ASM_REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3
==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`)
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[pr2;pr3])
THEN STRIP_TAC
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;])`f1_fan x V E (f2:real^3#real^3#real^3#real^3) = (f3:real^3#real^3#real^3#real^3)`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th;f1_fan])
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]];
MP_TAC(SET_RULE`y=(f3:real^3#real^3#real^3#real^3) /\ f3 IN ds ==> y IN ds`)
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN SET_TAC[]];
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;`w':real^3`]]]);;
let lemma_yfanadd_aff_ge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> yfan(x,V,E) SUBSET yfan(x,V,E1) UNION aff_ge {x} {v, w}`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2;]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;DIFF;UNION;UNIONS;IN_ELIM_THM;GSYM FORALL_NOT_THM;IN_SING;DE_MORGAN_THM;SUBSET])
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[SET_RULE`x' IN (:real^3)`]
THEN DISJ_CASES_TAC(SET_RULE`~(x' IN aff_ge {x} {v, w:real^3})\/ (x' IN aff_ge {x} {v, w:real^3})`)
THENL[
ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> MP_TAC(ISPEC `u':real^3->bool`th))
THEN DISJ_CASES_TAC(SET_RULE`~(x' IN (u':real^3->bool))\/ (x' IN (u':real^3->bool))`)
THENL[
ASM_REWRITE_TAC[];
ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(e = {v, w})\/ (e = {v, w:real^3})`)
THENL[
ASM_REWRITE_TAC[];
ASM_REWRITE_TAC[]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[CONTRAPOS_THM]
THEN STRIP_TAC THEN
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN ASM_REWRITE_TAC[]]];
ASM_REWRITE_TAC[]]);;
let lemma_yfanadd_aff_gt= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> yfan(x,V,E) SUBSET yfan(x,V,E1) UNION aff_gt {x} {v, w}`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
` (v:real^3)`]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;
` (w: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 STRIP_TAC
THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC lemma_yfanadd_aff_ge[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN SUBGOAL_THEN`aff_ge {x} {w} 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 MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`]
THEN EXISTS_TAC `{w,v'}:real^3->bool`
THEN ASM_REWRITE_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 MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(w:real^3)`;` (v':real^3)`]
THEN ASM_TAC THEN SET_TAC[IN];
SUBGOAL_THEN`aff_ge {x} {v} 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 MRESA_TAC exists_edge_fully_surround_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`]
THEN EXISTS_TAC `{v,v'}:real^3->bool`
THEN ASM_REWRITE_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)`;
` (v:real^3)`]
THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (v':real^3)`]
THEN ASM_TAC THEN SET_TAC[IN];
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan;SUBSET;UNION;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM (fun th->
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th))
THEN REWRITE_TAC[th]
THEN ASSUME_TAC th)
THEN STRIP_TAC
THENL[
ASM_REWRITE_TAC[];
ASM_REWRITE_TAC[];
REPEAT STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th))
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[];
STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `x':real^3` th))
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]]]]);;
let lemma_yfanadd_aff_gt1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> yfan(x,V,E1) SUBSET yfan(x,V,E)`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;IN_ELIM_THM;IN_SING;UNION])
THEN SET_TAC[]);;
let YFANADD_AFF_GT=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> yfan(x,V,E) = yfan(x,V,E1) UNION aff_gt {x} {v, w}`,
REPEAT STRIP_TAC
THEN MRESA_TAC lemma_yfanadd_aff_gt[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC lemma_yfanadd_aff_gt1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC condition_aff_gt_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 POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]);;
let dartset_leads_into_fanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> dartset_leads_into_fan x V E1 ds1 SUBSET dartset_leads_into_fan x V E ds`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN ABBREV_TAC`y=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v )`
THEN SUBGOAL_THEN `f1=f1_fan x V E (y:real^3#real^3#real^3#real^3)` ASSUME_TAC
THENL(*1*)[
POP_ASSUM(fun th-> REWRITE_TAC[SYM th;f1_fan;EQ_PAIR_4])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u:real^3`)
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u :real^3`
THEN ASM_REWRITE_TAC[];(*1*)
SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN
d1_fan (x:real^3,V,E)` ASSUME_TAC
THENL(*2*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3`
THEN ASM_REWRITE_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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MRESA_TAC sigma_fan_in_set_of_edge[`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`];(*2*)
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;]
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 SUBGOAL_THEN `(x,v,w,sigma_fan x V E1 v w)=f1_fan x V E1 (y:real^3#real^3#real^3#real^3)` ASSUME_TAC
THENL(*3*)[
EXPAND_TAC"y"
THEN REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MP_TAC(SET_RULE`E UNION {{v, w:real^3}} = E1==>{v, w}IN E1`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`v:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`);(*3*)
SUBGOAL_THEN`x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v IN
d1_fan (x:real^3,V,E1)` ASSUME_TAC
THENL(*4*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u ) v :real^3`
THEN ASM_REWRITE_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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MRESA_TAC sigma_fan_in_set_of_edge[`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 MP_TAC(SET_RULE`E UNION {{v, w:real^3}} = E1 /\ {v, sigma_fan x V E v u} IN E ==> {v, sigma_fan x V E v u} IN E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESAL_TAC th[`sigma_fan x V E v u:real^3`;`v:real^3`][SET_RULE`~(A IN {B,C}) <=> ~(A=B)/\ ~(C=A)`])
THEN POP_ASSUM MP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(sigma_fan x V E v u = w:real^3) \/ ~(sigma_fan x V E v u = w)`)
THENL(*5*)[
POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN FIND_ASSUM MP_TAC`{v, w:real^3} IN E`
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*5*)
ASM_REWRITE_TAC[]
THEN RESA_TAC](*5*);(*4*)
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC
THENL(*5*)[
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1:real^3#real^3#real^3#real^3->bool`
THEN EXISTS_TAC`0`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*5*)
MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(x,sigma_fan x V E v u,v,sigma_fan x V E (sigma_fan x V E v u) v):real^3#real^3#real^3#real^3`;]
THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;
`ds1: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 FIND_ASSUM MP_TAC `(y:real^3#real^3#real^3#real^3) IN d1_fan (x,V,E)`
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[pr2;pr3]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN MP_TAC(SET_RULE`{v', w'} IN E /\ E UNION {{v, w}} = E1 ==> {v':real^3, w'} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN MP_TAC(REAL_ARITH`&0 &0< (min (min (h:real) (h':real)) (pi/ &2))/ &2 /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2 < (pi/ &2) /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h'`)
THEN ASM_REWRITE_TAC[PI_WORKS;]
THEN STRIP_TAC
THEN MRESA_TAC not_empty_rw_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`(min (min (h:real) (h':real)) (pi/ &2))/ &2`[SET_RULE`~(A={})<=> ?y. y IN A`])
THEN SUBGOAL_THEN`y' IN
rw_dart_fan x V E1 (x,v',w',sigma_fan x V E1 v' w')
(cos (min (min h h') (pi / &2) / &2))`
ASSUME_TAC
THENL(*6*)[
POP_ASSUM MP_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 FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)`
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th)
THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th))
THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)`
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th)
THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th))
THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[SET_RULE`~(v' IN {v, w}) <=> ~(v =v') /\ ~(v' = w)`]
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 sigma_fan_in_set_of_edge[`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 "EM" (fun th-> MP_TAC th THEN ASSUME_TAC(th))
THEN EXPAND_TAC"y"
THEN REWRITE_TAC[EQ_PAIR_4]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`~(v:real^3 = sigma_fan x V E v u)`
THEN DISJ_CASES_TAC(SET_RULE`(sigma_fan x V E v u = w:real^3) \/ ~(sigma_fan x V E v u = w)`)
THENL(*7*)[
POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN FIND_ASSUM MP_TAC`{v, w:real^3} IN E`
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`~({w, v:real^3} IN E)`;(*7*)
POP_ASSUM (fun th-> REWRITE_TAC[th])
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[]](*7*);(*6*)
REMOVE_THEN"LINH"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y':real^3`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_THEN"LINH1"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y':real^3`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y':real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN SET_TAC[]]]]]]]);;
let dartset_leads_into_fanadd2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> dartset_leads_into_fan x V E1 ds2 SUBSET dartset_leads_into_fan x V E ds`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
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 `f2:real^3#real^3#real^3#real^3`)
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE`ds2 = {(f10:real^3#real^3#real^3#real^3), f20, f30}==> f30 IN ds2`)
THEN RESA_TAC
THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;
`ds2:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `f30:real^3#real^3#real^3#real^3`)
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3])`x,u,w,v = f30:real^3#real^3#real^3#real^3`
THEN MRESA_TAC DART_LEADS_INTO [`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"LINH")
THEN MP_TAC(SET_RULE`{u, w} IN E /\ E UNION {{v, w}} = E1 ==> {u:real^3, w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN MP_TAC(REAL_ARITH`&0 &0< (min (min (h:real) (h':real)) (pi/ &2))/ &2 /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2 < (pi/ &2) /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h /\ (min (min (h:real) (h':real)) (pi/ &2))/ &2< h'`)
THEN ASM_REWRITE_TAC[PI_WORKS;]
THEN STRIP_TAC
THEN 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-> MRESAL1_TAC th`(min (min (h:real) (h':real)) (pi/ &2))/ &2`[SET_RULE`~(A={})<=> ?y. y IN A`])
THEN SUBGOAL_THEN`y IN
rw_dart_fan x V E1 (x,u,w,sigma_fan x V E1 u w)
(cos (min (min h h') (pi / &2) / &2))`
ASSUME_TAC
THENL[
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 FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)`
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `u:real^3`th)
THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th))
THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)`
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `u:real^3`th)
THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th))
THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan]
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;rw_dart_fan;w_dart_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN
MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN ASM_REWRITE_TAC[SET_RULE`~(v' IN {v, w}) <=> ~(v =v') /\ ~(v' = w)`]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[];
REMOVE_THEN"LINH"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y:real^3`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_THEN"LINH1"(fun th-> MRESA_TAC th[`(min (min (h:real) (h':real)) (pi/ &2))/ &2`;`y:real^3`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y:real^3`]
THEN POP_ASSUM MATCH_MP_TAC
THEN SET_TAC[]]);;
let INTERS_HALF_SPACE_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} =U1
==> U1 INTER aff_gt {x, v, w} {u} SUBSET dartset_leads_into_fan x V E1 ds2`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds2:real^3#real^3#real^3#real^3->bool`)
THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET]
THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER])
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 DISCH_THEN(LABEL_TAC"LINH")
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC)
THEN MP_TAC(SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}==> y =f10\/ y =f20\/ y =f30`)
THEN RESA_TAC
THENL[
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,w,v,u = f10:real^3#real^3#real^3#real^3`
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,v,u,w = f20:real^3#real^3#real^3#real^3`
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {v, u} IN E==> {v, u} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, v, u} {w}`)
THEN POP_ASSUM MATCH_MP_TAC
THEN SUBGOAL_THEN `x,v,u,sigma_fan x V E v u IN d1_fan (x,V,E)` ASSUME_TAC
THENL[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN ASM_REWRITE_TAC[];
MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,u,sigma_fan x V E v u):real^3#real^3#real^3#real^3`;][pr2;pr3]
THEN EXISTS_TAC`(x,v,u:real^3, sigma_fan x (V:real^3->bool) E v u)`
THEN ASM_REWRITE_TAC[f1_fan]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`)];
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3`
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {u,w} IN E==> {u,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`)
THEN RESA_TAC
THEN RESA_TAC
THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, u,w} {v}`)
THEN POP_ASSUM MATCH_MP_TAC
THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3`
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3
==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`)
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[pr2;pr3])
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[th;f1_fan])
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`]]]);;
let inverse1_sigma_fan_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> inverse1_sigma_fan x V E1 w v = inverse1_sigma_fan x V E w u`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MATCH_MP_TAC MONO_SIGMA_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E1:(real^3->bool)->bool`
THEN EXISTS_TAC`w:real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, w:real^3} IN E /\ E UNION {{v,w}}= E1
==> {inverse1_sigma_fan x V E w u, w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;`inverse1_sigma_fan x V E w u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC);;
let aff_gt_eq_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> aff_gt {x, w, inverse1_sigma_fan x V E1 w v} {v} = aff_gt {x, w, inverse1_sigma_fan x V E w u} {u}`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`{w:real^3,inverse1_sigma_fan x V E w u } IN E /\ E UNION {{v,w}}= E1
==> {w:real^3,inverse1_sigma_fan x V E w u} IN E1`)
THEN RESA_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN RESA_TAC
THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`v:real^3`;]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;`(v:real^3)`;`w: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 RESA_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`v :real^3`;]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x,V:real^3->bool,E)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN RESA_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 POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u :real^3`;]);;
let f2_EQ_F30_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ f30=(x,u,w,v)
/\ E UNION {{v,w}}= E1
==> f30= f2`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E)`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;pr2;pr3] THEN REPEAT STRIP_TAC THEN ASM_REWRITE_TAC[]));;
let CONDITION_DART_IN_NODE=prove(`!x V E f y y1. FAN (x,V,E)
/\(!v. v IN V ==> CARD (set_of_edge v V E) > 1)
/\ f IN (node_set (hypermap1_of_fanx (x,V,E)) )
/\ y IN f
/\ y1 IN d1_fan(x,V,E)
/\ pr2 y1= pr2 y
==> y1 IN f`,
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC node_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;]
THEN MP_TAC(SET_RULE`y IN f /\ f SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V,E)`)
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESAL_TAC rep_node_set_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`;`y:real^3#real^3#real^3#real^3`][pr2;pr3]
THEN RESA_TAC
THEN MRESA_TAC ORBITS_EQ_SET_EDGE_FAN[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (v:real^3)`;` (w':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 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 REWRITE_TAC[set_of_orbits_points_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN EXISTS_TAC`i:num`
THEN ASM_REWRITE_TAC[power_map_points ]
THEN ARITH_TAC);;
let INTERS_HALF_SPACE_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} =U1
==> U1 INTER aff_gt {x, v, w} {sigma_fan x V E v u} SUBSET dartset_leads_into_fan x V E1 ds1`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds1:real^3#real^3#real^3#real^3->bool`)
THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET]
THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER])
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 DISCH_THEN(LABEL_TAC"LINH")
THEN STRIP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC)
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`)
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM;pr2;pr3;f1_fan]
THEN RESA_TAC
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(ARITH_RULE`3 <= ( CARD (ds1:real^3#real^3#real^3#real^3->bool)):num
==> ~((CARD (ds1:real^3#real^3#real^3#real^3->bool)):num =0)`)
THEN RESA_TAC
THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`]
THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds1:real^3#real^3#real^3#real^3->bool)):num`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`]
THEN USE_THEN "LINH1" MP_TAC
THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;] THEN ASM_REWRITE_TAC[IN_ELIM_THM] THEN STRIP_TAC)`face (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1`
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w) IN d1_fan(x:real^3,V,E1)`ASSUME_TAC
THENL(*1*)[
ASM_REWRITE_TAC[face;d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v (w:real^3)`
THEN ASM_REWRITE_TAC[];(*1*)
MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`)
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN DISJ_CASES_TAC(SET_RULE`(v' IN {v,w:real^3}) \/ ~(v' IN {v,w})`)
THENL(*2*)[
POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`A IN {B,C}<=> A=B\/ A=C`]
THEN STRIP_TAC
THENL(*3*)[
MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESAL_TAC SRPRNPL[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;][simple_hypermap]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `(x,v,w,sigma_fan x V E1 v w:real^3)`)
THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`)
THEN RESA_TAC
THEN SUBGOAL_THEN`node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) IN
node_set (hypermap1_of_fanx (x,V:real^3->bool,E1))` ASSUME_TAC
THENL(*4*)[
ASM_REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits]
THEN EXISTS_TAC`(x,v,w,sigma_fan x V E1 v w:real^3)`
THEN ASM_REWRITE_TAC[node];(*4*)
SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN
node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3)`ASSUME_TAC
THENL(*5*)[
ASM_REWRITE_TAC[node;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;(*5*)
MRESAL_TAC CONDITION_DART_IN_NODE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`node (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,v,w,sigma_fan x V E1 v w)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][pr2]
THEN MP_TAC(SET_RULE`y IN
node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)/\
node (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) INTER
ds1 =
{(x,v,w,sigma_fan x V E1 v w)}
/\ y IN ds1==> y IN {(x,v,w,sigma_fan x V E1 v w)}
`)
THEN ASM_REWRITE_TAC[IN_SING;EQ_PAIR_4]
THEN STRIP_TAC
THEN REMOVE_THEN "YEU" MP_TAC
THEN ASM_REWRITE_TAC[POWER;I_DEF;EQ_PAIR_4]
THEN RESA_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]](*5*)](*4*);(*3*)
MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`v:real^3`)
THEN STRIP_TAC
THEN SUBGOAL_THEN`x,w,inverse1_sigma_fan x V E1 w v,v IN d1_fan (x,V,E1)`ASSUME_TAC
THENL(*4*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`inverse1_sigma_fan x V E1 w v:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*4*)
MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESAL_TAC SRPRNPL[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;][simple_hypermap]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `x,w,inverse1_sigma_fan x V E1 w v,v:real^3`)
THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3) =f1_fan x V E1 (x,v,w,sigma_fan x V E1 v w)` ASSUME_TAC
THENL(*5*)[
REWRITE_TAC[f1_fan];(*5*)
SUBGOAL_THEN`x:real^3,v,w,sigma_fan x V E1 v w IN ds1`ASSUME_TAC
THENL(*6*)[
FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1`
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;(*6*)
MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3`;]
THEN MP_TAC(SET_RULE`y IN ds1/\ ds1 SUBSET d1_fan (x,V,E1)==> y IN d1_fan (x,V:real^3->bool,E1)`)
THEN RESA_TAC
THEN SUBGOAL_THEN`node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v) IN
node_set (hypermap1_of_fanx (x,V:real^3->bool,E1))` ASSUME_TAC
THENL(*7*)[
ASM_REWRITE_TAC[node_set;IN_ELIM_THM;set_of_orbits]
THEN EXISTS_TAC`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)`
THEN ASM_REWRITE_TAC[node];(*7*)
SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v)IN
node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v:real^3)`ASSUME_TAC
THENL(*8*)[
ASM_REWRITE_TAC[node;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;(*8*)
MRESAL_TAC CONDITION_DART_IN_NODE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`node (hypermap1_of_fanx (x,V:real^3->bool,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v)`;`(x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][pr2]
THEN MP_TAC(SET_RULE`y IN
node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v)/\
node (hypermap1_of_fanx (x,V,E1)) (x,w,inverse1_sigma_fan x V E1 w v,v) INTER
ds1 =
{(x,w,inverse1_sigma_fan x V E1 w v,v)}
/\ y IN ds1==> y IN {(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)}
`)
THEN ASM_REWRITE_TAC[IN_SING;EQ_PAIR_4]
THEN STRIP_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN MRESA_TAC aff_gt_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th `aff_gt {x:real^3, w, inverse1_sigma_fan x V E w u} {u}`)
THEN POP_ASSUM MATCH_MP_TAC
THEN EXISTS_TAC`(x, w, inverse1_sigma_fan x V E w u,u:real^3)`
THEN REWRITE_TAC[pr2;pr3;f1_fan]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN SUBGOAL_THEN`x,w,inverse1_sigma_fan x V E w u,u= f1_fan x V E ((x,u,w,sigma_fan x V E u w):real^3#real^3#real^3#real^3)`
ASSUME_TAC
THENL(*9*)[REWRITE_TAC[f1_fan;EQ_PAIR_4];(*9*)
POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN MATCH_MP_TAC condition_f1_fan_in_face_set
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN EXISTS_TAC`(x,u,w,sigma_fan x V E u w:real^3)`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
](*9*)](*8*)](*7*)](*6*)](*5*)](*4*)](*3*);(*2*)
MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN FIND_ASSUM MP_TAC`{v', w':real^3} IN E1`
THEN FIND_ASSUM( fun th-> GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[SYM th;UNION;IN_ELIM_THM])`E UNION {{v, w:real^3}}=E1`
THEN STRIP_TAC
THENL(*3*)[
MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`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 "LINH"(fun th-> MRESA1_TAC th `aff_gt {x, v', w'} {sigma_fan x V E1 v' w':real^3}`)
THEN POP_ASSUM MATCH_MP_TAC
THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[pr2;pr3;f1_fan]
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`]
THEN DISJ_CASES_TAC(SET_RULE`~(x,v',w',sigma_fan x V E v' w' IN ds)\/ x,v',w',sigma_fan x V E v' w' IN (ds:real^3#real^3#real^3#real^3->bool)`)
THENL(*4*)[
SUBGOAL_THEN`~(ds = face (hypermap1_of_fanx (x,V,E)) (x,v',w',sigma_fan x V E v' w':real^3))`ASSUME_TAC
THENL(*5*)[
POP_ASSUM MP_TAC
THEN MATCH_MP_TAC MONO_NOT
THEN RESA_TAC
THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;(*5*)
ABBREV_TAC`ds0=face (hypermap1_of_fanx (x,V,E)) (x,v',w',sigma_fan x V E v' (w':real^3))`
THEN SUBGOAL_THEN`ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*6*)[
REWRITE_TAC[face_set; set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`(x,v',w':real^3,sigma_fan x V E v' w')`
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC "ds0"
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v':real^3`
THEN EXISTS_TAC`w':real^3`
THEN EXISTS_TAC`sigma_fan x V E v' w':real^3`
THEN ASM_REWRITE_TAC[];(*6*)
MRESAL_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(ds0:real^3#real^3#real^3#real^3->bool)`;][DELETE;IN_ELIM_THM]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC unique_tranf_fan
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
; `(face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool`
;`(ds1:real^3#real^3#real^3#real^3->bool)`
;`((x,v',w':real^3,sigma_fan x V E v' w'):real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MATCH_MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;tran]
THEN REMOVE_THEN "YEU" MP_TAC
THEN RESA_TAC
THEN REMOVE_THEN "LINH1" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(f1_fan x V E1 POWER k) (x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`][]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN EXPAND_TAC "ds0"
THEN POP_ASSUM(fun th-> REWRITE_TAC[th;face;IN_ELIM_THM;orbit_map])
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC](*6*)](*5*);(*4*)
ASM_REWRITE_TAC[]](*4*);(*3*)
POP_ASSUM MP_TAC
THEN REWRITE_TAC[IN_SING]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]]]]);;
let lemmaINTERS_HALF_SPACE_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}=U1
==> U1 INTER aff_gt {x, v, w} {u} SUBSET dartset_leads_into_fan x V E1 ds2`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[conforming_fan;conforming_half_space_fan]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds2:real^3#real^3#real^3#real^3->bool`)
THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET]
THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER])
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`] THEN ASSUME_TAC th THEN STRIP_TAC)
THEN MP_TAC(SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}==> y =f10\/ y =f20\/ y =f30`)
THEN RESA_TAC
THENL[
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,w,v,u = f10:real^3#real^3#real^3#real^3`
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,v,u,w = f20:real^3#real^3#real^3#real^3`
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {v, u} IN E==> {v, u} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`u:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`)
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]);
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2;pr3;f1_fan])`x,u,w,v = f30:real^3#real^3#real^3#real^3`
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 /\ {u,w} IN E==> {u,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`)
THEN RESA_TAC
THEN RESA_TAC]);;
let lemmaINTERS_HALF_SPACE_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}=U1
==> U1 INTER aff_gt {x, v, w} {sigma_fan x V E v u} SUBSET dartset_leads_into_fan x V E1 ds1`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN "EM"(fun th-> REWRITE_TAC[SYM th;INTERS;IN_ELIM_THM;INTER;SUBSET])
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u: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 sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u,v} IN E ==> { sigma_fan x V E v u,v} IN E1`)
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`w:real^3`])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;` v:real^3`;` w:real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` x' IN aff_gt {x, sigma_fan x V E v u,v} {w} /\
x' IN aff_gt {x, w, sigma_fan x V E v u} {v}
/\ x' IN aff_gt {x, v, w} {sigma_fan x V E v u}
/\ aff_gt {x, sigma_fan x V E v u, v} {w} INTER
aff_gt {x, v, w} {sigma_fan x V E v u} INTER
aff_gt {x, w, sigma_fan x V E v u} {v} SUBSET
dart_leads_into x V E1 v w
==> (x':real^3) IN dart_leads_into x V E1 v w`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN SUBGOAL_THEN`(x,v,w:real^3,sigma_fan x V E v u:real^3) IN ds1` ASSUME_TAC
THENL[
FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1`
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;
MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;
`ds1:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`[pr2;pr3])]);;
let aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1=prove(`!a x y z w:real^3.
azim a x y z < pi
/\ &0< azim a x y z
/\ azim a x y w < pi
/\ &0< azim a x y w
/\ DISJOINT {a, x} {w}
/\ ~collinear {a, x, w}
/\ ~coplanar {a, x, y, z}
==> aff_gt {a,x,y}{z} INTER aff{a,x,w} SUBSET aff_gt {a,x} {w}`,
REPEAT STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`]
THEN RESA_TAC THEN ASSUME_TAC th)
THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`a:real^3`;`x:real^3`;`z:real^3`;`y:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`z:real^3`;`y:real^3`]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`]
THEN REWRITE_TAC[AFFINE_HULL_3;aff;INTER;SUBSET;IN_ELIM_THM]
THEN MRESAL_TAC AFF_GT_2_1[`a:real^3`;`x:real^3`;`w:real^3`][IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EXISTS_TAC`u:real`
THEN EXISTS_TAC`v:real`
THEN EXISTS_TAC`w':real`
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[th])
THEN REWRITE_TAC[VECTOR_ARITH`(u % a + v % x + w' % w) - a= v % (x-a) + w' % (w-a) +((u+v +w')- &1)% a`]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th;VECTOR_ARITH`v % (x - a) + w' % (w - a) + (&1 - &1) % a=v % (x - a) + w' % (w - a)`;])
THEN REWRITE_TAC[DOT_RADD;DOT_RMUL;DOT_CROSS_SELF;REAL_ARITH`v * &0 +A=A`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`w:real^3`;`y:real^3`]
THEN STRIP_TAC
THEN MRESA_TAC REAL_LT_LCANCEL_IMP[`((x - a) cross (y - a)) dot (w - a:real^3)`;`&0`;`w':real`]
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC);;
let aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14=prove(`!a x y z:real^3.
~coplanar {a, x, y, z}
==> aff_gt {a,x,y}{z} INTER aff{a,x,z} SUBSET aff_gt {a,x} {z}`,
REPEAT STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`]
THEN RESA_TAC THEN ASSUME_TAC th)
THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`a:real^3`;`x:real^3`;`z:real^3`;`y:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`a:real^3`; `x:real^3`;`z:real^3`;`y:real^3`]
THEN REWRITE_TAC[AFFINE_HULL_3;aff;INTER;SUBSET;IN_ELIM_THM]
THEN MRESA_TAC notcoplanar_disjoint[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`]
THEN MRESA_TAC notcoplanar_disjoints[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`]
THEN MP_TAC(SET_RULE`~(a=z) /\ ~(x=z:real^3)==>DISJOINT {a, x} {z}`)
THEN RESA_TAC
THEN MRESAL_TAC AFF_GT_2_1[`a:real^3`;`x:real^3`;`z:real^3`][IN_ELIM_THM]
THEN MRESAL_TAC AFF_GT_3_1[`a:real^3`;`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EXISTS_TAC`u:real`
THEN EXISTS_TAC`v:real`
THEN EXISTS_TAC`w:real`
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th] THEN MP_TAC th)
THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % a + t2 % x + t3 % y + t4 % z = u % a + v % x + w % z
<=> ((u+v+w)-(t1+t2+t3+t4))%a+(w-t4)%(z-a)= t3%(y-a)+(t2-v)%(x-a)`;VECTOR_ARITH`(&1 - &1) % a +A=A`]
THEN DISJ_CASES_TAC(REAL_ARITH`~(w-t4= &0)\/ w=t4:real`)
THENL[
STRIP_TAC
THEN MP_TAC(SET_RULE`(w - t4) % (z - a:real^3) = t3 % (y - a) + (t2 - v) % (x - a)
==> (inv (w-t4))%((w - t4) % (z - a)) =(inv (w-t4))%( t3 % (y - a) + (t2 - v) % (x - a))`)
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th])
THEN MRESA1_TAC REAL_MUL_LINV `w-t4:real`
THEN ASM_REWRITE_TAC[VECTOR_ARITH`A%B%C=(A*B)%C`;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
THEN STRIP_TAC
THEN FIND_ASSUM MP_TAC`~(coplanar{a, x, y, z:real^3})`
THEN REWRITE_TAC[COPLANAR_DET_EQ_0]
THEN ASM_REWRITE_TAC[DET_3;VECTOR_3;VECTOR_ADD_COMPONENT;VECTOR_MUL_COMPONENT]
THEN REAL_ARITH_TAC;
ASM_REWRITE_TAC[]]);;
let lemmaINTERS_HALF_SPACE_DS_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}
==> U1 INTER aff {x,v,w} SUBSET aff_gt {x} {v, w} `,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`)
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`])
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(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) `;` (u:real^3)`;
`v:real^3`]
THEN MRESA_TAC sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN STRIP_TAC
THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`u: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,D,C,B}`]
THEN STRIP_TAC
THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`]
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`]
THEN SET_TAC[]);;
let aff_3_rep_cross_dot=prove(`!x:real^3 v:real^3 u:real^3.
~collinear {x,v,u}
==> aff {x,v,u} ={y:real^3| (((v-x) cross (u-x)) dot (y-x)) = &0}`,
REWRITE_TAC[AFFINE_HULL_3;aff;IN_ELIM_THM;EXTENSION]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THENL[
STRIP_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`(u' % x + v' % v + w % u) - x= ((u'+v'+w)- &1)%x + v'%(v-x)+ w%(u-x)`
;VECTOR_ARITH`(&1- &1)%X+A=A`;DOT_RADD;DOT_RMUL;DOT_CROSS_SELF]
THEN REAL_ARITH_TAC;
DISCH_THEN(LABEL_TAC"ME")
THEN MP_TAC(ISPECL[`x:real^3`;`v:real^3`;`u:real^3`]properties_coordinate) THEN RESA_TAC
THEN MRESA_TAC ORTHONORMAL_IMP_SPANNING[`e1_fan (x:real^3) (v:real^3) (u:real^3)`;`e2_fan (x:real^3)( v:real^3) (u:real^3)`;`e3_fan (x:real^3) (v:real^3) (u:real^3)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[SPAN_3;EXTENSION]
THEN DISCH_TAC THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(x':real^3)-(x:real^3)`th) THEN ASSUME_TAC(th))
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(u:real^3)-(x:real^3)`th)THEN ASSUME_TAC(th))
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC`(v:real^3)-(x:real^3)`th))
THEN REWRITE_TAC[SET_RULE`(x:real^3) IN (:real^3)`;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN ABBREV_TAC`e1=e1_fan x v u:real^3`
THEN ABBREV_TAC`e2=e2_fan x v u:real^3`
THEN ABBREV_TAC`e3=e3_fan x v u:real^3`
THEN ONCE_REWRITE_TAC[VECTOR_ARITH`x' = u' % x + v' % v + w % u <=> x'-x = ((u'+v'+w)- &1)%x+ v'%(v-x)+ w%(u-x)`]
THEN MRESA_TAC ORTHONORMAL_CROSS[`e1:real^3`;`e2:real^3`;`e3:real^3`;]
THEN REMOVE_THEN "ME" MP_TAC
THEN ASM_REWRITE_TAC[CROSS_LMUL;CROSS_RMUL;CROSS_LADD;CROSS_RADD;CROSS_REFL;]
THEN REDUCE_VECTOR_TAC
THEN ONCE_REWRITE_TAC[CROSS_SKEW]
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG]
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM MP_TAC`orthonormal e1 e2 (e3:real^3)`
THEN REWRITE_TAC[orthonormal]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[DOT_SYM]
THEN ASM_REWRITE_TAC[]
THEN REDUCE_ARITH_TAC
THEN FIND_ASSUM MP_TAC`(v - x) dot (e2:real^3) = &0:real`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3`
THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[DOT_SYM]
THEN ASM_REWRITE_TAC[]
THEN REDUCE_ARITH_TAC
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`(u - x) dot (e2:real^3) = &0:real`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`u - x = u'' % e1 + v'' % e2 + w' % e3:real^3`
THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[DOT_SYM]
THEN ASM_REWRITE_TAC[]
THEN REDUCE_ARITH_TAC
THEN RESA_TAC
THEN REDUCE_ARITH_TAC
THEN FIND_ASSUM MP_TAC`(v - x) dot (e1:real^3) = &0:real`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3`
THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[DOT_SYM]
THEN ASM_REWRITE_TAC[]
THEN REDUCE_ARITH_TAC
THEN RESA_TAC
THEN REWRITE_TAC[REAL_ARITH`u' * w' * --v''' + w * u'' * v''' = (w * u''-u' * w') * v''':real `]
THEN REDUCE_ARITH_TAC
THEN FIND_ASSUM MP_TAC`&0 < (u - x) dot (e1:real^3)`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`u - x = u'' % e1 + v'' % e2 + w' % e3:real^3`
THEN REWRITE_TAC[DOT_LADD;DOT_RADD;DOT_LMUL;DOT_RMUL;DOT_LNEG]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[DOT_SYM]
THEN ASM_REWRITE_TAC[]
THEN REDUCE_ARITH_TAC
THEN RESA_TAC
THEN REDUCE_ARITH_TAC
THEN FIND_ASSUM MP_TAC`dist (v,x) % e3 = v - x :real^3`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`v - x = u' % e1 + v' % e2 + w % e3:real^3`
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN STRIP_TAC
THEN REDUCE_VECTOR_TAC
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`dist (v,x:real^3) % e3 = w % (e3:real^3) ==> dist (v,x) % e3 dot e3 = w % e3 dot e3`)
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_LMUL]
THEN ASM_REWRITE_TAC[]
THEN REDUCE_ARITH_TAC
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th;dist])
THEN MRESA_TAC collinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;]
THEN MP_TAC(ISPECL[`v:real^3`;`x:real^3`]imp_norm_not_zero_fan)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`&0 < u''==> ~(u''= &0)`)
THEN RESA_TAC
THEN ASM_REWRITE_TAC[REAL_ENTIRE]
THEN RESA_TAC
THEN MP_TAC(ISPEC`(norm(v-x:real^3))`REAL_MUL_LINV)
THEN RESA_TAC
THEN MP_TAC(ISPEC`u'':real`REAL_MUL_LINV)
THEN RESA_TAC
THEN REDUCE_VECTOR_TAC
THEN EXISTS_TAC`&1- (w''-u''' * inv(u'':real) * w') * inv(norm(v-x:real^3))- u''' * inv(u'':real)`
THEN EXISTS_TAC`(w''-u''' * inv(u'':real) * w') * inv(norm(v-x:real^3))`
THEN EXISTS_TAC`u''' * inv(u'':real)`
THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - (w'' - u''' * inv u'' * w') * inv (norm (v - x)) - u''' * inv u'' +
(w'' - u''' * inv u'' * w') * inv (norm (v - x)) +
u''' * inv u'' =
&1`;VECTOR_ARITH`(&1- &1) %A+B+C=B+C`;VECTOR_ARITH`A%(B+C)=A %B+ A%C`;VECTOR_ARITH`A %B %C=(A*B)%C`
;REAL_ARITH`(A*B)*C=A*(B*C)`]
THEN VECTOR_ARITH_TAC]);;
let SPACE3_EQ_UNION_3SET=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> aff {x,v,w} UNION aff_gt {x, v, w} {sigma_fan x V E v u} UNION aff_gt {x, v, w} {u}= (:real^3) `,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`)
THEN RESA_TAC
THEN POP_ASSUM (fun th-> MP_TAC th
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC THEN ASSUME_TAC th)
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`v:real^3`])
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`u: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,d,b,c}`]
THEN STRIP_TAC
THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `w:real^3`;`u:real^3`;`v:real^3`]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`]
THEN ONCE_REWRITE_TAC[CROSS_SKEW]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`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 sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v: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 MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v u`;`w:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{a,b,c,d}={a,b,d,c}`]
THEN RESA_TAC
THEN MRESA_TAC aff_3_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`]
THEN REWRITE_TAC[UNION;IN_ELIM_THM;EXTENSION;DOT_LNEG]
THEN GEN_TAC
THEN EQ_TAC
THENL[SET_TAC[];
REAL_ARITH_TAC]);;
let lemmaU1_subset_U=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}
/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}
==> U1 SUBSET U `,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`]
THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`]
THEN MRESA_TAC lemmaINTERS_HALF_SPACE_DS_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`]
THEN MRESA_TAC SPACE3_EQ_UNION_3SET
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN ASM_TAC
THEN SET_TAC[]);;
let open_subsetU=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ U=aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}
==> open U`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MATCH_MP_TAC OPEN_INTER
THEN STRIP_TAC
THENL[
MATCH_MP_TAC OPEN_AFF_GT_3_1
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`u: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 ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`]
THEN ASM_REWRITE_TAC[];
MATCH_MP_TAC OPEN_INTER
THEN STRIP_TAC
THENL[
MATCH_MP_TAC OPEN_AFF_GT_3_1
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> 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 sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,B,D}`]
THEN ASM_REWRITE_TAC[];
MATCH_MP_TAC OPEN_INTER
THEN STRIP_TAC
THENL[ MATCH_MP_TAC OPEN_AFF_GT_3_1
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`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 sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`]
THEN ASM_REWRITE_TAC[];
MATCH_MP_TAC OPEN_AFF_GT_3_1
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> { v,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`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 sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {sigma_fan x V E v u, v} IN E ==> {sigma_fan x V E v u, v} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`w:real^3`]]]]);;
let eq_aff_gt_3_fanadd_edge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> aff_gt {x, v, u} {sigma_fan x V E v u}= aff_gt {x, v, u} {w}`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> 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 sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)` ;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E v u:real^3`;`u:real^3`]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`)
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`v:real^3`;`u:real^3`])
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,w} IN E1`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)` ;`sigma_fan x V E1 v u:real^3`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC notcoplanar_imp_notcollinear_fan[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E1 v u`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`; `v:real^3`;`sigma_fan x V E1 v u:real^3`;`u:real^3`]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_TAC[]);;
let aff_gt_add_subset_U1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}
==> aff_gt {x} {v,w} SUBSET U1 `,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> { v,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(v:real^3)`]
THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`]
THEN MRESA_TAC eq_aff_gt_3_fanadd_edge[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,w:real^3}`;`{x,u,w:real^3}`;`{v:real^3}`][SET_RULE`{x, w} SUBSET {x, u, w:real^3}`]
THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,v:real^3}`;`{x,v,u:real^3}`;`{w:real^3}`][SET_RULE`{x, v} SUBSET {x, v, u:real^3}`]
THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,v:real^3}`;`{x,v,sigma_fan x V E v u:real^3}`;`{w:real^3}`][SET_RULE`{x, v} SUBSET {x, v, sigma_fan x V E v u:real^3}`]
THEN MRESAL_TAC AFF_GT_MONO_LEFT[`{x,w:real^3}`;`{x,sigma_fan x V E v u,w:real^3}`;`{v:real^3}`][SET_RULE`{x, w} SUBSET {x, sigma_fan x V E v u, w:real^3}`]
THEN ASM_TAC
THEN SET_TAC[]);;
let lemma_rep_U_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ U1= aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v}
==> U= U1 UNION dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC aff_gt_add_subset_U1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`]
THEN MRESA_TAC lemmaU1_subset_U[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`;`U1:real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]);;
let dartset_leads_into_ds_open_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U
==> open U `,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC lemma_rep_U_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`;`aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v:real^3}`]
THEN MATCH_MP_TAC OPEN_UNION
THEN MRESA_TAC open_subsetU[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`aff_gt {x, u, w} {v } INTER aff_gt {x, v,u} {sigma_fan x V E v u } INTER aff_gt {x, v, sigma_fan x V E v u } {w} INTER aff_gt {x, sigma_fan x V E v u,w} {v:real^3}`]
THEN MATCH_MP_TAC OPEN_UNION
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E1 ds1`]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E1 ds2`]);;
let U_INTER_U2_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}
==>
U INTER
UNIONS
(topological_component_yfan (x,V,E1) DELETE
dartset_leads_into_fan x V E1 ds1 DELETE
dartset_leads_into_fan x V E1 ds2) = {}`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN ONCE_REWRITE_TAC[EXTENSION;]
THEN REWRITE_TAC[UNIONS;INTER;IN_ELIM_THM;UNION;DELETE]
THEN GEN_TAC
THEN EQ_TAC
THENL[
REPEAT STRIP_TAC
THENL[
MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`]
THEN FIND_ASSUM MP_TAC`u' IN topological_component_yfan (x:real^3,V,E1)`
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th))
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`x':real^3`]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1: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 POP_ASSUM(fun th-> ASSUME_TAC(SYM th))
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`x':real^3`];
MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`]
THEN FIND_ASSUM MP_TAC`u' IN topological_component_yfan (x:real^3,V,E1)`
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASSUME_TAC(SYM th))
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`x':real^3`]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2: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 POP_ASSUM(fun th-> ASSUME_TAC(SYM th))
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`x':real^3`];
MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u':real^3->bool`]
THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` f:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
` (v:real^3)`]
THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`]
THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w}
==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`)
THEN RESA_TAC
THEN MP_TAC(SET_RULE` x' IN aff_gt {x} {v, w}/\ u' SUBSET yfan (x,V,E1) /\ x' IN u'==> ~(aff_gt {x} {v, w} INTER yfan(x,V:real^3->bool,E1)={})`)
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan]
THEN SET_TAC[]];
SET_TAC[]]);;
let dartset_leads_into_fan_SUBSET_U=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U
==> dartset_leads_into_fan x V E ds SUBSET U
`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM]
THEN REWRITE_TAC[GSYM UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN]
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN]
THEN DISCH_THEN(LABEL_TAC"MA")
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN SUBGOAL_THEN`yfan (x,V,E) =
UNIONS ((topological_component_yfan (x,V,E1) DELETE (dartset_leads_into_fan x V E1 ds1))DELETE (dartset_leads_into_fan x V E1 ds2)) UNION (dartset_leads_into_fan x V E1 ds2) UNION (dartset_leads_into_fan x V E1 ds1) UNION aff_gt {x} {v, w}`
ASSUME_TAC
THENL(*1*)[
ASM_REWRITE_TAC[UNIONS;DELETE;UNION;IN_ELIM_THM]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[];(*1*)
POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`A UNION B UNION C UNION D=A UNION (C UNION B UNION D)`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"LINH"))
THEN REMOVE_THEN"MA"(fun th-> MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"MA"))
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 ASM_REWRITE_TAC[topological_component_yfan;IN_ELIM_THM]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
` (v:real^3)`]
THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
THEN REWRITE_TAC[SUBSET]
THEN GEN_TAC
THEN MRESA_TAC dartset_leads_into_fanadd2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE`y' IN aff_gt {x} {v, w:real^3} /\ aff_gt {x} {v, w} SUBSET connected_component (yfan (x,V:real^3->bool,E)) y==> y' IN connected_component (yfan (x,V,E)) y`)
THEN RESA_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan (x,V:real^3->bool,E)`;`y:real^3`;`y':real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_SUBSET[`yfan (x,V:real^3->bool,E)`;`y':real^3`]
THEN MP_TAC(SET_RULE`connected_component (yfan (x,V,E)) y' SUBSET yfan (x,V,E)/\ x' IN connected_component (yfan (x,V,E)) y'
==> x' IN yfan (x,V:real^3->bool,E)`)
THEN ASM_REWRITE_TAC[]
THEN REMOVE_THEN "MA"(fun th-> REWRITE_TAC[SYM th]
THEN REMOVE_THEN "LINH"(fun th-> REWRITE_TAC[SYM th;UNION;IN_ELIM_THM]))
THEN STRIP_TAC
THEN SUBGOAL_THEN`?e1 e2.
open e1 /\
open e2 /\
(connected_component (yfan (x,V,E)) y') SUBSET e1 UNION e2 /\
e1 INTER e2 INTER (connected_component (yfan (x,V:real^3->bool,E)) y') = {} /\
~(e1 INTER (connected_component (yfan (x,V,E)) y') = {}) /\
~(e2 INTER (connected_component (yfan (x,V,E)) y') = {})` ASSUME_TAC
THENL(*2*)[
MRESA_TAC dartset_leads_into_ds_open_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`]
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN EXISTS_TAC`U:real^3->bool`
THEN EXISTS_TAC`UNIONS
(topological_component_yfan (x,V:real^3->bool,E1) DELETE
dartset_leads_into_fan x V E1 ds1 DELETE
dartset_leads_into_fan x V E1 ds2)`
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THENL(*3*)[
MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;
`dartset_leads_into_fan x V E1 ds1:real^3->bool`]
THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;
`dartset_leads_into_fan x V E1 ds2:real^3->bool`]
THEN MATCH_MP_TAC OPEN_UNIONS
THEN REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;
`s:real^3->bool`];
STRIP_TAC
THENL(*4*)[
MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN POP_ASSUM( fun th-> REMOVE_THEN "EM" (fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC THEN REWRITE_TAC[th])
THEN SET_TAC[];
STRIP_TAC
THENL(*5*)[
MRESA_TAC U_INTER_U2_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[];(*5*)
MP_TAC(SET_RULE`y' IN aff_gt {x} {v, w} /\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w:real^3}=U
==> y' IN U
`)
THEN RESA_TAC
THEN SUBGOAL_THEN`y' IN connected_component (yfan (x,V:real^3->bool,E)) y'`ASSUME_TAC
THENL(*6*)[
REWRITE_TAC[IN]
THEN MATCH_MP_TAC CONNECTED_COMPONENT_REFL
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC condition_aff_gt_subset_yfan[`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 SET_TAC[];(*6*)
MP_TAC(SET_RULE`y' IN U /\ y' IN connected_component (yfan (x,V:real^3->bool,E)) y'==> ~(U INTER connected_component (yfan (x,V,E)) y' = {})`)
THEN RESA_TAC
THEN ASM_TAC
THEN SET_TAC[]]]]];(*2*)
MRESA_TAC CONNECTED_CONNECTED_COMPONENT[`yfan(x,V:real^3->bool,E)`;`y':real^3`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[connected]]]);;
let rep_dartset_leads_into_fan_ds=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U
==> dartset_leads_into_fan x V E ds =U
`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_fan_SUBSET_U[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`]
THEN MRESA_TAC dartset_leads_into_fanadd2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_fanadd1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
THEN ASM_TAC
THEN SET_TAC[]);;
let u_in_topological_component_yfanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN (x,V,E1) /\
(!v. v IN V ==> CARD (set_of_edge v V E1) > 1) /\
fan80 (x,V,E1) /\
N_FAN (x,V,E1) < N_FAN (x,V,E)
==> conforming_fan (x,V,E1))
/\ dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}=U
==> U IN topological_component_yfan (x,V,E)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U:real^3->bool`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
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`]);;
let dartset_leads_into_fan_eq_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) = dartset_leads_into_fan x V E ds0`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"MAT")
THEN STRIP_TAC
THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;
`ds0: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 MP_TAC(SET_RULE`ds0 SUBSET d1_fan (x,V,E) /\ y IN ds0==> y IN d1_fan ((x:real^3),V,E)`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[d1_fan;IN_ELIM_THM] THEN STRIP_TAC THEN POP_ASSUM (fun th-> MP_TAC (SYM th))
THEN DISCH_THEN(LABEL_TAC"NHO") THEN ASSUME_TAC th)
THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)) IN face_set (hypermap1_of_fanx (x:real^3,V,E1))` ASSUME_TAC
THENL(*1*)[
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;face]
THEN EXISTS_TAC`(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`
THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[tran;d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v':real^3`
THEN EXISTS_TAC`w':real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3`
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(SET_RULE`{v', w'} IN E/\ E UNION {{v, w:real^3}} = E1==> {v', w'} IN E1`)
THEN ASM_REWRITE_TAC[];(*1*)
SUBGOAL_THEN`tran x V E1 y IN face (hypermap1_of_fanx (x,V,E1)) (tran x V E1 (y:real^3#real^3#real^3#real^3))`
ASSUME_TAC
THENL(*2*)[
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;(*2*)
MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;
`face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th `(tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3))`)
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"NHOEM")
THEN REMOVE_THEN "NHO"(fun th-> REWRITE_TAC[SYM th;tran;pr2;pr3] THEN MP_TAC th THEN DISCH_THEN(LABEL_TAC"LINH"))
THEN MP_TAC(SET_RULE`{v', w'} IN E/\ E UNION {{v, w:real^3}} = E1==> {v', w'} IN E1`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"NHO")
THEN MRESA_TAC DART_LEADS_INTO [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v':real^3`;`w':real^3`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"NHO1")
THEN MATCH_MP_TAC unique_dart_leads_into
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(REAL_ARITH`&0 &0< min (h:real) (h':real)`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN EXISTS_TAC`min (h:real) (h':real)`
THEN ASM_REWRITE_TAC[]
THEN DISJ_CASES_TAC(SET_RULE`((y:real^3#real^3#real^3#real^3) IN ds)\/ ~(y IN ds)`)
THENL(*3*)[
MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN MRESA_TAC lemma_face_representation[`hypermap1_of_fanx(x:real^3,V,E)`;`ds0:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th; DELETE;IN_ELIM_THM] );(*3*)
REPEAT GEN_TAC THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC(REAL_ARITH`s < min h h'==> s < h' /\ s < h `)
THEN ASM_REWRITE_TAC[] THEN 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 FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E1) > 1)`
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th)
THEN REMOVE_ASSUM_TAC THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th))
THEN FIND_ASSUM MP_TAC`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)`
THEN DISCH_TAC
THEN POP_ASSUM(fun th-> MP_TAC(ISPEC `v':real^3`th)
THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN STRIP_TAC THEN ASSUME_TAC th))
THEN ASM_REWRITE_TAC[rw_dart_fan;w_dart_fan]
THEN MRESA_TAC INVARANT_SIGMA_FAN_ADD
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN"NHOEM" MP_TAC
THEN REMOVE_THEN "LINH"(fun th-> REWRITE_TAC[SYM th;pr2;pr3;tran] THEN MP_TAC (th) THEN DISCH_THEN(LABEL_TAC"LINH"))
THEN DISCH_THEN(LABEL_TAC"NHOEM")
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN REMOVE_THEN "NHO"(fun th-> MRESAL_TAC th[`s:real`;`y':real^3`][rw_dart_fan;w_dart_fan])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH"))
THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"NHOLINH")
THEN ASSUME_TAC(SET_RULE`yfan (x:real^3,(V:real^3->bool),E1) SUBSET yfan (x,V,E1) UNION aff_gt {x} {v, w}`)
THEN MRESA_TAC CONNECTED_COMPONENT_MONO[`yfan (x:real^3,(V:real^3->bool),E1)`;`(yfan (x:real^3,(V:real^3->bool),E1) UNION aff_gt {x} {v:real^3, w})`;`y':real^3`]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEULINH")
THEN REWRITE_TAC[EXTENSION]
THEN GEN_TAC
THEN EQ_TAC
THENL(*4*)[
POP_ASSUM MP_TAC
THEN SET_TAC[];(*4*)
GEN_REWRITE_TAC(LAND_CONV o DEPTH_CONV)[IN;connected_component ]
THEN STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE(`(t INTER aff_gt {x} {v:real^3, w}={}) \/ ~(t INTER aff_gt {x} {v, w}={})`))
THENL(*5*)[
MP_TAC(SET_RULE`t SUBSET yfan (x,V,E1) UNION aff_gt {x} {v, w}/\ t INTER aff_gt {x} {v, w} = {}
==> t SUBSET yfan (x,V:real^3->bool,E1)`)
THEN ASM_REWRITE_TAC[IN;connected_component ]
THEN STRIP_TAC
THEN EXISTS_TAC`t:real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN SET_TAC[IN];(*5*)
POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`~(A={})<=> ?z. z IN A`;INTER;IN_ELIM_THM]
THEN STRIP_TAC
THEN SUBGOAL_THEN`z IN connected_component (yfan (x,V:real^3->bool,E1) UNION aff_gt {x} {v, w}) y'`
ASSUME_TAC
THENL(*6*)[
ASM_REWRITE_TAC[IN;connected_component ]
THEN EXISTS_TAC`t:real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN SET_TAC[IN];(*6*)
MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET dartset_leads_into_fan x V E ds /\ z IN aff_gt {x} {v, w}
==> z IN dartset_leads_into_fan x (V:real^3->bool) E ds`)
THEN ASM_REWRITE_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 POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`z IN connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y''
/\ z IN connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y'
==> ~(connected_component (yfan (x,V,E1) UNION aff_gt {x} {v, w}) y' INTER connected_component (yfan (x,V:real^3->bool,E1) UNION aff_gt {x} {v, w}) y''={})`)
THEN ASM_REWRITE_TAC[CONNECTED_COMPONENT_OVERLAP]
THEN STRIP_TAC
THEN REMOVE_THEN"YEULINH" MP_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_THEN"NHOLINH" (fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_THEN"EM" (fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_THEN"BELINH" (fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN REMOVE_THEN "NHO1"(fun th-> MRESAL_TAC th[`s:real`;`y':real^3`][rw_dart_fan;w_dart_fan])
THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN MP_TAC(th) THEN DISCH_THEN(LABEL_TAC"BELINH"))
THEN REMOVE_THEN "NHOEM"(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH12"))
THEN REMOVE_THEN "MAT" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN REMOVE_THEN "LINH"(fun th-> ASM_REWRITE_TAC[SYM th;tran])
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN MP_TAC(SYM th) THEN DISCH_THEN(LABEL_TAC"BELINH123"))
THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION
dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION
aff_gt {x} {v, w}:real^3->bool`]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
` (v:real^3)`]
THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`]
THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w}
==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`)
THEN RESA_TAC
THEN MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(ds0:real^3#real^3#real^3#real^3->bool)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET xfan (x,V,E1)
/\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET (:real^3) DIFF xfan (x,V,E1) /\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET
dartset_leads_into_fan x V E1 ds1 UNION
dartset_leads_into_fan x V E1 ds2 UNION
aff_gt {x} {v, w}
==> dartset_leads_into_fan x V E1 (tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)) SUBSET
dartset_leads_into_fan x V E1 ds1 UNION
dartset_leads_into_fan x V E1 ds2`)
THEN RESA_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0: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 SUBGOAL_THEN`y''' IN dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`
ASSUME_TAC
THENL(*7*)[
ASM_REWRITE_TAC[IN]
THEN MATCH_MP_TAC CONNECTED_COMPONENT_REFL
THEN ASM_REWRITE_TAC[];(*7*)
MP_TAC(SET_RULE`y''' IN dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))
/\ dartset_leads_into_fan x V E1 (tranf x V E E1 ds0) SUBSET
dartset_leads_into_fan x V E1 ds1 UNION
dartset_leads_into_fan x V E1 ds2
==> y''' IN dartset_leads_into_fan x V E1 ds1\/ y''' IN dartset_leads_into_fan x V E1 ds2`)
THEN RESA_TAC
THENL(*8*)[
POP_ASSUM MP_TAC
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`(ds1:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y'''':real^3`;`y''':real^3`]
THEN POP_ASSUM MP_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 POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REPEAT STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`]
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`)
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds1:real^3#real^3#real^3#real^3->bool)`
THEN MRESA1_TAC th`(tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[];(*8*)
POP_ASSUM MP_TAC
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`(ds2:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y'''':real^3`;`y''':real^3`]
THEN POP_ASSUM MP_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 POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REPEAT STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool)`]
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V (E1:(real^3->bool)->bool) (tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`)
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds2:real^3#real^3#real^3#real^3->bool)`
THEN MRESA1_TAC th`(tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (ds0:real^3#real^3#real^3#real^3->bool))`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[]]]]]]]]]);;
let conforming_bijection_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ ds IN face_set(hypermap1_of_fanx (x,V,E)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==>
!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\
s = dartset_leads_into_fan x V E f)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN REWRITE_TAC[EXISTS_UNIQUE]
THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`s:real^3->bool`]
THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN REPEAT STRIP_TAC
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE]
THEN REPEAT STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN DISJ_CASES_TAC(SET_RULE`~(ds=y)\/ (y=ds:real^3#real^3#real^3#real^3->bool)`)
THENL[
MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3->bool)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool)`]
THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`)
THENL[
MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(f:real^3#real^3#real^3#real^3->bool)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`]
THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V E1 (tranf x V (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool))`)
THEN POP_ASSUM (fun th-> MRESA1_TAC th`(tranf x V (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool))` THEN MRESA1_TAC th`(tranf x V (E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool))`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESAL_TAC INJ_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3->bool)`;`(f:real^3#real^3#real^3#real^3->bool)`][DELETE;IN_ELIM_THM];
REMOVE_THEN "LINH1" MP_TAC
THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
` (v:real^3)`]
THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`]
THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w}
==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`)
THEN RESA_TAC
THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (y:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]];
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`)
THENL[
MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(f:real^3#real^3#real^3#real^3->bool)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`tranf x (V:real^3->bool) (E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`]
THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN ASM_REWRITE_TAC[] THEN STRIP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
` (v:real^3)`]
THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`]
THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w}
==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`)
THEN RESA_TAC
THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC exists_in_aff_gt_disjoint[`x:real^3`;`v:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[];
ASM_REWRITE_TAC[]]]);;
let RADIAL_AFF_GT_1_2 = prove(`!x u v r.
(DISJOINT {(x:real^B)} {u,v} /\ (r > &0) ) ==>
radial_norm r x (aff_gt {x} {u,v} INTER normball x r)`,
REWRITE_TAC[radial_norm]
THEN REPEAT STRIP_TAC
THENL[SET_TAC[];
UNDISCH_TAC `(x:real^B) + u' IN aff_gt {x} {u, v} INTER normball x r`
THEN ASM_SIMP_TAC[AFF_GT_1_2]
THEN REWRITE_TAC[IN_ELIM_THM;IN_INTER]
THEN REPEAT STRIP_TAC
THENL[
EXISTS_TAC `&1 + (t:real) * t1 - t`
THEN EXISTS_TAC `(t:real) * t2`
THEN EXISTS_TAC `(t:real) * t3`
THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 + t * t1 - t) + t * t2 + t * t3 = &1 + t * (t1 + t2 +t3)-t `; REAL_ARITH`&1 + t * &1 - t = &1`;VECTOR_ARITH`(&1 + t * t1 - t) % x + (t * t2) % u + (t * t3) % v=x + t % (t1 % x + t2 % u + t3 % v) - t %x`;]
THEN MP_TAC(REAL_ARITH`t> &0 ==> &0< t`) THEN RESA_TAC
THEN SUBGOAL_THEN `&0 < t * t2 /\ &0 < t * t3` (fun t -> REWRITE_TAC[t])
THENL[ ASM_MESON_TAC[REAL_LT_MUL];REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN VECTOR_ARITH_TAC];
MATCH_MP_TAC aff_normball
THEN ASM_REWRITE_TAC[]]]);;
let NORMBALL_SUBSET=prove(`!x r r'. r<= r' ==> normball x r SUBSET normball x r'`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[SUBSET;IN_ELIM_THM;normball]
THEN GEN_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC);;
let RADIAL_NORM_CO=prove(`!r r' (x:real^3) C. r' <= r /\ &0< r' ==> (radial_norm r x (C INTER (normball x r))) ==> (radial_norm r' x (C INTER (normball x r')))`,
REWRITE_TAC[radial_norm]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`r':real`;`r:real`]
THENL[
ASM_TAC
THEN SET_TAC[];
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"A")
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE`x + u IN C INTER normball x r'
/\ normball x r' SUBSET normball x r
==> (x:real^3) + u IN C INTER normball x r`)
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`t * norm u < r' /\ r'<=r /\ t> &0 /\ &0< r' ==> &0< r /\ &0<=t /\ &0 t * r * inv r' > &0 /\ &0 <= t * r * inv r'/\ (t * r * inv r') * norm u < r* (inv r' * r')`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[REAL_ARITH`A * &1=A`]
THEN STRIP_TAC
THEN REMOVE_THEN"A"(fun th-> MRESA1_TAC th`u:real^3`)
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`t:real`[INTER;IN_ELIM_THM] THEN MRESAL1_TAC th`t * r * inv (r'):real`[INTER;IN_ELIM_THM])
THEN POP_ASSUM MP_TAC
THEN MRESA1_TAC REAL_ABS_REFL `t:real`
THEN MRESA1_TAC REAL_ABS_REFL `t * r * inv r':real`
THEN ASM_REWRITE_TAC[normball;IN_ELIM_THM;dist;VECTOR_ARITH`(A+B)-A=B:real^3`;NORM_MUL]]);;
let tranf_eq_image_of_tran=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ds0 IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds
==> tranf x V E E1 ds0= IMAGE (tran x V E1) ds0`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`)
THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"LINH")
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ]
THEN MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`)
THEN RESA_TAC
THEN SUBGOAL_THEN`tran x (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3) IN d1_fan (x,V:real^3->bool,E1)`
ASSUME_TAC
THENL[
POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN REWRITE_TAC[tran]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v':real^3`
THEN EXISTS_TAC`w':real^3`
THEN EXISTS_TAC`sigma_fan x V E1 v' w':real^3`
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN SET_TAC[];
SUBGOAL_THEN`~(y IN ds:real^3#real^3#real^3#real^3->bool)` ASSUME_TAC
THENL[
FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))`
THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]
THEN REWRITE_TAC[orbit_map;IN_ELIM_THM]
THEN USE_THEN"EM"MP_TAC
THEN REWRITE_TAC[DELETE;face_set;IN_ELIM_THM;set_of_orbits]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds`
THEN REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN SET_TAC[];
ASM_REWRITE_TAC[IMAGE;face;orbit_map;EXTENSION;IN_ELIM_THM]
THEN USE_THEN"LINH"MP_TAC
THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]
THEN REWRITE_TAC[orbit_map;IN_ELIM_THM]
THEN EQ_TAC
THEN REPEAT STRIP_TAC
THENL[
EXISTS_TAC`(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) (y:real^3#real^3#real^3#real^3)`
THEN STRIP_TAC
THENL[
EXISTS_TAC`n:num`
THEN ASM_REWRITE_TAC[];
ASM_REWRITE_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`y:real^3#real^3#real^3#real^3` )
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`tran (x:real^3) (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3)` )
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;`n:num`]];
EXISTS_TAC`n:num`
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_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`y:real^3#real^3#real^3#real^3` )
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`tran (x:real^3) (V:real^3->bool) E1 (y:real^3#real^3#real^3#real^3)` )
THEN MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;`n:num`]
]]])
;;
let azim_fanadd_eq=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ds0 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ds0 IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds
/\ y IN ds0
==> azim_fan x V E1 (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y))
= azim_fan x V E (pr2 y) (pr3 y)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE`ds0 IN face_set (hypermap1_of_fanx (x,V,E)) DELETE ds ==> ds0 IN face_set (hypermap1_of_fanx (x:real^3,V,E))`)
THEN ASM_REWRITE_TAC[] THEN DISCH_THEN(LABEL_TAC"LINH")
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds0:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC TRANF[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`ds0:real^3#real^3#real^3#real^3->bool` ]
THEN MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[tran;pr2;pr3;azim_fan]
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 FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1`
THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1`
THEN POP_ASSUM (fun th-> REWRITE_TAC[th])
THEN RESA_TAC
THEN RESA_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(v' IN {v, w})\/ (v' = v /\ ~(u=w')) \/ (v' = v /\ (u=w')) \/ (v' = w /\ ~(w'=inverse1_sigma_fan x (V:real^3->bool) E w u )) \/ (v' = w /\ (w'=inverse1_sigma_fan x V E w u ))`)
THENL[
MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]);
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL[
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`];
SUBGOAL_THEN`f1=y:real^3#real^3#real^3#real^3`
ASSUME_TAC
THENL[
MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`)
THEN RESA_TAC
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`;][pr2;pr3];
POP_ASSUM MP_TAC
THEN RESA_TAC
THEN REMOVE_THEN "LINH" MP_TAC
THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN "EM" MP_TAC
THEN RESA_TAC
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN FIND_ASSUM MP_TAC`ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))`
THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`f1:real^3#real^3#real^3#real^3`][face]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN RESA_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds`
THEN REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN SET_TAC[]];
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`];
SUBGOAL_THEN`f3=y:real^3#real^3#real^3#real^3`
ASSUME_TAC
THENL[
MP_TAC(SET_RULE`y IN ds0 /\ ds0 SUBSET d1_fan (x,V,E)==> y IN d1_fan (x,V:real^3->bool,E)`)
THEN RESA_TAC
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f3:real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`;][pr2;pr3]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[PAIR_EQ]
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
MP_TAC(SET_RULE`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3
==> f1_fan x V E f2= f1_fan x V E (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`)
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th] THEN REWRITE_TAC[])
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[th;f1_fan])
THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`(x,u,w,(v:real^3)) = f30:real^3#real^3#real^3#real^3`
THEN REWRITE_TAC[]];
POP_ASSUM MP_TAC
THEN RESA_TAC
THEN REMOVE_THEN "LINH" MP_TAC
THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN "EM" MP_TAC
THEN RESA_TAC
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`][face]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN FIND_ASSUM MP_TAC`ds IN face_set (hypermap1_of_fanx (x:real^3,V,E))`
THEN REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x'':real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`][face]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN RESA_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM MP_TAC`ds0 IN face_set (hypermap1_of_fanx (x,V:real^3->bool,E)) DELETE ds`
THEN REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN SET_TAC[]]]]);;
let eventally_measurable_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ f IN face_set (hypermap1_of_fanx (x,V,E))
==> let U = dartset_leads_into_fan x V E f in
((!r. measurable (ball (x,r) INTER U)) /\
eventually_radial x U) `,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;]
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN STRIP_TAC
THENL(*1*)[
DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`)
THENL(*2*)[
MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(f:real^3#real^3#real^3#real^3->bool)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`);(*2*)
MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`]
THEN REWRITE_TAC[SET_RULE`A INTER (B UNION C UNION D)=(A INTER B) UNION (A INTER C) UNION (A INTER D)`]
THEN MATCH_MP_TAC MEASURABLE_UNION
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`)
THEN MATCH_MP_TAC MEASURABLE_UNION
THEN ASM_REWRITE_TAC[MEASURABLE_BALL_AFF_GT]];(*1*)
DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`)
THENL(*2*)[
MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(f:real^3#real^3#real^3#real^3->bool)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`);(*2*)
MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`)
THEN ASM_TAC
THEN REWRITE_TAC[SET_RULE`A INTER (B UNION C UNION D)=(A INTER B) UNION (A INTER C) UNION (A INTER D)`;eventually_radial;radial;ball_eq_normball;]
THEN REPEAT STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN STRIP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH2")
THEN EXISTS_TAC`min r (r':real)`
THEN MP_TAC(REAL_ARITH`r> &0 /\ r' > &0==> min r (r':real)> &0 /\ &0< min r (r':real)/\ min r r' <= r /\ min r r' <= r'`)
THEN RESA_TAC
THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`min r r':real`;`r:real`]
THEN MRESA_TAC NORMBALL_SUBSET[`x:real^3`;`min r r':real`;`r':real`]
THEN REWRITE_TAC[SET_RULE`A INTER B SUBSET B`;SET_RULE`(B UNION C UNION D) INTER A=(B INTER A) UNION (C INTER A) UNION (D INTER A)`]
THEN REWRITE_TAC[UNION;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`t * norm u' < min r r'==> t * norm u' < r' /\ t * norm (u':real^3) < r`)
THEN RESA_TAC
THENL[
MRESAL_TAC RADIAL_NORM_CO[`r:real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`][radial_norm]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`)
THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`);(**)
MRESAL_TAC RADIAL_NORM_CO[`r':real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool)`][radial_norm;SET_RULE`A INTER B SUBSET B`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`)
THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`);
MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w:real^3} IN E1`) THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E1:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`]
THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`min r r':real`;][radial_norm]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`u':real^3`)
THEN POP_ASSUM (fun th-> MRESA1_TAC th`t:real`)]]]);;
let SOL_AFF_GT_2_1=prove(`!x:real^3 v:real^3 u:real^3.
~collinear {x,v,u}==> sol x (aff_gt {x} {v,u})= &0`,
REPEAT STRIP_TAC
THEN MRESA_TAC MEASURABLE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`]
THEN MP_TAC(ISPECL[`(x:real^3)`;` (v:real^3)`;` (u:real^3)`]th3) THEN RESA_TAC
THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`;][REAL_ARITH`&1> &0`]
THEN MRESAL_TAC sol[`x:real^3`;`aff_gt {x} {v,u}:real^3->bool`;`&1`][REAL_ARITH`&1> &0`;SET_RULE`{} INTER normball x (&1)={}`; MEASURABLE_AFF_GT_2_1_INTER_BALL]
THEN MRESA_TAC MEASURE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`u:real^3`;`&1:real`]
THEN REAL_ARITH_TAC);;
let inverse1_sigma_fan_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> inverse1_sigma_fan x V E1 v (sigma_fan x V E v u) = w`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MATCH_MP_TAC MONO_SIGMA_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E1:(real^3->bool)->bool`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_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 sigma_fan_in_set_of_edge[`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 MP_TAC(SET_RULE`{v, sigma_fan x V E v u:real^3} IN E /\ E UNION {{v,w}}= E1
==> {v, sigma_fan x V E v u} IN E1/\ {v,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `sigma_fan x V E v u:real^3`)
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `sigma_fan x V E v u:real^3`)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`
;`v:real^3`;`u:real^3`; `w:real^3`]);;
let inverse1_sigma_fan_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> inverse1_sigma_fan x V E1 v w=u`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MATCH_MP_TAC MONO_SIGMA_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E1:(real^3->bool)->bool`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(SET_RULE`{v, u:real^3} IN E /\ E UNION {{v,w}}= E1
==> {v, u} IN E1/\ {v,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`v:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`
;`v:real^3`;`u:real^3`; `w:real^3`]);;
let inverse1_sigma_fan_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> inverse1_sigma_fan x V E1 u v=w`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MATCH_MP_TAC MONO_SIGMA_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E1:(real^3->bool)->bool`
THEN EXISTS_TAC`u:real^3`
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(SET_RULE`{v, u:real^3} IN E /\ { u:real^3,w} IN E /\ E UNION {{v,w}}= E1
==> {u,w} IN E1/\ {v,w} IN E1/\ {v,u} IN E1 `)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`u:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`u:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`)
THEN RESA_TAC
THEN RESA_TAC);;
let DS1_DS2_EQ_DS_FANADD1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ed1=(x,v,w,sigma_fan x V E1 v w)
/\ ed2=(x,w,v,sigma_fan x V E1 w v)
==> (ds1 UNION ds2) DELETE ed1 DELETE ed2 SUBSET IMAGE (tran x V E1) ds`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC face_subset_dart_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 face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REWRITE_TAC[face;IN_ELIM_THM]
THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC
THENL(*1*)[
ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*1*)
MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(ARITH_RULE`3<= CARD (ds1:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds1=0)`)
THEN RESA_TAC
THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`]
THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds1:real^3#real^3#real^3#real^3->bool)):num`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`]
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(ARITH_RULE`3<= CARD (ds2:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds2=0)`)
THEN RESA_TAC
THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3`]
THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E1) (d1_fan (x:real^3,V,E1)))`;`(CARD (ds2:real^3#real^3#real^3#real^3->bool)):num`;`(x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3`]
THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 /\ ds1 SUBSET d1_fan (x:real^3,V,E1)==> x,v,w,sigma_fan x V E1 v w IN d1_fan (x,V,E1)`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))`
THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN RESA_TAC
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;])
THEN RESA_TAC
THEN REWRITE_TAC[orbit_map;IMAGE;IN_ELIM_THM;UNION;DELETE;SUBSET]
THEN GEN_TAC
THEN REPEAT STRIP_TAC
THENL(*1*)[
EXISTS_TAC`(res (f1_fan x V E) (d1_fan (x,V,E)) POWER k)
f2:real^3#real^3#real^3#real^3`
THEN STRIP_TAC
THENL(*2*)[
EXISTS_TAC`k:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`k:num>=0`];(*2*)
MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3` )
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3` )
THEN DISJ_CASES_TAC(ARITH_RULE`k=0 \/ k>0`)
THENL(*3*)[
POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF])
THEN SET_TAC[];(*3*)
SUBGOAL_THEN`?m. k= SUC m`ASSUME_TAC
THENL(*4*)[
EXISTS_TAC`k-1:num`
THEN POP_ASSUM MP_TAC
THEN ARITH_TAC;(*4*)
POP_ASSUM MP_TAC
THEN RESA_TAC
THEN REWRITE_TAC[POWER;o_DEF;]
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*5*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*5*)
POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[f1_fan]
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,v) =
tran x (V:real^3->bool) E1
(x,w,inverse1_sigma_fan x V E w u,u:real^3)`
ASSUME_TAC
THENL(*6*)[
REWRITE_TAC[tran]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC;(*6*)
POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN ONCE_REWRITE_TAC[SET_RULE`x=y <=> y=x`]
THEN ABBREV_TAC`y=(x,w,inverse1_sigma_fan x V E w u,u:real^3)`
THEN SUBGOAL_THEN`y IN d1_fan (x,V:real^3->bool,E)` ASSUME_TAC
THENL(*7*)[
POP_ASSUM(fun th-> REWRITE_TAC[SYM th; d1_fan;IN_ELIM_THM])
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3`
THEN EXISTS_TAC`u:real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC;(*7*)
MRESAL_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;`m:num`][f1_fan;]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[GSYM f1_fan]
THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v)`
THEN SUBGOAL_THEN`!m'. m' < m ==> (!k. k <= m'==> ~((f1_fan (x:real^3) V E POWER k) y=y1) /\ ~((f1_fan (x:real^3) V E POWER k) y=f2))` ASSUME_TAC
THENL(*8*)[
INDUCT_TAC
THENL(*9*)[
STRIP_TAC
THEN GEN_TAC
THEN REWRITE_TAC[ARITH_RULE`k<=0 <=> k=0`]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[POWER;I_DEF]
THEN EXPAND_TAC"y"
THEN EXPAND_TAC"y1"
THEN REWRITE_TAC[EQ_PAIR_4]
THEN REPEAT STRIP_TAC
THENL(*10*)[
REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> ASSUME_TAC (SYM th))
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 sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*10*)
FIND_ASSUM MP_TAC`pr2 f2=u:real^3`
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;pr2])
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (w:real^3)`;
`u:real^3`]](*10*);(*9*)
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"A")
THEN STRIP_TAC
THEN GEN_TAC
THEN MP_TAC(ARITH_RULE`SUC m' < m ==> m' < m:num`)
THEN RESA_TAC
THEN REWRITE_TAC[ARITH_RULE`k <= SUC m'<=> k <= m' \/ k = SUC m'`]
THEN STRIP_TAC
THENL(*10*)[
REMOVE_THEN "A" MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`k':num`);(*10*)
REMOVE_THEN "A" MP_TAC
THEN ASM_REWRITE_TAC[ARITH_RULE`k<= m' <=> k < SUC m'`]
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC
THENL(*11*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3`
THEN ASM_REWRITE_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 sigma_fan_in_set_of_edge[`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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*11*)
SUBGOAL_THEN`!k. k < SUC m'
==> (~(pr2 ((f1_fan x V E POWER k) y) = sigma_fan x V E v u) /\
pr3 ((f1_fan x V E POWER k) y) = v) \/
(~(pr2 ((f1_fan x V E POWER k) y) = u) /\
pr3 ((f1_fan x V E POWER k) y) = w) \/
~(pr3 ((f1_fan x V E POWER k) y) IN {v, w})` ASSUME_TAC
THENL(*12*)[
REPEAT STRIP_TAC
THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`k'':num`)
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k'':num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`)
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER k'') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ]
THEN POP_ASSUM MP_TAC
THEN EXPAND_TAC"y1"
THEN REWRITE_TAC[pr2;pr3]
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER k'') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[];(*12*)
MRESA_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;`SUC m':num`]
THEN SUBGOAL_THEN`~(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) ((f1_fan x V E POWER SUC m') y) = tran x V E1 (y1:real^3#real^3#real^3#real^3)) /\
~(tran x V E1((f1_fan x V E POWER SUC m') y) = tran x V E1 (f2:real^3#real^3#real^3#real^3))`ASSUME_TAC
THENL(*13*)[
ASM_REWRITE_TAC[]
THEN SUBGOAL_THEN`tran x (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)= f1_fan x V E1(f1_fan x V E1 (tran x (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))) `
ASSUME_TAC
THENL(*14*)[
EXPAND_TAC"y"
THEN EXPAND_TAC"y1"
THEN REWRITE_TAC[tran;f1_fan]
THEN MRESA_TAC inverse1_sigma_fan_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT6[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ;`inverse1_sigma_fan x V E w u:real^3`];(*14*)
ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THENL(*15*)[
POP_ASSUM MP_TAC
THEN REWRITE_TAC[POWER;o_DEF]
THEN STRIP_TAC
THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E1:(real^3->bool)->bool)`;`SUC(SUC(SUC m'))`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))`][ARITH_RULE`~(SUC (SUC (SUC m')) = 0)`;POWER;o_DEF]
THEN MP_TAC(ARITH_RULE`SUC m':num < m /\ SUC m=k /\ k< CARD (ds1:real^3#real^3#real^3#real^3->bool)
==> SUC(SUC (SUC m'))< CARD ds1`)
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`k= SUC m:num`
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w)= (f1_fan x V E1 (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3))) `
ASSUME_TAC
THENL(*16*)[
EXPAND_TAC"y1"
THEN REWRITE_TAC[tran;f1_fan]
THEN MRESA_TAC inverse1_sigma_fan_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ];(*16*)
SUBGOAL_THEN`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)`
ASSUME_TAC
THENL(*17*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM;tran]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 (sigma_fan x V E v u) v:real^3`
THEN ASM_REWRITE_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 sigma_fan_in_set_of_edge[`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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN EXPAND_TAC"y1"
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(SET_RULE`{v:real^3, sigma_fan x V E v u} IN E /\ E UNION {{v, w}} = E1 ==> {v, sigma_fan x V E v u} IN E1`)
THEN ASM_REWRITE_TAC[];(*17*)
MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3):real^3#real^3#real^3#real^3`;]
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E1)`;`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[face]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC(SYM th))
THEN STRIP_TAC THEN STRIP_TAC THEN STRIP_TAC
THEN ASM_REWRITE_TAC[orbit_map]
THEN STRIP_TAC
THEN SUBGOAL_THEN`{(f1_fan x V E1 POWER n) (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)) | n >= 0}=ds1`
ASSUME_TAC
THENL(*18*)[
ASM_REWRITE_TAC[]
THEN REWRITE_TAC[face;orbit_map]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN REWRITE_TAC[EXTENSION;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THENL(*19*)[
REPEAT STRIP_TAC
THEN EXISTS_TAC`(n:num)`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`);(*19*)
REPEAT STRIP_TAC
THEN EXISTS_TAC`(n:num)`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`n:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y1:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`)](*19*);(*18*)
POP_ASSUM (fun th-> REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[face;orbit_map]
THEN ASM_REWRITE_TAC[]
THEN ARITH_TAC](*18*)](*17*)](*16*);(*15*)
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN SUBGOAL_THEN`tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3) IN d1_fan (x:real^3,V,E1)`
ASSUME_TAC
THENL(*16*)[
EXPAND_TAC "y"
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM;tran]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 w (inverse1_sigma_fan x V E w u):real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, w:real^3} IN E /\ E UNION {{v,w}}= E1
==> {inverse1_sigma_fan x V E w u, w} IN E1`)
THEN RESA_TAC;(*16*)
MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)` ]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC m'`; `x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`;`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (f2:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;` (tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3`;]
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*17*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*17*)
REWRITE_TAC[tran]
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC"y"
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`)
THEN RESA_TAC
THEN RESA_TAC
THEN REWRITE_TAC[SET_RULE`f30 IN {f10, f20, f30}`]
THEN REWRITE_TAC[SET_RULE`y IN {f10, f20, f30:real^3#real^3#real^3#real^3}<=> y =f10\/ y =f20\/ y =f30`]
THEN RESA_TAC
THENL(*18*)[
POP_ASSUM MP_TAC
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,w,v,u = f10:real^3#real^3#real^3#real^3`
THEN STRIP_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th -> MP_TAC(ISPEC `u:real^3` th))
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*18*)
POP_ASSUM MP_TAC
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,v,u,w = f20:real^3#real^3#real^3#real^3`
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(v:real^3)`];(*18*)
POP_ASSUM MP_TAC
THEN FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;EQ_PAIR_4])`x,u,w,v = f30:real^3#real^3#real^3#real^3`
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]](*18*)](*17*)](*16*)](*15*)](*14*);(*13*)
POP_ASSUM MP_TAC
THEN SET_TAC[]](*13*)](*12*)](*11*)](*10*)](*9*);(*8*)
SUBGOAL_THEN`!k. k < m==> ~((f1_fan (x:real^3) V E POWER k) y=y1) /\ ~((f1_fan (x:real^3) V E POWER k) y=f2)` ASSUME_TAC
THENL(*9*)[
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN GEN_TAC
THEN DISJ_CASES_TAC(ARITH_RULE`m=0 \/ m>0`)
THENL(*10*)[
ASM_REWRITE_TAC[]
THEN ARITH_TAC;(*10*)
MP_TAC(ARITH_RULE`m>0==> m-1< m`)
THEN RESA_TAC
THEN STRIP_TAC
THEN MP_TAC(ARITH_RULE`k' k'<= m-1`)
THEN RESA_TAC
THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m-1:num`)
THEN POP_ASSUM (fun th-> MRESA1_TAC th`k':num`)](*10*);(*9*)
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m':num`)
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`)
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ]
THEN POP_ASSUM MP_TAC
THEN EXPAND_TAC"y1"
THEN REWRITE_TAC[pr2;pr3]
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3]
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC
THENL(*10*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3`
THEN ASM_REWRITE_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 sigma_fan_in_set_of_edge[`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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*10*)
ASM_REWRITE_TAC[]
THEN SET_TAC[]](*10*)](*9*)](*8*)]]]]]];(*1*)
ASM_REWRITE_TAC[]
THEN MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[face;]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*2*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*2*)
SUBGOAL_THEN`x,w,v,sigma_fan x V E1 w v IN d1_fan (x,V:real^3->bool,E1):real^3#real^3#real^3#real^3->bool`ASSUME_TAC
THENL(*3*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3`
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_TAC
THEN SET_TAC[];(*3*)
MP_TAC(ARITH_RULE`k<3==> k=0 \/ k= SUC 0\/ k = SUC(SUC 0)`)
THEN RESA_TAC
THENL(*4*)[
POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF])
THEN SET_TAC[];(*4*)
ASM_REWRITE_TAC[POWER;I_DEF;o_DEF]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan])
THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN EXISTS_TAC`(x,v,u,sigma_fan x V E v u:real^3)`
THEN ASM_REWRITE_TAC[tran]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`
;`v:real^3`;`u:real^3`; `w:real^3`]
THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)`ASSUME_TAC
THENL(*5*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN ASM_REWRITE_TAC[PAIR_EQ]
THEN ASM_REWRITE_TAC[pr2;pr3]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN ASM_REWRITE_TAC[];(*5*)
FIND_ASSUM(MP_TAC)`f1 IN ds:real^3#real^3#real^3#real^3->bool`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[orbit_map;IN_ELIM_THM]
THEN STRIP_TAC
THEN EXISTS_TAC`n:num`
THEN ASM_REWRITE_TAC[f1_fan]](*5*);(*4*)
MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan])
THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC inverse1_sigma_fan_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN EXISTS_TAC`(x:real^3,u:real^3,w:real^3,v:real^3)`
THEN REWRITE_TAC[tran]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`)
THEN RESA_TAC
THEN RESA_TAC
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF]
THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
]]]]]);;
let DS1_DS2_EQ_DS_FANADD2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ed1=(x,v,w,sigma_fan x V E1 v w)
/\ ed2=(x,w,v,sigma_fan x V E1 w v)
==> IMAGE (tran x V E1) ds SUBSET (ds1 UNION ds2) DELETE ed1 DELETE ed2 `,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC face_subset_dart_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 face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REWRITE_TAC[face;IN_ELIM_THM]
THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1:real^3#real^3#real^3#real^3->bool`ASSUME_TAC
THENL(*1*)[
ASM_REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];(*1*)
SUBGOAL_THEN`x,w,v,sigma_fan x V E1 w v IN d1_fan (x,V:real^3->bool,E1):real^3#real^3#real^3#real^3->bool`ASSUME_TAC
THENL(*2*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E1 w v:real^3`
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_TAC
THEN SET_TAC[];(*2*)
MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`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(ARITH_RULE`3<= CARD (ds:real^3#real^3#real^3#real^3->bool) ==> ~(CARD ds=0)`)
THEN RESA_TAC
THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 /\ ds1 SUBSET d1_fan (x:real^3,V,E1)==> x,v,w,sigma_fan x V E1 v w IN d1_fan (x,V,E1)`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))`
THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN RESA_TAC
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;])
THEN RESA_TAC
THEN MRESAL_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`f2:real^3#real^3#real^3#real^3`][face]
THEN MRESA_TAC orbit_cyclic[`(res (f1_fan x V E) (d1_fan (x:real^3,V,E)))`;`(CARD (ds:real^3#real^3#real^3#real^3->bool)):num`;`f2:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM (fun th-> ONCE_REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[orbit_map;IMAGE;IN_ELIM_THM;UNION;DELETE;SUBSET]
THEN GEN_TAC
THEN REPEAT STRIP_TAC
THENL(*32GOAL*)[
DISJ_CASES_TAC(ARITH_RULE`k=0\/ k>0`)
THENL(*4*)[
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th;POWER;I_DEF] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN SUBGOAL_THEN(`(?n. n >= 0 /\
tran x V E1 (f2:real^3#real^3#real^3#real^3) =
(res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n)
(x,w,v,sigma_fan x V E1 w v:real^3))`)
ASSUME_TAC
THENL(*5*)[
EXISTS_TAC`SUC(SUC 0:num)`
THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(SUC 0)>=0`]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC(SUC 0):num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan])
THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC inverse1_sigma_fan_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*6*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*6*)
POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[tran]
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`u:real^3`;`w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
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 remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u:real^3)`;
`(v:real^3)`]
THEN MP_TAC(SET_RULE`~(v=u:real^3)/\ ~(u=w)==> ~(u IN {v,w})`)
THEN RESA_TAC
THEN RESA_TAC](*6*);(*5*)
ASM_REWRITE_TAC[]](*5*);(*4*)
MP_TAC(ARITH_RULE`k< CARD ds /\ 3<= CARD (ds:real^3#real^3#real^3#real^3->bool) ==> SUC k = CARD ds \/ SUC k < CARD ds`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[orbit_map]
THEN RESA_TAC
THENL(*5*)[
MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD (ds:real^3#real^3#real^3#real^3->bool)`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`)
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`)
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REWRITE_TAC[orbit_map]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;COM_POWER;o_DEF])
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN RESA_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th))
THEN STRIP_TAC
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`)
THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1:real^3#real^3#real^3#real^3)`;` (x''':real^3#real^3#real^3#real^3)`])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SUBGOAL_THEN`(?n. n >= 0 /\
tran x V E1 (f1:real^3#real^3#real^3#real^3) =
(res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n)
(x,w,v:real^3,sigma_fan x V E1 w v))`
ASSUME_TAC
THENL(*6*)[
EXISTS_TAC`SUC(0:num)`
THEN ASM_REWRITE_TAC[ARITH_RULE`SUC(0)>=0`]
THEN ASM_REWRITE_TAC[POWER;I_DEF;o_DEF]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF;f1_fan])
THEN MRESA_TAC inverse1_sigma_fan_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN ASM_REWRITE_TAC[tran]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;` (E1:(real^3->bool)->bool)`
;`v:real^3`;`u:real^3`; `w:real^3`]
THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)`ASSUME_TAC
THENL(*7*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN ASM_REWRITE_TAC[PAIR_EQ]
THEN ASM_REWRITE_TAC[pr2;pr3]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN ASM_REWRITE_TAC[];(*7*)
FIND_ASSUM(MP_TAC)`f1 IN ds:real^3#real^3#real^3#real^3->bool`
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[th])](*7*);(*6*)
ASM_REWRITE_TAC[]](*6*);(*5*)
MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3` )
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3` )
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`?m. k= SUC m`ASSUME_TAC
THENL(*6*)[
EXISTS_TAC`k-1:num`
THEN FIND_ASSUM MP_TAC`k:num>0`
THEN ARITH_TAC;(*6*)
POP_ASSUM MP_TAC
THEN RESA_TAC
THEN RESA_TAC
THEN ASM_REWRITE_TAC[POWER;o_DEF;]
THEN SUBGOAL_THEN`(?n. n >= 0 /\
tran x V E1 ((f1_fan x V E POWER m) f3) =
(res (f1_fan x V E1) (d1_fan (x,V,E1)) POWER n)
(x,v,w,sigma_fan x V E1 v w:real^3))`ASSUME_TAC
THENL(*7*)[
EXISTS_TAC`SUC m:num`
THEN ASM_REWRITE_TAC[ARITH_RULE`SUC m>=0`;POWER;o_DEF;f1_fan]
THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,v) =
tran x (V:real^3->bool) E1
(x,w,inverse1_sigma_fan x V E w u,u:real^3)`
ASSUME_TAC
THENL(*8*)[
REWRITE_TAC[tran]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC;(*8*)
POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E w u,u:real^3)= f1_fan x V E f2`
ASSUME_TAC
THENL(*9*)[
SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*10*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*10*)
POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[f1_fan]
THEN ASM_REWRITE_TAC[]](*10*);(*9*)
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3`
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[]
THEN ABBREV_TAC`y=(x,w,inverse1_sigma_fan x V E w u,u:real^3)`
THEN SUBGOAL_THEN`y IN d1_fan (x,V:real^3->bool,E)` ASSUME_TAC
THENL(*10*)[
POP_ASSUM(fun th-> REWRITE_TAC[SYM th; d1_fan;IN_ELIM_THM])
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3`
THEN EXISTS_TAC`u:real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC;(*10*)
MRESAL_TAC TRAN_COMMUTATIVE_F1_FAN_POWER3
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(y:real^3#real^3#real^3#real^3)`;`m:num`][f1_fan;]
THEN POP_ASSUM MATCH_MP_TAC
THEN REWRITE_TAC[GSYM f1_fan]
THEN ABBREV_TAC`y1=(x,sigma_fan x V E v u,v:real^3,sigma_fan x V E (sigma_fan x V E v u) v)`
THEN SUBGOAL_THEN`!m'. m' < m ==> ~((f1_fan (x:real^3) V E POWER m') y=y1) /\ ~((f1_fan (x:real^3) V E POWER m') y=f2)` ASSUME_TAC
THENL(*11*)[
STRIP_TAC
THEN SUBGOAL_THEN`y= f1_fan x V E(f1_fan x V E(f1_fan (x:real^3) V E y1))` ASSUME_TAC
THENL(*12*)[
EXPAND_TAC "y"
THEN EXPAND_TAC "y1"
THEN REWRITE_TAC[f1_fan]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`);(*12*)
SUBGOAL_THEN`(f1_fan (x:real^3) V E POWER SUC (SUC 0)) y1 = f2`ASSUME_TAC
THENL(*13*)[
EXPAND_TAC "y1"
THEN REWRITE_TAC[f1_fan;POWER;I_DEF;o_DEF]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`u:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)
THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];(*13*)
ASM_REWRITE_TAC[]
THEN REPEAT STRIP_TAC
THENL(*14*)[
MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E:(real^3->bool)->bool)`;`SUC(SUC(SUC m'))`;` (y1:real^3#real^3#real^3#real^3)`][ARITH_RULE`~(SUC (SUC (SUC m')) = 0)`;POWER;o_DEF]
THEN MP_TAC(ARITH_RULE`m':num < m /\ SUC m=k /\ SUC k< CARD (ds:real^3#real^3#real^3#real^3->bool)
==> SUC(SUC (SUC m'))< CARD ds`)
THEN ASM_REWRITE_TAC[orbit_map]
THEN FIND_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)`k= SUC m:num`
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC
THENL(*15*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3`
THEN ASM_REWRITE_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 sigma_fan_in_set_of_edge[`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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*15*)
MRESA_TAC IMAGE_F1_POWER_IN_FACE_IMP_IN_FACE[`SUC (SUC 0)`;`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f2:real^3#real^3#real^3#real^3`;`(y1:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`f2:real^3#real^3#real^3#real^3`;` (y1:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[orbit_map]
THEN RESA_TAC
THEN SUBGOAL_THEN`{(f1_fan x V E POWER n) ((y1:real^3#real^3#real^3#real^3)) | n >= 0}={(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) y1 | n >= 0}`
ASSUME_TAC
THENL(*16*)[
REWRITE_TAC[EXTENSION;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THENL(*17*)[
REPEAT STRIP_TAC
THEN EXISTS_TAC`(n:num)`
THEN ASM_REWRITE_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`(y1:real^3#real^3#real^3#real^3)`);(*17*)
REPEAT STRIP_TAC
THEN EXISTS_TAC`(n:num)`
THEN ASM_REWRITE_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`(y1:real^3#real^3#real^3#real^3)`)](*17*);(*16*)
ASM_REWRITE_TAC[]
THEN ARITH_TAC](*16*)](*15*);(*14*)
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[POWER;o_DEF;I_DEF]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN REPEAT STRIP_TAC
THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V (E:(real^3->bool)->bool)`;`(SUC m')`;` (f2:real^3#real^3#real^3#real^3)`][ARITH_RULE`~( (SUC m')= 0)`;POWER;o_DEF]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[orbit_map]
THEN STRIP_TAC
THEN MP_TAC(ARITH_RULE`m':num < m /\ SUC m=k /\ SUC k< CARD (ds:real^3#real^3#real^3#real^3->bool)
==> (SUC m')< CARD ds`)
THEN ASM_REWRITE_TAC[orbit_map]
THEN FIND_ASSUM (fun th -> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)`k= SUC m:num`
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`{(f1_fan x V E POWER n) ((f2:real^3#real^3#real^3#real^3)) | n >= 0}={(res (f1_fan x V E) (d1_fan (x,V,E)) POWER n) f2 | n >= 0}`
ASSUME_TAC
THENL(*15*)[
REWRITE_TAC[EXTENSION;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THENL(*16*)[
REPEAT STRIP_TAC
THEN EXISTS_TAC`(n:num)`
THEN ASM_REWRITE_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`(f2:real^3#real^3#real^3#real^3)`);(*16*)
REPEAT STRIP_TAC
THEN EXISTS_TAC`(n:num)`
THEN ASM_REWRITE_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`(f2:real^3#real^3#real^3#real^3)`)](*16*);(*15*)
ASM_REWRITE_TAC[]
THEN ARITH_TAC](*15*)](*14*)](*13*)](*12*);(*11*)
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`m':num`)
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`m':num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`((y:real^3#real^3#real^3#real^3))`)
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`y1:real^3#real^3#real^3#real^3`][PAIR_EQ]
THEN POP_ASSUM MP_TAC
THEN EXPAND_TAC"y1"
THEN REWRITE_TAC[pr2;pr3]
THEN MRESAL_TAC EQ_PAIR_IMP_EQ_4_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`((f1_fan x V E POWER m') y):real^3#real^3#real^3#real^3`;`f2:real^3#real^3#real^3#real^3`][PAIR_EQ;pr2;pr3]
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN `y1 IN d1_fan(x,V:real^3->bool,E)`ASSUME_TAC
THENL(*12*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E (sigma_fan x V E v u) v:real^3`
THEN ASM_REWRITE_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 sigma_fan_in_set_of_edge[`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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*12*)
ASM_REWRITE_TAC[]
THEN SET_TAC[]](*12*)](*11*)](*10*)](*9*)](*8*);(*7*)
ASM_REWRITE_TAC[]](*7*)](*6*)](*5*)](*4*);(*3*)
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`)
THEN STRIP_TAC
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3`)
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[tran]
THEN RESA_TAC
THEN REWRITE_TAC[EQ_PAIR_4]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*3*)
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f2:real^3#real^3#real^3#real^3)`)
THEN STRIP_TAC
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`k:num`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`f2:real^3#real^3#real^3#real^3`)
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[tran]
THEN RESA_TAC
THEN REWRITE_TAC[EQ_PAIR_4]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]]]]);;
let DS1_DS2_EQ_DS_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 ed1 ed2.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ ds1=face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2=face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ ed1=(x,v,w,sigma_fan x V E1 v w)
/\ ed2=(x,w,v,sigma_fan x V E1 w v)
==> IMAGE (tran x V E1) ds = (ds1 UNION ds2) DELETE ed1 DELETE ed2 `,
REPEAT STRIP_TAC
THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(ed1:real^3#real^3#real^3#real^3)`;`(ed2:real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(ed1:real^3#real^3#real^3#real^3)`;`(ed2:real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]);;
let azim_fanadd_eq_ds=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ y IN ds
/\ ~(y=f1)
/\ ~(y=f3)
==> azim_fan x V E1 (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y))
= azim_fan x V E (pr2 y) (pr3 y)`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E) /\ y IN ds==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds /\ y IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM (fun th-> ASSUME_TAC(th) THEN MP_TAC th
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM])
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[tran;pr2;pr3;azim_fan]
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 FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1`
THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v':real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1`
THEN POP_ASSUM (fun th-> REWRITE_TAC[th])
THEN RESA_TAC
THEN RESA_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(v' IN {v, w})\/ (v' = v /\ ~(u=w')) \/ (v' = v /\ (u=w')) \/ (v' = w /\ ~(w'=inverse1_sigma_fan x (V:real^3->bool) E w u )) \/ (v' = w /\ (w'=inverse1_sigma_fan x V E w u ))`)
THENL[
MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA_TAC th[`v':real^3`;`w':real^3`]);
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL[
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT4[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`];
SUBGOAL_THEN`(x',v',w',w1)=f1:real^3#real^3#real^3#real^3` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[pr2;pr3]
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN ASM_REWRITE_TAC[];
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] )
THEN SET_TAC[]];
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT5[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`;`w:real^3`;`w':real^3`];
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN SUBGOAL_THEN`x,
w,
inverse1_sigma_fan x V E w u,
sigma_fan x V E w (inverse1_sigma_fan x V E w u)=f1_fan x V E f2:real^3#real^3#real^3#real^3` ASSUME_TAC
THENL[
SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[f1_fan]
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC];
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] )
THEN SET_TAC[]]]]);;
let TXFBALB=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> conforming_solid_angle_fan(x,V,E)`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;]
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN STRIP_TAC
THEN MRESA_TAC eventally_measurable_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[conforming_fan;conforming_solid_angle_fan;]
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN REPEAT STRIP_TAC
THENL(*1*)[
POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`r:real`);(*1*)
DISJ_CASES_TAC(SET_RULE`~(ds=f)\/ (f=ds:real^3#real^3#real^3#real^3->bool)`)
THENL(*2*)[
MRESA_TAC DOMAIN_TRANF_FACE_DELETE_DS
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
;`(f:real^3#real^3#real^3#real^3->bool)`;]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_fan_eq_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(f:real^3#real^3#real^3#real^3->bool)`]
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th` tranf x (V:real^3->bool)( E:(real^3->bool)->bool) E1 (f:real^3#real^3#real^3#real^3->bool)`)
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN MRESAL_TAC tranf_eq_image_of_tran[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`f:real^3#real^3#real^3#real^3->bool` ][DELETE;IN_ELIM_THM]
THEN SUBGOAL_THEN` (!x' y. x' IN f /\ y IN (f:real^3#real^3#real^3#real^3->bool) /\ tran x V E1 x' = tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) y ==> x' = y)`
ASSUME_TAC
THENL(*3*)[
REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE`x' IN f /\ y IN (f:real^3#real^3#real^3#real^3->bool)
/\ f SUBSET d1_fan (x,V,E)/\ E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ x' IN d1_fan (x,V,E) /\ y IN d1_fan (x,V,E) `)
THEN RESA_TAC
THEN MRESA_TAC INJ_TRAN_D1_FAN
[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`;
`x':real^3#real^3#real^3#real^3`;`(y:real^3#real^3#real^3#real^3)`];(*3*)
MRESA_TAC SUM_IMAGE[`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool)):real^3#real^3#real^3#real^3 -> real^3#real^3#real^3#real^3`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN REWRITE_TAC[o_DEF; ]
THEN SUBGOAL_THEN `(!y. y IN f
==> azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) -
pi =
azim_fan x V E (pr2 y) (pr3 y) - pi)`
ASSUME_TAC
THENL(*4*)[
REPEAT STRIP_TAC
THEN MRESAL_TAC azim_fanadd_eq[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`f:real^3#real^3#real^3#real^3->bool`;`(y:real^3#real^3#real^3#real^3)` ][DELETE;IN_ELIM_THM];(*4*)
MRESA_TAC SUM_EQ[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`f:real^3#real^3#real^3#real^3->bool`]](*4*)](*3*);(*2*)
MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}:real^3->bool`]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REMOVE_THEN"LINH"(fun th-> MRESAL1_TAC th` (ds1:real^3#real^3#real^3#real^3->bool)`[eventually_radial;radial;ball_eq_normball] THEN MRESAL1_TAC th` (ds2:real^3#real^3#real^3#real^3->bool)`[eventually_radial;radial;ball_eq_normball])
THEN MP_TAC(REAL_ARITH`r> &0 /\ r' > &0==> min r (r':real)> &0 /\ &0< min r (r':real)/\ min r r' <= r /\ min r r' <= r'`)
THEN RESA_TAC
THEN MRESAL_TAC RADIAL_NORM_CO[`r:real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`][radial_norm]
THEN MRESAL_TAC RADIAL_NORM_CO[`r':real`;`min r r':real`;`x:real^3`;`dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool)`][radial_norm]
THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `min r r':real` th) THEN REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] THEN STRIP_TAC)`!r. measurable (normball x r INTER dartset_leads_into_fan (x:real^3) V E1 ds1)`
THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `min r r':real` th) THEN REWRITE_TAC[SET_RULE`A INTER B=B INTER A`] THEN STRIP_TAC)`!r. measurable (normball x r INTER dartset_leads_into_fan (x:real^3) V E1 ds2)`
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN FIND_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[conforming_bijection_fan;EXISTS_UNIQUE] THEN STRIP_TAC )`conforming_bijection_fan (x:real^3,V,E1)`
THEN POP_ASSUM(fun th-> MRESA1_TAC th`dartset_leads_into_fan x V E1 (ds1:real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(ds1:real^3#real^3#real^3#real^3->bool)`
THEN MRESA1_TAC th`(ds2:real^3#real^3#real^3#real^3->bool)`)
THEN SUBGOAL_THEN`dartset_leads_into_fan x V E1 f' INTER
dartset_leads_into_fan x V E1 (ds2:real^3#real^3#real^3#real^3->bool) =
{}`
ASSUME_TAC
THENL(*4*)[
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN REWRITE_TAC[SET_RULE`A INTER B ={} <=> ~(?z. z IN A /\ z IN B)`]
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`f':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 POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC)
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y:real^3`;`z:real^3`]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`ds2: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 POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC)
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E1)`;`y':real^3`;`z:real^3`]
THEN REMOVE_THEN "LINH1" MP_TAC
THEN RESA_TAC
THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;];(*4*)
MRESAL_TAC SOL_DISJOINT_UNION[`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1`; `dartset_leads_into_fan (x:real^3) V E1 ds2`;`min (r:real) r'`][radial_norm;DISJOINT]
THEN MRESAL_TAC MEASURABLE_UNION[`(dartset_leads_into_fan (x:real^3) V E1 ds1 INTER normball x (min r r'))`;`(dartset_leads_into_fan (x:real^3) V E1 ds2 INTER normball x (min r r'))`][SET_RULE`(A INTER C) UNION (B INTER C)=(A UNION B) INTER C`]
THEN MP_TAC(SET_RULE`E UNION {{v,w}}=E1==> {v,w:real^3} IN E1`) THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(v:real^3)`]
THEN MRESA_TAC MEASURABLE_AFF_GT_2_1_INTER_BALL[`x:real^3`;`v:real^3`;`w:real^3`;`(min r r'):real`]
THEN MRESAL_TAC RADIAL_UNION[`min r r':real`;`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1 INTER normball x (min r r')`; `dartset_leads_into_fan (x:real^3) V E1 ds2 INTER normball x (min r r')`][radial_norm;SET_RULE`(A INTER C) UNION (B INTER C)=(A UNION B) INTER C`]
THEN MRESAL_TAC RADIAL_AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`(min r r'):real`;][REAL_ARITH`&1> &0`]
THEN MRESA_TAC AFF_GE_SUBSET_XFAN[`x:real^3`;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`]
THEN MP_TAC(SET_RULE` aff_ge {x} {v, w} SUBSET xfan (x,V,E1) /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w}
==> aff_gt {x:real^3} {v, w} SUBSET xfan (x,V:real^3->bool,E1)`)
THEN RESA_TAC
THEN MRESAL_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` (f':real^3#real^3#real^3#real^3->bool)`][yfan]
THEN MRESAL_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;` (ds2:real^3#real^3#real^3#real^3->bool)`][yfan]
THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET xfan (x,V,E1)/\
dartset_leads_into_fan x V E1 f' SUBSET (:real^3) DIFF xfan (x,V,E1)/\
dartset_leads_into_fan x V E1 ds2 SUBSET (:real^3) DIFF xfan (x,V,E1)
==> (dartset_leads_into_fan x V E1 f' UNION
dartset_leads_into_fan x V E1 ds2) INTER
aff_gt {x} {v, w:real^3} =
{}`)
THEN RESA_TAC
THEN MRESAL_TAC SOL_DISJOINT_UNION[`x:real^3`;`dartset_leads_into_fan (x:real^3) V E1 ds1 UNION dartset_leads_into_fan (x:real^3) V E1 ds2`;`aff_gt {x} {v, w:real^3}`; `min (r:real) r'`;][radial_norm;DISJOINT; SET_RULE`(A UNION B) UNION C= A UNION B UNION C`]
THEN MRESA_TAC SOL_AFF_GT_2_1 [`x:real^3`;`v:real^3`;`w:real^3`]
THEN REWRITE_TAC[REAL_ARITH`((&2 * pi + sum f' (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) +
&2 * pi +
sum ds2 (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) +
&0= &4 * pi + (sum f' (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi) +
sum ds2 (\y. azim_fan x V E1 (pr2 y) (pr3 y) - pi)) `]
THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC FINITE_FACE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC disjoint_ds1_and_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN SUBGOAL_THEN`(f':real^3#real^3#real^3#real^3->bool) INTER ds2 ={}`
ASSUME_TAC
THENL(*5*)[
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN REWRITE_TAC[SET_RULE`A INTER B ={} <=> ~(?z. z IN A /\ z IN B)`]
THEN STRIP_TAC
THEN FIND_ASSUM(fun th -> MP_TAC th THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] THEN STRIP_TAC)`f' IN face_set (hypermap1_of_fanx (x:real^3,V,E1))`
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`x':real^3#real^3#real^3#real^3`;`z:real^3#real^3#real^3#real^3`][face]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN FIND_ASSUM(fun th -> MP_TAC th THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits] THEN STRIP_TAC)`ds2 IN face_set (hypermap1_of_fanx (x:real^3,V,E1))`
THEN MRESAL_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V,E1)`;`x'':real^3#real^3#real^3#real^3`;`z:real^3#real^3#real^3#real^3`][face]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN RESA_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]);(*5*)
MRESAL_TAC SUM_UNION[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(f':real^3#real^3#real^3#real^3->bool)`;`(ds2:real^3#real^3#real^3#real^3->bool)`;][DISJOINT]
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`f' SUBSET d1_fan (x,V,E1)/\ ds2 SUBSET d1_fan (x,V,E1)
==> f' UNION ds2 SUBSET d1_fan(x:real^3,V,E1)
`)
THEN RESA_TAC
THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E1:(real^3->bool)->bool)`]
THEN MRESA_TAC FINITE_SUBSET[`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool)`;`d1_fan(x:real^3,V,E1)`]
THEN SUBGOAL_THEN`x,v,w,sigma_fan x V E1 v w IN ds1` ASSUME_TAC
THENL(*6*)[
FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w:real^3,sigma_fan x V E1 v w) = ds1`
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*6*)
MP_TAC(SET_RULE`x,v,w,sigma_fan x V E1 v w IN ds1 ==> x,v,w,sigma_fan x V E1 v w IN ds1 UNION ds2`)
THEN RESA_TAC
THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool)`;`( (x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`]
THEN MRESA_TAC FINITE_DELETE[`(f' UNION ds2 ):real^3#real^3#real^3#real^3->bool`;`(x,v,w,sigma_fan x V E1 v w:real^3)`]
THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E1 w v) IN
(f' UNION ds2) DELETE (x,v,w,sigma_fan x V E1 v w:real^3)`ASSUME_TAC
THENL(*7*)[
ASM_REWRITE_TAC[DELETE;IN_ELIM_THM;EQ_PAIR_4]
THEN MATCH_MP_TAC(SET_RULE`A IN C ==> A IN B UNION C`)
THEN FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,w,v:real^3,sigma_fan x V E1 w v) = ds2`
THEN EXISTS_TAC`0:num`
THEN REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`];(*7*)
MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`((f' UNION ds2 ):real^3#real^3#real^3#real^3->bool) DELETE (x,v,w:real^3,sigma_fan x V E1 v w)`;`( (x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`]
THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN SUBGOAL_THEN` (!x' y. x' IN ds /\ y IN (ds:real^3#real^3#real^3#real^3->bool) /\ tran x V E1 x' = tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) y ==> x' = y)`
ASSUME_TAC
THENL(*8*)[
REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE`x' IN ds /\ y IN (ds:real^3#real^3#real^3#real^3->bool)
/\ ds SUBSET d1_fan (x,V,E)/\ E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ x' IN d1_fan (x,V,E) /\ y IN d1_fan (x,V,E) `)
THEN RESA_TAC
THEN MRESA_TAC INJ_TRAN_D1_FAN
[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`;
`x':real^3#real^3#real^3#real^3`;`(y:real^3#real^3#real^3#real^3)`];(*8*)
MRESA_TAC SUM_IMAGE[`(tran (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool)):real^3#real^3#real^3#real^3 -> real^3#real^3#real^3#real^3`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN REWRITE_TAC[o_DEF; ]
THEN MRESA_TAC finite_d1_fan[`x:real^3`;` V:real^3->bool`;` (E:(real^3->bool)->bool)`]
THEN MRESA_TAC FINITE_SUBSET[`(ds:real^3#real^3#real^3#real^3->bool)`;`d1_fan(x:real^3,V,E)`]
THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool)`;`(f1:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`]
THEN MRESA_TAC FINITE_DELETE[`(ds ):real^3#real^3#real^3#real^3->bool`;`f1:real^3#real^3#real^3#real^3`]
THEN SUBGOAL_THEN`f3 IN ds DELETE f1:real^3#real^3#real^3#real^3` ASSUME_TAC
THENL(*9*)[
ASM_REWRITE_TAC[IN_ELIM_THM;DELETE;]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC)
THEN FIND_ASSUM MP_TAC`pr2 f3=w:real^3`
THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`pr2 f3=v:real^3`
THEN ASM_REWRITE_TAC[];(*9*)
MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1`;`(f3:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`]
THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran (x:real^3) V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool)`;`(f1:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`]
THEN MRESAL_TAC SUM_DELETE[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran (x:real^3) V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1`;`(f3:real^3#real^3#real^3#real^3)`;][REAL_ARITH`A=B-C<=> B=A+C`]
THEN SUBGOAL_THEN `(!y. y IN ds DELETE f1 DELETE f3
==> azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) -
pi =
azim_fan x V E (pr2 y) (pr3 y) - pi)`
ASSUME_TAC
THENL(*10*)[
REWRITE_TAC[DELETE;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN MRESAL_TAC azim_fanadd_eq_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool`;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3)` ][DELETE;IN_ELIM_THM];(*10*)
MRESA_TAC SUM_EQ[`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E1:(real^3->bool)->bool) (pr2 (tran x V E1 y)) (pr3 (tran x V E1 y)) - pi)`;`(\(y:real^3#real^3#real^3#real^3). azim_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) (pr2 y) (pr3 y) - pi)`;`(ds:real^3#real^3#real^3#real^3->bool) DELETE f1 DELETE f3`]
THEN REWRITE_TAC[REAL_ARITH`&4 * pi +
(((sum (ds DELETE f1 DELETE f3) (\y. azim_fan x V E (pr2 y) (pr3 y) - pi) +
azim_fan x V E1 (pr2 (tran x V E1 f3)) (pr3 (tran x V E1 f3)) - pi) +
azim_fan x V E1 (pr2 (tran x V E1 f1)) (pr3 (tran x V E1 f1)) - pi) +
azim_fan x V E1 (pr2 (x,w,v,sigma_fan x V E1 w v))
(pr3 (x,w,v,sigma_fan x V E1 w v)) -
pi) +
azim_fan x V E1 (pr2 (x,v,w,sigma_fan x V E1 v w))
(pr3 (x,v,w,sigma_fan x V E1 v w)) -
pi =
&2 * pi +
(sum (ds DELETE f1 DELETE f3) (\y. azim_fan x V E (pr2 y) (pr3 y) - pi) +
azim_fan x V E w (pr3 f3) - pi) +
azim_fan x V E v u - pi
<=> azim_fan x V E1 (pr2 (tran x V E1 f3)) (pr3 (tran x V E1 f3)) +
azim_fan x V E1 (pr2 (tran x V E1 f1)) (pr3 (tran x V E1 f1))+
azim_fan x V E1 (pr2 (x,w,v,sigma_fan x V E1 w v))
(pr3 (x,w,v,sigma_fan x V E1 w v)) +
azim_fan x V E1 (pr2 (x,v,w,sigma_fan x V E1 v w))
(pr3 (x,v,w,sigma_fan x V E1 v w)) =
azim_fan x V E w (pr3 f3) +
azim_fan x V E v u`;pr2;pr3]
THEN SUBGOAL_THEN`(x,v,u,sigma_fan x V E v u)=f1:real^3#real^3#real^3#real^3` ASSUME_TAC
THENL(*11*)[
ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN ASM_REWRITE_TAC[]
THEN REWRITE_TAC[pr2;pr3]
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN ASM_REWRITE_TAC[];(*11*)
POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SUBGOAL_THEN`x,
w,
inverse1_sigma_fan x V E w u,
sigma_fan x V E w (inverse1_sigma_fan x V E w u)=f1_fan x V E f2:real^3#real^3#real^3#real^3` ASSUME_TAC
THENL(*12*)[
SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*13*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*13*)
POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[f1_fan]
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC](*13*);(*12*)
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;tran;azim_fan])
THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1`
THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `v:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V`
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(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 POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN STRIP_TAC
THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `w:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E1) > 1`
THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `w:real^3` th))`!v. v IN (V:real^3->bool) ==> CARD (set_of_edge v V E) > 1`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(w:real^3) IN V`
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w: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 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 sigma_fan_in_set_of_edge[`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 sum4_azim_fan[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`;`(sigma_fan x V E v u):real^3`]
THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u
==>
azim x w v u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (v:real^3)`;`(w:real^3)`]
THEN POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV)[SET_RULE`{A,B}={B,A}`]
THEN RESA_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 POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o LAND_CONV)[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`;`(w:real^3)`]
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`v:real^3`;`u:real^3`]
THEN REAL_ARITH_TAC
]]]]]]]]]]]);;
let TRAN_IN_TRANF=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 f 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w /\ pr3 f1 = u
/\ pr3 f2 = w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v
/\ ds1 = face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)
/\ ds2 = face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ f IN face_set(hypermap1_of_fanx (x,V,E)) DELETE ds
/\ y IN f
==> tran x V E1 y IN tranf x V E E1 f`,
REPEAT STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC unique_tranf_fan
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`
;`ds1:real^3#real^3#real^3#real^3->bool`
;`ds2:real^3#real^3#real^3#real^3->bool`
;`(f10:real^3#real^3#real^3#real^3)` ;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`
; `f:real^3#real^3#real^3#real^3->bool`
;`(face (hypermap1_of_fanx (x,V,E1)) (tran (x:real^3) V E1 (y:real^3#real^3#real^3#real^3)):real^3#real^3#real^3#real^3->bool)`
;`(y:real^3#real^3#real^3#real^3)`;]
THEN REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[POWER;I_DEF;ARITH_RULE`0>=0`]);;
let TXFBALB_VERSION=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ ~(conforming_fan (x,V,E))
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> conforming_solid_angle_fan(x,V,E)`,
REPEAT STRIP_TAC
THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}`
THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)`
THEN MRESA_TAC TXFBALB[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);;
let conforming_bijection_fanadd_verrion=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ ~(conforming_fan (x,V,E))
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==>
!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\
s = dartset_leads_into_fan x V E f)`,
REPEAT GEN_TAC
THEN STRIP_TAC
THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}`
THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)`
THEN MRESA_TAC conforming_bijection_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);;
let OBHTHCD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ ~(conforming_fan (x,V,E))
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==>
!s. s IN topological_component_yfan (x,V,E) ==> (?!f. f IN face_set (hypermap1_of_fanx (x,V,E)) /\
s = dartset_leads_into_fan x V E f)`,
REPEAT GEN_TAC
THEN STRIP_TAC
THEN MRESA_TAC nonconformin_fan_imp_exist_face_gt_3[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}`
THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)`
THEN MRESA_TAC conforming_bijection_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]);;
let inverse1_sigma_fan_FANADD4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
==> inverse1_sigma_fan x V E1 (inverse1_sigma_fan x V E w u) w = inverse1_sigma_fan x V E (inverse1_sigma_fan x V E w u) w`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MATCH_MP_TAC MONO_SIGMA_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E1:(real^3->bool)->bool`
THEN EXISTS_TAC`inverse1_sigma_fan x V E w u:real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u,w:real^3} IN E /\ E UNION {{v,w}}= E1
==> {inverse1_sigma_fan x V E w u,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(SET_RULE`{inverse1_sigma_fan x V E w u, inverse1_sigma_fan x V E
(inverse1_sigma_fan x V E w u)
w:real^3} IN E /\ E UNION {{v,w}}= E1
==> {inverse1_sigma_fan x V E w u, inverse1_sigma_fan x V E
(inverse1_sigma_fan x V E w u)
w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)
THEN MRESA_TAC SIGMA_FAN_OF_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(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 POP_ASSUM (fun th-> MRESA_TAC th[`inverse1_sigma_fan x V E w u:real^3`;`inverse1_sigma_fan x V E (inverse1_sigma_fan x V E w u) w:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN DISJ_CASES_TAC(SET_RULE`~(inverse1_sigma_fan x V E w u IN {v, w}) \/ inverse1_sigma_fan x V E w u =v \/ inverse1_sigma_fan x V E w u =w`)
THENL[
RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`);
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL[
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_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 ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (inverse1_sigma_fan x V E w u:real^3)`;
`(w:real^3)`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN RESA_TAC]]);;
let conforming_diagonal_fanadd1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 z.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ z IN ds
/\ ~(f3=z)
==> ~collinear {x, pr2 f3, pr2 z} /\
(f3 = f1_fan x V E z \/
z = f1_fan x V E f3 \/
aff_gt {x} {pr2 f3, pr2 z} SUBSET
dartset_leads_into_fan x V E ds)`,
REPEAT GEN_TAC
THEN STRIP_TAC
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E) /\ z IN ds ==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds/\ z IN d1_fan(x,V,E)`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[conforming_fan;conforming_diagonal_fan;]
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(z=f1:real^3#real^3#real^3#real^3)\/ z=f2 \/ (~(z=f1)/\ ~(z=f2))`)
THENL(*1*)[
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THENL(*2*)[
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(SET_RULE`E UNION {{v,w:real^3}}=E1==> {v,w:real^3} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(v:real^3)`]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_TAC[];(*2*)
ASM_REWRITE_TAC[]
THEN MRESA_TAC STEP2_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]](*2*);(*1*)
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL(*2*)[
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THENL(*3*)[
POP_ASSUM MP_TAC
THEN ASM_REWRITE_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 ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_TAC[];(*3*)
ASM_REWRITE_TAC[]](*3*);(*2*)
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> E SUBSET E1/\ {v,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC INJ_TRAN_D1_FAN
[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`;`(E1:(real^3->bool)->bool)`;
`f3:real^3#real^3#real^3#real^3`;`(z:real^3#real^3#real^3#real^3)`]
THEN SUBGOAL_THEN`tran (x:real^3) V E1 (z:real^3#real^3#real^3#real^3) IN IMAGE (tran (x:real^3) (V:real^3->bool) E1) (ds:real^3#real^3#real^3#real^3->bool)` ASSUME_TAC
THENL(*3*)[
REWRITE_TAC[IMAGE;IN_ELIM_THM]
THEN EXISTS_TAC`z:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];(*3*)
POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`tran (x:real^3) V E1 (f3:real^3#real^3#real^3#real^3)=(x,w,inverse1_sigma_fan x V E1 w v,v)` ASSUME_TAC
THENL(*4*)[
SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*5*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*5*)
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan x V E f2 = f3:real^3#real^3#real^3#real^3`
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th;f1_fan;tran] )
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC](*5*);(*4*)
SUBGOAL_THEN`(x,w,inverse1_sigma_fan x V E1 w v,v:real^3) =f1_fan x V E1 (x,v,w,sigma_fan x V E1 v w)` ASSUME_TAC
THENL(*5*)[
REWRITE_TAC[f1_fan];(*5*)
SUBGOAL_THEN`x:real^3,v,w,sigma_fan x V E1 v w IN ds1`ASSUME_TAC
THENL(*6*)[
FIND_ASSUM (fun th-> REWRITE_TAC[SYM th;face;IN_ELIM_THM;orbit_map])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w:real^3) = ds1`
THEN EXISTS_TAC`0:num`
THEN ASM_REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;(*6*)
MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC DS1_DS2_EQ_DS_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REWRITE_TAC[DELETE;IN_ELIM_THM;UNION]
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN STRIP_TAC
THENL(*7*)[
FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)`
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN "LINH"(fun th-> MRESAL_TAC th[`ds1:real^3#real^3#real^3#real^3->bool`;`tran (x:real^3) V E1 (f3:real^3#real^3#real^3#real^3)`;`tran (x:real^3) V E1 (z:real^3#real^3#real^3#real^3)`][pr2;pr3;tran])
THENL(*8*)(*3GOAL*)[
POP_ASSUM MP_TAC
THEN REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*8*)
POP_ASSUM MP_TAC
THEN REWRITE_TAC[f1_fan;EQ_PAIR_4]
THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC inverse1_sigma_fan_FANADD4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN RESA_TAC
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL(*9*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*9*)
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th])`f1_fan x V E f2 = f3:real^3#real^3#real^3#real^3`
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th;f1_fan;tran] )
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`inverse1_sigma_fan x V E w u:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `w:real^3`)](*9*);(*8*)
MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION
dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION
aff_gt {x} {v, w}:real^3->bool`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]](*8*);(*7*)
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`A IN {B,C,D}<=> A=B \/ A=C \/ A=D`]
THEN STRIP_TAC
THENL(*8*)(*3 GOAL*)[
ASM_REWRITE_TAC[];(*8*)
POP_ASSUM MP_TAC
THEN FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)`
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[tran]
THEN EXPAND_TAC"f20"
THEN REWRITE_TAC[EQ_PAIR_4]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REWRITE_TAC[pr2]
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
` (v:real^3)`]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_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-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN SUBGOAL_THEN`f1=(x,v,u,sigma_fan x V E v u:real^3)` ASSUME_TAC
THENL(*9*)[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN ASM_REWRITE_TAC[pr2;pr3;]
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN ASM_REWRITE_TAC[];(*9*)
POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[]](*9*);(*8*)
POP_ASSUM MP_TAC
THEN FIND_ASSUM MP_TAC`z IN d1_fan (x:real^3,V,E)`
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN STRIP_TAC
THEN ASM_REWRITE_TAC[tran]
THEN EXPAND_TAC"f30"
THEN REWRITE_TAC[EQ_PAIR_4]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REWRITE_TAC[pr2]
THEN ASM_REWRITE_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 ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_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-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC f2_EQ_F30_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]]]]]]]]]);;
let INDUCTION_FANADD=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ y IN ds
==> ?f1 f2 f3. {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ {pr2 f2, pr2 f3} IN E
/\ ~({pr2 f3, pr2 f1 } IN E)
/\ {pr2 f1, pr2 f2 } IN E
/\ sigma_fan x V E (pr2 f2) (pr2 f3)=pr2 f1
/\ pr2 f3= pr3 f2
/\ pr2 f2= pr3 f1
/\ y=f3`,
REPEAT STRIP_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 MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN ABBREV_TAC`f2'=(f1_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) POWER (CARD (ds:real^3#real^3#real^3#real^3->bool) -1)) (y:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f1'=(f1_fan (x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) POWER (CARD (ds:real^3#real^3#real^3#real^3->bool) -2)) (y:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f4=f1_fan x V E (y:real^3#real^3#real^3#real^3)`
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"VUT")
THEN FIND_ASSUM MP_TAC`ds IN face_set(hypermap1_of_fanx (x,V:real^3->bool,E))`
THEN REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits]
THEN RESA_TAC
THEN MRESA_TAC lemma_face_identity[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`x':real^3#real^3#real^3#real^3`;`y:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;])
THEN RESA_TAC
THEN MRESA_TAC lemma_face_cycle[`hypermap1_of_fanx (x:real^3,V:real^3->bool,E)`;`y:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;])
THEN MP_TAC(SET_RULE`y IN ds /\ ds SUBSET d1_fan(x,V,E)==> y IN d1_fan(x:real^3,V,E)`)
THEN RESA_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`)
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN MP_TAC(ARITH_RULE`CARD( ds:real^3#real^3#real^3#real^3->bool)>3 ==> CARD ds= SUC(CARD(ds)-1)`)
THEN RESA_TAC
THEN POP_ASSUM(fun th-> STRIP_TAC THEN POP_ASSUM(fun th1-> MP_TAC th1 THEN
ONCE_REWRITE_TAC[th]
THEN ASM_REWRITE_TAC[COM_POWER;o_DEF]
THEN STRIP_TAC THEN MP_TAC th1))
THEN MP_TAC(ARITH_RULE`CARD( ds:real^3#real^3#real^3#real^3->bool)>3 ==> CARD ds= SUC( SUC(CARD(ds)-2))`)
THEN RESA_TAC
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[COM_POWER;o_DEF]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC th)
THEN STRIP_TAC
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool)-1:num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`)
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN STRIP_TAC
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`CARD( ds:real^3#real^3#real^3#real^3->bool)-2:num`;]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`)
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN STRIP_TAC
THEN MRESA_TAC into_domain1_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC(0):num`;]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(f1':real^3#real^3#real^3#real^3)`[POWER;I_DEF;o_DEF])
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN STRIP_TAC
THEN MRESA_TAC MONO_F1_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA_TAC th[` (f1_fan x V E f1':real^3#real^3#real^3#real^3)`;` (f2':real^3#real^3#real^3#real^3)`])
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`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)` ;`(f2':real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC IMAGE_F1_IN_FACE_IMP_IN_FACE[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':real^3#real^3#real^3#real^3)`]
THEN MRESA_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f4:real^3#real^3#real^3#real^3)` ;`(y:real^3#real^3#real^3#real^3)`;`ds:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`f1' IN ds /\ f2' IN ds /\ y IN ds /\ ds SUBSET d1_fan (x,V,E)==> {f1',f2',y} SUBSET (ds:real^3#real^3#real^3#real^3->bool)`)
THEN RESA_TAC
THEN MRESA_TAC f_fan_no_fix_point[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(f1':real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(f2':real^3#real^3#real^3#real^3)` THEN MRESA1_TAC th`(y:real^3#real^3#real^3#real^3)`)
THEN DISJ_CASES_TAC(SET_RULE`y=f1' \/ ~(y=f1':real^3#real^3#real^3#real^3)`)
THENL(*1*)[
MP_TAC(SET_RULE`f1'=y:real^3#real^3#real^3#real^3==> pr2 f1'= pr2 y`)
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[th])
THEN REWRITE_TAC[]
THEN STRIP_TAC
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)` ;`(f2':real^3#real^3#real^3#real^3)`]
THEN REMOVE_ASSUM_TAC
THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` pr2 (y:real^3#real^3#real^3#real^3)`;
` pr2 (f2':real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC THEN RESA_TAC
THEN DISJ_CASES_TAC(SET_RULE`set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E = {pr2 y} \/ ~(set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E = {pr2 y})`)
THENL(*2*)[
MRESA_TAC CARD_SING[`(pr2 y):real^3`; `(set_of_edge (pr2 (f2':real^3#real^3#real^3#real^3)) V E):real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th->REWRITE_TAC[SYM(th)])
THEN FIND_ASSUM (fun th -> MP_TAC(ISPEC `(pr2 (f2':real^3#real^3#real^3#real^3))` th))`(!v:real^3. v IN V==>CARD (set_of_edge v V E) >1)`
THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`(pr2 (f2':real^3#real^3#real^3#real^3)) IN V`
THEN ARITH_TAC;(*2*)
MRESA_TAC SIGMA_FAN [`(x:real^3)`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` pr2 (f2':real^3#real^3#real^3#real^3)`;
` pr2 (y:real^3#real^3#real^3#real^3)`]
THEN ASM_TAC THEN SET_TAC[]];(*1*)
DISJ_CASES_TAC(SET_RULE`f4=f1' \/ ~(f4=f1':real^3#real^3#real^3#real^3)`)
THENL(*2*)[
SUBGOAL_THEN(`((f1_fan (x:real^3) V E) POWER 3) f1'=f1'`) ASSUME_TAC
THENL(*3*)[
ASM_SIMP_TAC[ARITH_RULE`3= SUC(2)/\ 2= SUC(1) /\ 1= SUC(0)`;POWER;I_DEF;o_DEF];(*3*)
SUBGOAL_THEN`face (hypermap1_of_fanx (x:real^3,V:real^3->bool,E)) f1'=orbit_map (f1_fan x V E) f1'`ASSUME_TAC
THENL(*4*)[
ASM_REWRITE_TAC[face;orbit_map;EXTENSION;IN_ELIM_THM]
THEN GEN_TAC
THEN EQ_TAC
THEN STRIP_TAC
THEN MRESAL_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:real^3,V,E))) `][POWER_1;I_DEF]
THEN POP_ASSUM(fun th-> MRESA1_TAC th `f1':real^3#real^3#real^3#real^3`)
THEN EXISTS_TAC`n:num`
THEN ASM_REWRITE_TAC[];(*4*)
MRESAL_TAC identity_face_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`f1':real^3#real^3#real^3#real^3`][]
THEN MRESAL_TAC card_orbit_le[`f1_fan (x:real^3) V E`;`3`;`f1':real^3#real^3#real^3#real^3`][ARITH_RULE`~(3=0)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th -> REWRITE_TAC[SYM th])
THEN FIND_ASSUM MP_TAC`CARD( ds:real^3#real^3#real^3#real^3->bool)>3`
THEN ARITH_TAC](*4*)](*3*);(*2*)
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EMYEU")
THEN EXISTS_TAC`f1':real^3#real^3#real^3#real^3`
THEN EXISTS_TAC`f2':real^3#real^3#real^3#real^3`
THEN EXISTS_TAC`y:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC properties_of_f1_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(f2':real^3#real^3#real^3#real^3)` ;`(f1':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)` ;`(f2':real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM(th)]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)]
THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[SYM(th)] THEN MP_TAC th) THEN ASSUME_TAC th)
THEN STRIP_TAC
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> ASM_REWRITE_TAC[th] THEN MP_TAC th)
THEN REPEAT STRIP_TAC THEN ASSUME_TAC (SYM th))
THEN MRESA_TAC PROPERTIES_TRIANGLE_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1'):real^3`;`(pr3 f1'):real^3`;` (pr2 y):real^3`]
THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th] THEN ASSUME_TAC (SYM th))
THEN REPEAT STRIP_TAC
THEN MRESA_TAC condition_f1_eq_fan[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` (pr2 y):real^3`;`(pr2 f1'):real^3`;`(pr3 f1'):real^3`;]
THEN REMOVE_THEN "EMYEU" MP_TAC
THEN REMOVE_THEN"VUT"(fun th-> REWRITE_TAC[SYM th])
THEN ASM_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN REPEAT (ASM_REWRITE_TAC[pr2;pr3] THEN STRIP_TAC THEN ASM_REWRITE_TAC[])
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC(LAND_CONV o ONCE_DEPTH_CONV)[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC MONO_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;` v'':real^3`;`v'''':real^3`;`w'':real^3`]]]);;
let conforming_diagonal_fan_ds_fanadd=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 y z.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ y IN ds
/\ z IN ds
/\ ~(y=z)
==> ~collinear {x, pr2 y, pr2 z} /\
(y = f1_fan x V E z \/
z = f1_fan x V E y \/
aff_gt {x} {pr2 y, pr2 z} SUBSET
dartset_leads_into_fan x V E ds)`,
REPEAT GEN_TAC
THEN STRIP_TAC
THEN MRESA_TAC INDUCTION_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`y:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN ABBREV_TAC`v'= pr2 (f1':real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`u'= pr2 (f2':real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`w'= pr2 (f3':real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`E1'= E UNION {{v':real^3, w':real^3}}`
THEN ABBREV_TAC`ds1'= face (hypermap1_of_fanx (x,V,E1')) ((x,v',w',sigma_fan x V E1' v' w'):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`ds2'= face (hypermap1_of_fanx (x,V,E1')) ((x,w',v',sigma_fan x V E1' w' v'):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f10'= ((x,w',v',u'):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f20'= ((x,v',u',w'):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f30'= ((x,u',w',v'):real^3#real^3#real^3#real^3)`
THEN STRIP_TAC
THEN MRESA_TAC conforming_diagonal_fanadd1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1':(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1':real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`;`(f3':real^3#real^3#real^3#real^3)`;`v':real^3`;`u':real^3`; `w':real^3`;`ds1':real^3#real^3#real^3#real^3->bool`;`ds2':real^3#real^3#real^3#real^3->bool` ;`(f10':real^3#real^3#real^3#real^3)`;`(f20':real^3#real^3#real^3#real^3)`;`(f30':real^3#real^3#real^3#real^3)`;`(z:real^3#real^3#real^3#real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN ASM_REWRITE_TAC[]);;
let GGZWYRM=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> conforming_diagonal_fan(x,V,E)`,
REWRITE_TAC[conforming_diagonal_fan]
THEN REPEAT GEN_TAC
THEN STRIP_TAC
THEN REPEAT GEN_TAC
THEN STRIP_TAC
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(f):real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(ARITH_RULE`3<= CARD (f:real^3#real^3#real^3#real^3->bool)==> CARD f=3 \/ CARD f>3`)
THEN RESA_TAC
THENL[
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"EM1")
THEN DISCH_THEN(LABEL_TAC"EM2")
THEN STRIP_TAC
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f2):real^3`;`(pr2 f1):real^3`]
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f3):real^3`;`(pr2 f2):real^3`]
THEN MRESA_TAC remark1_fan[`x:real^3 `;`(V:real^3->bool) `;`(E:(real^3->bool)->bool)`;` (pr2 f1):real^3`;`(pr2 f3):real^3`]
THEN REPEAT DISCH_TAC
THEN REMOVE_THEN"EM1" MP_TAC
THEN REMOVE_THEN"EM2" MP_TAC
THEN RESA_TAC
THEN RESA_TAC
THEN MP_TAC(SET_RULE`y IN {f1, f2, f3:real^3#real^3#real^3#real^3} /\ z IN {f1, f2, f3}/\ ~(y = z)
==> (y=f1 /\ z= f2) \/ (y=f1 /\ z= f3) \/ (y=f2 /\ z= f1) \/ (y=f2 /\ z= f3)\/ (y=f3 /\ z= f1) \/ (y=f3 /\ z= f2)` )
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_TAC[];
MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`f:real^3#real^3#real^3#real^3->bool`]
THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}`
THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)`
THEN MRESA_TAC conforming_diagonal_fan_ds_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`f:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`(y:real^3#real^3#real^3#real^3)`;`(z:real^3#real^3#real^3#real^3)`]
]);;
let INTERS_HALF_SPACE_DS_FANADD3=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ U1=INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds}
==> U1 INTER aff {x, v, w} SUBSET aff_gt {x} {v, w}`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`])
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1/\ {v,u} IN E ==> { v,u} IN E1`)
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`])
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1 ==> {v,w:real^3} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(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) `;` (u:real^3)`;
`v:real^3`]
THEN MRESA_TAC sigma_fan_in_set_of_edge[`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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`sigma_fan x V E v u:real^3`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN STRIP_TAC
THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_1[`x:real^3`;`v:real^3`;`u:real^3`;`sigma_fan x V E v u:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`u: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,D,C,B}`]
THEN STRIP_TAC
THEN MRESA_TAC aff_gt_3_1_INTER_aff_SUBSET_aff_gt_2_14[`x:real^3`;`w:real^3`;`u:real^3`;`v:real^3`;]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`]
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B,C}={A,C,B}`]
THEN REWRITE_TAC[INTERS;INTER;SUBSET;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THENL[
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN SUBGOAL_THEN`(?y. y IN ds /\
aff_gt {x, v, u} {sigma_fan x V E v u} =
aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y):real^3})`
ASSUME_TAC
THENL[
EXISTS_TAC`f1:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`]
THEN POP_ASSUM (fun th-> MRESA1_TAC th`w:real^3`);
STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`aff_gt {x, v, u} {sigma_fan x V E v u:real^3}`)
THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`x':real^3`)];
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN STRIP_TAC
THEN SUBGOAL_THEN `(?y. y IN ds /\
aff_gt {x, u, w} {v} =
aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y):real^3})`
ASSUME_TAC
THENL[
EXISTS_TAC`f2:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`]
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3`
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[f1_fan]
THEN ASM_REWRITE_TAC[pr3]];
STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`aff_gt {x, u, w} {v:real^3}`)
THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th`x':real^3`)]]);;
let lemma_HYUAZSE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30 U U1.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
/\ INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} = U1
/\ U= dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w}
==> U1 SUBSET U`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`]
THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`]
THEN MRESA_TAC INTERS_HALF_SPACE_DS_FANADD3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`U1:real^3->bool`]
THEN MRESA_TAC SPACE3_EQ_UNION_3SET
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]);;
let DART_FANADD_SUBSET_HALFSPACE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> dartset_leads_into_fan x V E1 ds1 SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3`
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[f1_fan]
THEN ASM_REWRITE_TAC[pr3]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC ds1_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC FANADD_CONFORMING[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[conforming_fan;conforming_half_space_fan]
THEN REPEAT STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`ds1:real^3#real^3#real^3#real^3->bool`)
THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E1 ds1 =
INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E1 y)} | y IN ds1}
==> (!y. y IN ds1 ==> dartset_leads_into_fan x V E1 ds1 SUBSET aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E1 y):real^3})`)
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[] THEN REWRITE_TAC[SYM th])
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E1 v w:real^3) IN ds1`ASSUME_TAC
THENL[
FIND_ASSUM(fun th-> REWRITE_TAC[SYM th;face;orbit_map;IN_ELIM_THM])`face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w) = ds1:real^3#real^3#real^3#real^3->bool`
THEN EXISTS_TAC`0`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>=0`;POWER;I_DEF];
MRESAL_TAC condition_f1_fan_in_face_set[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`((x,w,inverse1_sigma_fan x V E1 w v,v):real^3#real^3#real^3#real^3)` ;`((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`;`ds1:real^3#real^3#real^3#real^3->bool`][f1_fan]
THEN REMOVE_THEN "LINH"(fun th-> MRESAL1_TAC th `(x,w,inverse1_sigma_fan x V E1 w v,v:real^3)`[f1_fan;pr3;pr2]
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> {v, w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESAL1_TAC th `(x,v,w,sigma_fan x V E1 v w:real^3)`[f1_fan;pr3;pr2])
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN RESA_TAC
THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`;`v:real^3`;]
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;`(v:real^3)`;`w: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 RESA_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`; ]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E1 w v:real^3`;`v :real^3`;]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"CHANGE")
THEN STRIP_TAC
THEN REMOVE_THEN "CHANGE" MP_TAC
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th[`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,C,D,B}`]
THEN RESA_TAC
THEN MRESA_TAC NOT_COPLANAR_NOT_COLLINEAR [`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u: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 POP_ASSUM MP_TAC
THEN GEN_REWRITE_TAC(LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u:real^3`; ]
THEN MRESA_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u :real^3`;]]]);;
let DART_FANADD_SUBSET_HALFSPACE1=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> dartset_leads_into_fan x V E1 ds2 SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3`
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[f1_fan]
THEN ASM_REWRITE_TAC[pr3]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC ds2_in_face_set_fanadd[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC card_ds2_fanadd_eq3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC reperentation_of_ds2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN REWRITE_TAC[SET_RULE`{pr2 y | y IN {f10, f20, f30}}={pr2 f10, pr2 f20, pr2 f30}`]
THEN EXPAND_TAC"f10"
THEN EXPAND_TAC"f20"
THEN EXPAND_TAC"f30"
THEN REWRITE_TAC[pr2]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u:real^3`] THEN 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 MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MP_TAC(SET_RULE`{u,w} IN E/\ E UNION {{v, w:real^3}} = E1==>{v, w} IN E1 /\ {u,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC SIGMA_FAN_OF_FANADD_AT_POINT3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`v:real^3`;`u:real^3`; `w:real^3` ]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E1)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`v:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E1:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`v:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(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 MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(u:real^3)`]
THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`v:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`v:real^3`;`w:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,B,D,C}`]
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_TAC[SET_RULE`A INTER B INTER C= A INTER C INTER B`]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th;])
THEN SUBGOAL_THEN`wedge x w v u SUBSET wedge x w (inverse1_sigma_fan x V E w u:real^3) u` ASSUME_TAC
THENL[
REWRITE_TAC[wedge;IN_ELIM_THM;SUBSET]
THEN STRIP_TAC THEN STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(REAL_ARITH`azim x w v x' < azim x w v (u:real^3)==> azim x w v x' <= azim x w v u`)
THEN RESA_TAC
THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`w:real^3`;`v:real^3`;`x':real^3`;`u: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 w v x' < azim x w v (u:real^3)/\ azim x w v u = azim x w v x' + azim x w x' (u:real^3) /\ &0 < azim x w v x' ==> &0< azim x w x' u /\ azim x w x' u < azim x w v u`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC azim_trangle_le_azim_face_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`u:real^3`; `w:real^3`;` (inverse1_sigma_fan x V E w u):real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`]
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`azim x w v u < azim x w (inverse1_sigma_fan x V E w u) u
/\ azim x w x' u < azim x w v u
==>
azim x w x' u < azim x w (inverse1_sigma_fan x V E w u) u
/\
azim x w x' u <= azim x w (inverse1_sigma_fan x V E w u) (u:real^3)`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`;
`(w:real^3)`]
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`x':real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{B,C}={C,B}`]
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`azim x w (inverse1_sigma_fan x V E w u:real^3) u =
azim x w (inverse1_sigma_fan x V E w u) x' + azim x w x' u
/\ azim x w x' u < azim x w (inverse1_sigma_fan x V E w u) u
/\ &0< azim x w x' u
==>
&0 < azim x w (inverse1_sigma_fan x V E w u) x' /\
azim x w (inverse1_sigma_fan x V E w u) x' <
azim x w (inverse1_sigma_fan x V E w u) x' + azim x w x' u
`)
THEN ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`;
`(w:real^3)`]
THEN REMOVE_THEN "YEU EM"(fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`])
THEN MRESA_TAC WEDGE_LUNE_GT[`x:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`u: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 properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`]
THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_2_2[`x:real^3`;`(inverse1_sigma_fan x V E w u):real^3`;`w:real^3`;`u:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={B,C,A}`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SET_TAC[]]]);;
let DART_FANADD_SUBSET_HALFSPACE2=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> aff_gt {x} {v,w} SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN SUBGOAL_THEN`f2= (x, pr2 f2,pr3 f2,sigma_fan x V E (pr2 f2) (pr3 f2)):real^3#real^3#real^3#real^3`ASSUME_TAC
THENL[
MATCH_MP_TAC EQ_PAIR_IMP_EQ_4_FAN
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN REWRITE_TAC[pr3;pr2;PAIR_EQ]
THEN ASM_REWRITE_TAC[]
THEN ASM_TAC
THEN REWRITE_TAC[pr2;pr3]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN ASM_REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
FIND_ASSUM (fun th-> REWRITE_TAC[SYM th])`f1_fan (x:real^3) V E f2 = f3`
THEN POP_ASSUM(fun th-> ONCE_REWRITE_TAC[th])
THEN REWRITE_TAC[f1_fan]
THEN ASM_REWRITE_TAC[pr3]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `u:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MP_TAC(SET_RULE` E UNION {{v, w:real^3}} = E1==> { v,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E1:(real^3->bool)->bool) `;` (w:real^3)`;
`(v:real^3)`]
THEN MRESA_TAC aff_gt_inter_aff_gt[`(x:real^3)`;`(v:real^3)`;`(w:real^3)`]
THEN MATCH_MP_TAC(SET_RULE`A SUBSET B ==> C INTER A SUBSET B`)
THEN MRESAL_TAC AFF_GT_2_1[`x:real^3`;`w:real^3`;`v:real^3`][IN_ELIM_THM]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`])
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;`(inverse1_sigma_fan x V E w u):real^3`;
`(w: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 cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`u:real^3`;`inverse1_sigma_fan x V E w u: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 properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3`;`w:real^3`;`(inverse1_sigma_fan x V E w u):real^3`]
THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`;`u:real^3`][IN_ELIM_THM]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,B,C}`]
THEN RESA_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_TAC[SUBSET;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`(t1 % x + t2 % w + t3 % v) - x= ((t1+t2+t3)- &1) % x+ t2 % (w-x) +t3 % (v-x)`; VECTOR_ARITH`(&1 - &1) % x + t2 % (w - x) + t3 % (v - x)= t2 % (w - x) + t3 % (v - x)`;DOT_RMUL;DOT_RADD;DOT_CROSS_SELF;REAL_ARITH`A * &0 +B=B`]
THEN MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`;`v:real^3`;`inverse1_sigma_fan x V E w u:real^3`;]
THEN POP_ASSUM MATCH_MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(SET_RULE`{w, inverse1_sigma_fan x V E w u} IN E /\ {u,w} IN E/\ E UNION {{v, w:real^3}} = E1==>{w, inverse1_sigma_fan x V E w u} IN E1 /\ {u,w} IN E1`)
THEN RESA_TAC
THEN MRESA_TAC inverse1_sigma_fan_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E1:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC FAN80_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th-> MRESA_TAC th [`w:real^3`;`inverse1_sigma_fan x V E w u:real^3`])]);;
let DART_FANADD_SUBSET_HALFSPACE3= prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> dartset_leads_into_fan x V E ds SUBSET aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3) }`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION
dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION
aff_gt {x} {v, w}:real^3->bool`]
THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE1[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE2[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]);;
let DART_FANADD_SUBSET_HALFSPACE4=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> dartset_leads_into_fan x V E ds SUBSET INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds}`,
REPEAT GEN_TAC
THEN STRIP_TAC
THEN REWRITE_TAC[SET_RULE`dartset_leads_into_fan x V E ds SUBSET INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds} <=> (!y. y IN ds ==> dartset_leads_into_fan x V E ds SUBSET aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) })`]
THEN REPEAT STRIP_TAC
THEN MRESA_TAC INDUCTION_FANADD[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`y:real^3#real^3#real^3#real^3`]
THEN ABBREV_TAC`v'= pr2 (f1':real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`u'= pr2 (f2':real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`w'= pr2 (f3':real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`E1'= E UNION {{v':real^3, w':real^3}}`
THEN ABBREV_TAC`ds1'= face (hypermap1_of_fanx (x,V,E1')) ((x,v',w',sigma_fan x V E1' v' w'):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`ds2'= face (hypermap1_of_fanx (x,V,E1')) ((x,w',v',sigma_fan x V E1' w' v'):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f10'= ((x,w',v',u'):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f20'= ((x,v',u',w'):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f30'= ((x,u',w',v'):real^3#real^3#real^3#real^3)`
THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE3[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1':(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1':real^3#real^3#real^3#real^3)` ;`(f2':real^3#real^3#real^3#real^3)`;`(f3':real^3#real^3#real^3#real^3)`;`v':real^3`;`u':real^3`; `w':real^3`;`ds1':real^3#real^3#real^3#real^3->bool`;`ds2':real^3#real^3#real^3#real^3->bool` ;`(f10':real^3#real^3#real^3#real^3)`;`(f20':real^3#real^3#real^3#real^3)`;`(f30':real^3#real^3#real^3#real^3)`]);;
let DART_FANADD_EQ_HALFSPACE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) E1 ds f1 f2 f3 v u w ds1 ds2 f10 f20 f30.
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)) /\ CARD ds >3
/\ {f1,f2,f3} SUBSET ds /\ f1_fan x V E f1=f2 /\ f1_fan x V E f2 =f3 /\ ~(f1_fan x V E f3 =f1)
/\ pr2 f1 =v /\ pr2 f2 =u /\ pr2 f3=w
/\ {v,u} IN E /\ {u,w} IN E /\ ~({w,v} IN E)
/\ sigma_fan x V E u w = v /\ pr3 f1= u /\ pr3 f2= w
/\ face (hypermap1_of_fanx (x,V,E1)) (x,v,w,sigma_fan x V E1 v w)= ds1
/\ face (hypermap1_of_fanx (x,V,E1)) (x,w,v,sigma_fan x V E1 w v)=ds2
/\ (x,w,v,u)=f10
/\ (x,v,u,w)=f20
/\ (x,u,w,v)=f30
/\ E UNION {{v,w}}= E1
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> dartset_leads_into_fan x V E ds = INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN ds}`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"EM")
THEN MRESA_TAC STEP3_REDUCE_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; `(E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`;`(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3` ]
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 MRESA_TAC hypermap_of_fan_rep[`x:real^3`;`V:real^3->bool`;`(E1:(real^3->bool)->bool)`;`(\t. res (t x V E1) (d1_fan (x,V,E1)))`]
THEN MRESA_TAC add_edge_imp_card_set_edge_ge1_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`{f1,f2,f3} SUBSET ds/\ ds SUBSET d1_fan (x:real^3,V,E)==> f1 IN d1_fan (x,V,E) /\ f2 IN d1_fan (x,V,E) /\ f3 IN d1_fan (x,V,E)/\ f1 IN ds /\ f2 IN ds /\ f3 IN ds`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MRESA_TAC YFANADD_AFF_GT[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC rep_dartset_leads_into_fan_ds[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION
dartset_leads_into_fan x (V:real^3->bool) E1 ds2 UNION
aff_gt {x} {v, w}:real^3->bool`]
THEN MRESA_TAC DART_FANADD_SUBSET_HALFSPACE4[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;]
THEN MRESA_TAC lemma_HYUAZSE
[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`ds:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`;`dartset_leads_into_fan x V E1 ds1 UNION dartset_leads_into_fan x V E1 ds2 UNION aff_gt {x} {v, w:real^3}`;`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y) } | y IN (ds:real^3#real^3#real^3#real^3->bool)}`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]);;
let HYUAZSE=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ (!E1. FAN(x,V,E1) /\
(!v. v IN V==>CARD (set_of_edge v V E1) > 1) /\
fan80(x,V,E1)/\
N_FAN(x,V,E1)< N_FAN(x,V,E) ==> conforming_fan (x,V,E1))
==> conforming_half_space_fan(x,V,E)`,
REWRITE_TAC[conforming_half_space_fan]
THEN REPEAT GEN_TAC
THEN STRIP_TAC
THEN REPEAT GEN_TAC
THEN STRIP_TAC
THEN MRESA_TAC CARD_FACE_SET_GE_3_FULLY_SURROUNDED_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`(f):real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(ARITH_RULE`3<= CARD (f:real^3#real^3#real^3#real^3->bool)==> CARD f=3 \/ CARD f>3`)
THEN RESA_TAC
THENL[
MRESA_TAC KVQWYDL_lemma10[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM(th);])
THEN MRESA_TAC CARD_FACE_SET_EQ_3_FULLY_SURROUNDED_FAN1[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`f:real^3#real^3#real^3#real^3->bool`]
THEN ASM_REWRITE_TAC[SET_RULE`INTERS {aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)} | y IN {f1, f2, f3}}
= aff_gt {x, pr2 f1, pr3 f1} {pr3 (f1_fan x V E f1)} INTER aff_gt {x, pr2 f2, pr3 f2} {pr3 (f1_fan x V E f2)} INTER aff_gt {x, pr2 f3, pr3 f3} {pr3 (f1_fan x V E f3)}`;SET_RULE`{pr2 y | y IN {f1, f2, f3}}={pr2 f1, pr2 f2, pr2 f3}`]
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MP_TAC th
THEN REWRITE_TAC[fan80] THEN ASSUME_TAC th)
THEN DISCH_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`pr2 f2:real^3`;`pr2 f3:real^3`])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(pr2 f1):real^3`;`(pr2 f2):real^3`;`(pr2 f3):real^3`]
THEN MRESA_TAC inter_aff_gt_3_1_is_aff_gt_1_3[`x:real^3`;`(pr3 f3):real^3`;`(pr3 f1):real^3`;`(pr3 f2):real^3`];
MRESA_TAC nonconformin_fan_imp_exist_3point_in_face[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`f:real^3#real^3#real^3#real^3->bool`]
THEN ABBREV_TAC`v= pr2 (f1:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`u= pr2 (f2:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`w= pr2 (f3:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`E1= E UNION {{v:real^3, w:real^3}}`
THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E1)) ((x,v,w,sigma_fan x V E1 v w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E1)) ((x,w,v,sigma_fan x V E1 w v):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f10= ((x,w,v,u):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f20= ((x,v,u,w):real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`f30= ((x,u,w,v):real^3#real^3#real^3#real^3)`
THEN MRESA_TAC DART_FANADD_EQ_HALFSPACE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`; ` (E1:(real^3->bool)->bool)`;
`f:real^3#real^3#real^3#real^3->bool`; `(f1:real^3#real^3#real^3#real^3)` ;`(f2:real^3#real^3#real^3#real^3)`;`(f3:real^3#real^3#real^3#real^3)`;`v:real^3`;`u:real^3`; `w:real^3`;`ds1:real^3#real^3#real^3#real^3->bool`;`ds2:real^3#real^3#real^3#real^3->bool` ;`(f10:real^3#real^3#real^3#real^3)`;`(f20:real^3#real^3#real^3#real^3)`;`(f30:real^3#real^3#real^3#real^3)`]]);;
let PIIJBJK=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
==> conforming_fan(x,V,E)`,
REPEAT STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`~(conforming_fan (x,V,E))\/ (conforming_fan (x:real^3,V,E))`)
THENL[
ABBREV_TAC`S= {(N_FAN(x':real^3,V',E1))| x'= x /\ V'= V /\ FAN(x,V,E1)/\ (!v. v IN V'==>CARD (set_of_edge v V' E1) > 1)
/\ fan80(x',V',E1) /\ ~(conforming_fan (x',V',E1))}`
THEN ABBREV_TAC`n= (minimal) (S:num->bool)`
THEN SUBGOAL_THEN`?y. y IN (S:num->bool)`ASSUME_TAC
THENL[
EXPAND_TAC"S"
THEN REWRITE_TAC[IN_ELIM_THM]
THEN EXISTS_TAC`(N_FAN(x:real^3,V,E))`
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`V:real^3->bool`
THEN EXISTS_TAC`E:(real^3->bool)->bool`
THEN ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN REWRITE_TAC[IN]
THEN DISCH_TAC
THEN MRESA1_TAC MINIMAL`S:num->bool`
THEN SUBGOAL_THEN`n IN (S:num->bool)` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[IN];
POP_ASSUM MP_TAC
THEN EXPAND_TAC"S"
THEN REWRITE_TAC[IN_ELIM_THM]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINHYEU")
THEN STRIP_TAC
THEN SUBGOAL_THEN`(!E2. FAN(x:real^3,V,E2) /\
(!v. v IN V==>CARD (set_of_edge v V E2) > 1) /\
fan80(x,V,E2)/\
N_FAN(x,V,E2)< N_FAN(x,V,E1) ==> conforming_fan (x,V,E2))
`ASSUME_TAC
THENL[
REPEAT STRIP_TAC
THEN REMOVE_THEN "LINHYEU"(fun th-> MRESA1_TAC th`N_FAN (x:real^3,V,E2)` )
THEN MP_TAC(SET_RULE`~ (S (N_FAN (x:real^3,V,E2))) ==> ~(N_FAN (x,V,E2) IN S) `)
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC"S"
THEN REWRITE_TAC[IN_ELIM_THM;GSYM FORALL_NOT_THM;DE_MORGAN_THM]
THEN STRIP_TAC
THEN POP_ASSUM(fun th -> MRESA_TAC th[`x:real^3`;`V:real^3->bool`;`E2:(real^3->bool)->bool`]);
MRESA_TAC nonconformin_fan_imp_n_fan_ge0[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC HYUAZSE[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC TXFBALB_VERSION
[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC GGZWYRM
[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`]
THEN MRESA_TAC conforming_bijection_fanadd_verrion
[`x':real^3`;`(V':real^3->bool)`;`(E1:(real^3->bool)->bool)`]
THEN FIND_ASSUM MP_TAC`~conforming_fan (x':real^3,V',E1)`
THEN REWRITE_TAC[conforming_fan]
THEN ASM_REWRITE_TAC[conforming_bijection_fan]]]];
ASM_REWRITE_TAC[]]);;
let expand_xfan_eq_aff_gt_aff_ge=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
==> UNIONS {y | ?e. e IN E /\ y = aff_ge {x} e}= (UNIONS {aff_gt {x} e | e IN E}) UNION (UNIONS {aff_ge {x} {v}| v IN V})`,
REWRITE_TAC[UNIONS;UNION;]
THEN ONCE_REWRITE_TAC[EXTENSION]
THEN REWRITE_TAC[IN_ELIM_THM;]
THEN REPEAT STRIP_TAC
THEN EQ_TAC
THENL[
REPEAT STRIP_TAC
THEN POP_ASSUM MP_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(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN 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 aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (w:real^3)`]
THEN REWRITE_TAC[UNION]
THEN RESA_TAC
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THENL[
SUBGOAL_THEN`(?u1. (?e. e IN E /\ u1 = aff_gt {x:real^3} e) /\ x' IN u1)`ASSUME_TAC
THENL[
EXISTS_TAC`aff_gt {x} {v, w:real^3}`
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`{v,w:real^3}`
THEN ASM_REWRITE_TAC[];
ASM_REWRITE_TAC[]];
SUBGOAL_THEN`(?u1. (?v. v IN V /\ u1 = aff_ge {x} {v:real^3}) /\ x' IN u1)` ASSUME_TAC
THENL[
EXISTS_TAC`aff_ge {x} {v:real^3}`
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];
ASM_REWRITE_TAC[]];
SUBGOAL_THEN`(?u1. (?v. v IN V /\ u1 = aff_ge {x} {v:real^3}) /\ x' IN u1)` ASSUME_TAC
THENL[
EXISTS_TAC`aff_ge {x} {w:real^3}`
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`w:real^3`
THEN ASM_REWRITE_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;
ASM_REWRITE_TAC[]]];
REPEAT STRIP_TAC
THENL[
POP_ASSUM MP_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(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN 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 RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC aff_gt_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3`]
THEN MP_TAC(SET_RULE`x' IN aff_gt {x} {v, w} /\ aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w}
==> x' IN aff_ge {x:real^3} {v, w}`)
THEN RESA_TAC
THEN EXISTS_TAC`aff_ge {x:real^3} {v, w}`
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`{v,w:real^3}`
THEN ASM_REWRITE_TAC[];
POP_ASSUM MP_TAC
THEN RESA_TAC
THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V`
THEN STRIP_TAC
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 REMOVE_ASSUM_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 POP_ASSUM MP_TAC
THEN RESA_TAC
THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (u':real^3)`]
THEN MP_TAC(SET_RULE`aff_ge {x} {v, u'} =
aff_gt {x} {v, u'} UNION aff_ge {x} {v} UNION aff_ge {x} {u'}
/\ x' IN aff_ge {x} {v}
==> x' IN aff_ge {x} {v, u':real^3} `)
THEN RESA_TAC
THEN EXISTS_TAC`aff_ge {x} {v, u':real^3}`
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`{v,u':real^3}`
THEN ASM_REWRITE_TAC[]]]);;
let properties12_fan7=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
==> (UNIONS {aff_gt {x} e | e IN E}) INTER (UNIONS {aff_ge {x} {v}| v IN V})={}`,
REWRITE_TAC[SET_RULE`A={} <=> ~(?y. y IN A)`;IN_ELIM_THM;UNIONS;INTER]
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 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(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN 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 aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v':real^3)`;` (w:real^3)`]
THEN POP_ASSUM (fun th-> MP_TAC(SYM th) THEN STRIP_TAC)
THEN RESA_TAC
THEN RESA_TAC
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V`
THEN STRIP_TAC
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 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 AFF_GE_1_1[`x:real^3`;`v:real^3`]
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THEN SUBGOAL_THEN `v IN aff_gt {x} {v',w:real^3}` ASSUME_TAC
THENL(*1*)[
MRESA_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w:real^3`]
THEN FIND_ASSUM MP_TAC`y IN aff_gt {x} {v', w:real^3}`
THEN POP_ASSUM (fun th-> REWRITE_TAC[th;IN_ELIM_THM])
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`&0 <= t2==> t2= &0 \/ &0 < t2`)
THEN RESA_TAC
THENL(*2*)[
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th; REAL_ARITH`A+ &0=A`] THEN REPEAT STRIP_TAC)
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % x + &0 % v = t1' % x + t2' % v' + t3 % w <=> t2' %(v'-x) + t3 %(w-x)= (&1-(t1'+t2'+t3))%x`;VECTOR_ARITH`t2' % (v' - x) + t3 % (w - x) = (&1 - &1) % x<=> t3 % w= (t3 +t2') % x + (-- t2') % v' `]
THEN FIND_ASSUM MP_TAC`~(w IN aff {x, v':real^3})`
THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM]
THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_MUL_LINV`t3:real`
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE`t3 % w = (t3 + t2') % x + --t2' % v' ==> (inv (t3)) %(t3%w) = inv (t3)%((t3 + t2') % 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 `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
THEN STRIP_TAC
THEN SUBGOAL_THEN`?u1 v1. u1 + v1 = &1 /\ w = u1 % x + v1 % v':real^3` ASSUME_TAC
THENL(*3*)[
EXISTS_TAC`inv t3 * (t3 + t2'):real`
THEN EXISTS_TAC`(inv t3 * --t2'):real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * (t3 + t2') + inv t3 * --t2'= inv t3 * t3 `];(*3*)
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]](*2*);
POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"A")
THEN STRIP_TAC
THEN REMOVE_THEN "A" MP_TAC
THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v = t1' % x + t2' % v' + t3 % w
<=> t2 % v = (t1'- t1) % x + t2' % v' + t3 % w`]
THEN MP_TAC(REAL_ARITH`&0< t2 ==> ~(t2= &0)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_MUL_LINV`t2:real`
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`t2 % v = (t1' - t1) % x + t2' % v' + t3 % w ==> (inv (t2)) %(t2 % v) = inv (t2)%((t1' - t1) % 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)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
THEN STRIP_TAC
THEN MP_TAC(ISPEC`(t2:real)`REAL_LT_INV)
THEN RESA_TAC
THEN MP_TAC(ISPECL[`inv (t2:real)`;`(t2':real)`]REAL_LT_MUL)
THEN RESA_TAC
THEN MP_TAC(ISPECL[`inv (t2:real)`;`(t3:real)`]REAL_LT_MUL)
THEN RESA_TAC
THEN EXISTS_TAC`(inv t2 * (t1' - t1)):real`
THEN EXISTS_TAC`(inv t2 * t2'):real`
THEN EXISTS_TAC`(inv t2 * t3):real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2 * (t1' - t1) + inv t2 * t2' + inv t2 * t3
= inv t2 * (t2+(t1'+t2'+t3)- (t1+t2))`;REAL_ARITH`A+ &1 - &1=A`]];(*1*)
MP_TAC(SET_RULE`v IN aff_gt {x} {v', w} /\ aff_ge {x} {v', w} =
aff_gt {x} {v', w} UNION aff_ge {x} {v'} UNION aff_ge {x} {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 RESA_TAC
THENL[
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[SYM th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v:real^3`;`w:real^3`][IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[VECTOR_ARITH`v = t1' % x + t2' % v + t3 % w
<=> t3 % w = (--t1') % x +(&1 - t2') % v`]
THEN MP_TAC(REAL_ARITH`&0< t3==> ~(t3= &0)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_MUL_LINV`t3:real`
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE`t3 % w = (--t1') % x + (&1 -t2') % v ==> (inv (t3)) %(t3%w) = inv (t3)%((--t1') % x + (&1 -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 `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
THEN STRIP_TAC
THEN FIND_ASSUM MP_TAC`~(w IN aff {x, v:real^3})`
THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM]
THEN EXISTS_TAC`(inv t3 * --t1'):real`
THEN EXISTS_TAC`(inv t3 * (&1 - t2')):real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv t3 * --t1' + inv t3 * (&1 - t2')= inv t3 *( t3+ &1 -(t1'+t2' +t3))`;REAL_ARITH`A+ &1- &1=A`];
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN REPEAT STRIP_TAC)
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v':real^3`;`w:real^3`][IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[VECTOR_ARITH`w = t1' % x + t2' % v + t3 % w
<=> (t2') % v = (--t1') % x +(&1 - t3) % w`]
THEN MP_TAC(REAL_ARITH`&0< t2' ==> ~(t2'= &0)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_MUL_LINV`t2':real`
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE`t2' % v' = (--t1') % x + (&1 -t3) % w ==> (inv (t2')) %(t2' %v') = inv (t2')%((--t1') % x + (&1 -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)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
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 STRIP_TAC
THEN FIND_ASSUM MP_TAC`~(v' IN aff {w,x:real^3})`
THEN REWRITE_TAC[aff;AFFINE_HULL_2;IN_ELIM_THM]
THEN EXISTS_TAC`(inv t2' * (&1 - t3)):real`
THEN EXISTS_TAC`(inv t2' * --t1'):real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv t2' * (&1 - t3) + inv t2' * --t1' = inv t2' *( t2'+ &1 -(t1'+t2' +t3))`;REAL_ARITH`A+ &1- &1=A`;VECTOR_ARITH`A+B=B+A:real^3`]]]);;
let yfan_union_aff_gt_fan=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool).
FAN(x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
==> yfan(x,V,E) UNION (UNIONS {aff_gt {x} e | e IN E}) = (:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V})`,
REPEAT STRIP_TAC
THEN REWRITE_TAC[yfan;XFAN_EQ_UNIONS_AFF_GE_1_2;]
THEN MRESA_TAC expand_xfan_eq_aff_gt_aff_ge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN MRESA_TAC properties12_fan7[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`]
THEN POP_ASSUM MP_TAC
THEN SET_TAC[]);;
let exists_point_in_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 dartset_leads_into_fan x V E ds`,
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 RESA_TAC
THEN EXISTS_TAC`y:real^3`
THEN MRESA_TAC CONNECTED_COMPONENT_REFL[`yfan(x:real^3,V:real^3->bool,E)`;`y:real^3`]
THEN ASM_REWRITE_TAC[IN]);;
let NEGLIGIBLE_AFF_3_FAN=prove(`!(x:real^3) (V:real^3->bool) (E:(real^3->bool)->bool) z:real^3.
FAN (x,V,E) ==> negligible (UNIONS {aff {x, z, v} | v IN V} )`,
REPEAT STRIP_TAC
THEN POP_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[FAN;fan1] THEN STRIP_TAC THEN ASSUME_TAC th)
THEN MATCH_MP_TAC NEGLIGIBLE_UNIONS
THEN MRESAL_TAC FINITE_IMAGE[`(\e:real^3. aff {x:real^3,z:real^3,e})`;`V:(real^3->bool)`][IMAGE]
THEN SUBGOAL_THEN`{aff {x, z, v} | v IN V} = {y | ?x'. x' IN V /\ y = aff {x, z, x':real^3}} `(fun th-> ASM_REWRITE_TAC[th])
THENL[
REWRITE_TAC[EXTENSION;IN_ELIM_THM];
REWRITE_TAC[IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[NEGLIGIBLE_AFF_3]]);;
let MEASURE_AFF_3_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3.
FAN (x,V,E) ==> measure (UNIONS {aff {x, z, v} | v IN V})= &0`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0
THEN POP_ASSUM MP_TAC
THEN MESON_TAC[NEGLIGIBLE_AFF_3_FAN]);;
let NEGLIGIBLE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real.
FAN (x,V,E) ==>
negligible ((UNIONS {aff {x, z, v} | v IN V} ) INTER normball y r)`,
REPEAT STRIP_TAC
THEN MATCH_MP_TAC NEGLIGIBLE_SUBSET
THEN EXISTS_TAC `(UNIONS {aff {x, z, v:real^3} | v IN V} )`
THEN ASM_SIMP_TAC[ SET_RULE`A INTER B SUBSET A`]
THEN ASM_MESON_TAC[NEGLIGIBLE_AFF_3_FAN;]);;
let MEASURE_AFF_3_UNION_FAN=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real.
FAN (x,V,E) ==> measure (UNIONS {aff {x, z, v} | v IN V} INTER normball y r)= &0`,
REPEAT STRIP_TAC THEN MATCH_MP_TAC MEASURE_EQ_0
THEN POP_ASSUM MP_TAC
THEN MESON_TAC[NEGLIGIBLE_AFF_3_UNION_INTER_BALL]);;
let HAS_MEASURE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real.
FAN (x,V,E) ==> (UNIONS {aff {x, z, v} | v IN V} INTER normball y r) has_measure &0`,
REPEAT STRIP_TAC
THEN ASM_MESON_TAC[NEGLIGIBLE_AFF_3_UNION_INTER_BALL;HAS_MEASURE_0]);;
let MEASURABLE_AFF_3_UNION_INTER_BALL=prove(`!x:real^3 V:real^3->bool E:(real^3->bool)->bool z:real^3 y:real^3 r:real.
FAN (x,V,E) ==> measurable (UNIONS {aff {x, z, v} | v IN V} INTER normball y r)`,
REPEAT STRIP_TAC
THEN ASM_SIMP_TAC[measurable;]
THEN EXISTS_TAC`&0`
THEN MRESA_TAC HAS_MEASURE_AFF_3_UNION_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`]
);;
let measure_ball_diff_set_negligible=prove(`!x:real^3 V E z y r.
FAN(x,V,E)/\ &0<= r
==> measure ( (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V}))= &4/ &3 *pi *r pow 3`,
REPEAT STRIP_TAC
THEN MRESA_TAC MEASURE_AFF_3_UNION_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`]
THEN MRESA_TAC MEASURABLE_AFF_3_UNION_INTER_BALL[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`]
THEN MRESA_TAC VOLUME_BALL[`y:real^3`;`r:real`]
THEN MRESAL_TAC MEASURE_DIFF_SUBSET[`normball (y:real^3) (r:real)`;`(UNIONS {aff {x,z,v:real^3}| v IN V}) INTER (normball y r)`][GSYM ball_eq_normball;MEASURABLE_BALL;SET_RULE`(UNIONS {aff {x,z,v:real^3}| v IN V}) INTER ball (y,r) SUBSET ball (y,r)`;SET_RULE`A DIFF(B INTER A)= A DIFF B`]
THEN ASM_SIMP_TAC[VOLUME_BALL;]
THEN REAL_ARITH_TAC);;
let exists_measure_ball_diff_set_negligible=prove(`!x:real^3 V E y z r.
FAN(x,V,E)/\ &0< r
==> ?a. a IN (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V})`,
REPEAT STRIP_TAC
THEN DISJ_CASES_TAC(SET_RULE`(normball y r) DIFF (UNIONS {aff {x,z,v:real^3}| v IN V}) ={} \/ ?a. a IN (normball y r) DIFF (UNIONS {aff {x,z,v}| v IN V})`)
THENL[
MP_TAC(REAL_ARITH`&0 &0<= r`)
THEN RESA_TAC
THEN
MRESAL_TAC measure_ball_diff_set_negligible[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`z:real^3 `;`y:real^3`;`r:real`][MEASURE_EMPTY; ]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`A=B <=> B=A`;REAL_ENTIRE;REAL_ARITH`~(&4/ &3 = &0)`;]
THEN MP_TAC(REAL_ARITH`&0< pi ==> ~(pi= &0)`)
THEN ASM_REWRITE_TAC[PI_WORKS;]
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`&0< r ==> ~(r= &0)`)
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC REAL_POW_EQ_0[`r:real`;`3`];
ASM_REWRITE_TAC[]]);;
let connected_in_dartset_leads_into_fan_union_aff_gt=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds ds1 Z.
FAN(x,V,E)
/\ conforming_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))
/\ ds1 IN face_set(hypermap1_of_fanx (x,V,E))
/\ Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V})
==> ?y z. y IN dartset_leads_into_fan x V E ds
/\ z IN dartset_leads_into_fan x V E ds1
/\ segment[y,z] SUBSET Z `,
REPEAT STRIP_TAC
THEN MRESA_TAC exists_point_in_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 MRESA_TAC exists_point_in_dartset_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
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 MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[open_def]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`y:real^3`)
THEN POP_ASSUM MP_TAC
THEN MRESAL_TAC exists_measure_ball_diff_set_negligible[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`y:real^3 `;`y':real^3`;`e:real`][normball;DIFF;IN_ELIM_THM]
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`a:real^3`)
THEN EXISTS_TAC`a:real^3`
THEN EXISTS_TAC`y':real^3`
THEN ASM_REWRITE_TAC[segment;SUBSET;IN_ELIM_THM;SET_RULE`(x:real^3) IN (:real^3)`]
THEN REPEAT STRIP_TAC
THEN REMOVE_THEN "LINH" MP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[UNIONS;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN EXISTS_TAC`aff{x,y',v:real^3}`
THEN STRIP_TAC
THENL(*1*)[
EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*1*)
POP_ASSUM MP_TAC
THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V`
THEN STRIP_TAC
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 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 AFF_GE_1_1[`x:real^3`;`v:real^3`]
THEN ASM_REWRITE_TAC[aff;AFFINE_HULL_3;IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC(REAL_ARITH`u <= &1 ==> u= &1 \/ &0< (&1 -u)`)
THEN RESA_TAC
THENL(*2*)[
REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % a + &1 % y'=y'`]
THEN STRIP_TAC
THEN SUBGOAL_THEN`y' IN xfan(x:real^3,V:real^3->bool,E)` ASSUME_TAC
THENL(*3*)[
REWRITE_TAC[XFAN_EQ_UNIONS_AFF_GE_1_2;UNIONS;IN_ELIM_THM]
THEN EXISTS_TAC`aff_ge {x} {v,u'':real^3}`
THEN STRIP_TAC
THENL(*4*)[
EXISTS_TAC`{v,u'':real^3}`
THEN ASM_REWRITE_TAC[];(*4*)
MRESAL_TAC AFF_GE_1_2[`x:real^3`;`v:real^3`;`u'':real^3`][IN_ELIM_THM]
THEN EXISTS_TAC`t1:real`
THEN EXISTS_TAC`t2:real`
THEN EXISTS_TAC`&0:real`
THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &0`;REAL_ARITH`A+B+ &0=A+B`;VECTOR_ARITH`A+B+ &0 % C=A+B`]](*4*);(*3*)
POP_ASSUM MP_TAC
THEN MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds1:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`dartset_leads_into_fan x V E ds1 SUBSET yfan (x,V,E) /\ y' IN dartset_leads_into_fan x V E ds1 ==> y' IN yfan (x:real^3,V:real^3->bool,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF]
THEN SET_TAC[]](*3*);(*2*)
MP_TAC(REAL_ARITH`&0< &1- u ==> ~((&1- u)= &0)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_MUL_LINV`&1- u:real`
THEN REWRITE_TAC[VECTOR_ARITH`(&1 - u) % a + u % y' = t1 % x + t2 % v <=>
(&1 - u) % a = t1 % x + (--u) % y' + t2 % v`]
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE`(&1 - u) % a = t1 % x + --u % y' + t2 % v ==> (inv (&1 - u)) %((&1 - u) % a ) = inv (&1 - u)%(t1 % x + --u % y' + 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 `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
THEN STRIP_TAC
THEN EXISTS_TAC`inv (&1 - u) * t1:real`
THEN EXISTS_TAC`inv (&1 - u) * --u:real`
THEN EXISTS_TAC`inv (&1 - u) * t2:real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv (&1 - u) * t1 + inv (&1 - u) * --u + inv (&1 - u) * t2=
inv (&1 - u) * ((t1+t2)- u)`]]]);;
let AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds y.
FAN(x,V,E)
/\ conforming_fan (x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ ~(E={})
/\ ds IN face_set (hypermap1_of_fanx (x,V,E))
/\ y IN dartset_leads_into_fan x V E ds
==> aff_gt {x} {y} SUBSET dartset_leads_into_fan x V E ds`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
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 MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds):real^3->bool`;` y:real^3`]
THEN MRESAL_TAC AFF_GT_1_1[`x:real^3`;`y:real^3`][SET_RULE`DISJOINT {x} {y} <=> ~(x=y)`]
THEN REMOVE_THEN"YEU" MP_TAC
THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)`
THEN REWRITE_TAC[conforming_fan;conforming_half_space_fan]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `ds:real^3#real^3#real^3#real^3->bool`)
THEN REWRITE_TAC[INTERS;IN_ELIM_THM;SUBSET]
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN SUBGOAL_THEN`(?y. y IN ds /\
aff_gt {x:real^3, pr2 y', pr3 y'} {pr3 (f1_fan x V E y')} =
aff_gt {x, pr2 y, pr3 y} {pr3 (f1_fan x V E y)})` ASSUME_TAC
THENL[
EXISTS_TAC`y':real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];
REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th`u:real^3->bool`)
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 MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESA_TAC face_subset_dart_fan[`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`y' IN ds /\ ds SUBSET d1_fan (x:real^3,V,E)==> y' IN d1_fan(x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN RESA_TAC
THEN REWRITE_TAC[pr2;pr3;f1_fan]
THEN MRESA_TAC fully_surrounded_imp_aff_gt_3_1_of_edge_eq_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
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 [`v:real^3`;`w: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 MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w: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 w:real^3`;`(v:real^3)`]
THEN POP_ASSUM MP_TAC
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 MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(sigma_fan x V E v w):real^3`;`v:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C,D}={A,D,C,B}`]
THEN RESA_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`;`sigma_fan x V E v w:real^3`;`w:real^3`]
THEN MRESAL_TAC aff_gt_3_1_rep_cross_dot[`x:real^3`;`v:real^3`;`w:real^3`;`sigma_fan x V E v w:real^3`;][IN_ELIM_THM;VECTOR_ARITH`(t1 % x + t2 % y) - x=((t1+t2)- &1)%x+ t2 % (y-x)`;VECTOR_ARITH`((&1 - &1) % x + t2 % (y - x))= t2 % (y - x)`;DOT_RMUL]
THEN STRIP_TAC
THEN MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[]]);;
let aff_gt_subset_dartset_leads_into_fan_union_aff_gt=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) ds ds1 Z y z .
FAN(x,V,E)
/\ conforming_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))
/\ ds1 IN face_set(hypermap1_of_fanx (x,V,E))
/\ Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v}| v IN V})
/\ y IN dartset_leads_into_fan x V E ds
/\ z IN dartset_leads_into_fan x V E ds1
/\ ~(x=y) /\ ~(x=z)
/\ segment[y,z] SUBSET Z
==> aff_gt {x} {y,z} SUBSET Z`,
REWRITE_TAC[segment;SUBSET;IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN FIND_ASSUM(fun th-> MP_TAC th THEN REWRITE_TAC[FAN;fan2] THEN STRIP_TAC)`FAN(x:real^3,V,E)`
THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][SET_RULE`DISJOINT{x} {y,z}<=> ~(x=y) /\ ~(x=z)`;IN_ELIM_THM;DIFF;SET_RULE`(x:real^3) IN (:real^3)`;UNIONS]
THEN STRIP_TAC
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]
THEN MP_TAC(SET_RULE`~(x IN V) /\ v IN V==> ~(x=v:real^3)`)
THEN RESA_TAC
THEN MRESA_TAC AFF_GE_1_1[`x:real^3`;`v:real^3`]
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % y + t3 % z = t1' % x + t2' % v
<=> t2 % y + t3 % z = (t1' - t1) % x + t2' % v`]
THEN MP_TAC(REAL_ARITH`&0< t2 /\ &0 < t3 ==> &0 < t2+ t3 /\ &0 <= t2+ t3 /\ ~(t2 +t3= &0)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_MUL_LINV`t2+t3:real`
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`t2 % y + t3 % z = (t1' - t1) % x + t2' % v ==> (inv (t2+ t3)) %(t2 % y + t3 % z) = inv (t2 +t3)%((t1' - 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 `;VECTOR_ARITH`A%(B+C)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
THEN STRIP_TAC
THEN ABBREV_TAC`v123= (inv (t2 + t3) * (t1' - t1)) % x + (inv (t2 + t3) * t2') % v:real^3`
THEN SUBGOAL_THEN`v123 IN aff_ge {x} {v:real^3}` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[IN_ELIM_THM]
THEN EXISTS_TAC`(inv (t2 + t3) * (t1' - t1)):real`
THEN EXISTS_TAC`(inv (t2 + t3) * t2'):real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv (t2 + t3) * (t1' - t1) + inv (t2 + t3) * t2'
= inv (t2 + t3) * ((t2+ t3)+ (t1'+ t2') - (t1+ t2+t3))`; REAL_ARITH`A + &1 - &1= A`]
THEN MATCH_MP_TAC REAL_LE_MUL
THEN ASM_REWRITE_TAC[]
THEN MRESA1_TAC REAL_LE_INV`t2+ t3`;
SUBGOAL_THEN`(?u. (&0 <= u /\ u <= &1) /\ v123 = (&1 - u) % y + u % z:real^3)` ASSUME_TAC
THENL[
EXISTS_TAC`(inv (t2 + t3) * t3)`
THEN ASM_REWRITE_TAC[REAL_ARITH`&1 - inv (t2 + t3) * t3= &1 - inv (t2 +t3) *(t2+ t3)+ inv(t2 +t3) * t2`; REAL_ARITH`&1 - &1 +A=A`; REAL_ARITH`A<= &1 <=> &0<= &1- A`]
THEN MRESA1_TAC REAL_LT_INV`t2+t3`
THEN MP_TAC(REAL_ARITH`&0 < inv (t2 + t3) /\ &0< t2 /\ &0< t3 ==> &0 <= inv (t2 + t3) /\ &0<= t2 /\ &0<= t3`)
THEN RESA_TAC
THEN STRIP_TAC
THEN MATCH_MP_TAC REAL_LE_MUL
THEN ASM_REWRITE_TAC[];
REMOVE_THEN "LINH"(fun th-> MRESAL1_TAC th`v123:real^3`[DIFF;IN_ELIM_THM;UNIONS])
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[]
THEN EXISTS_TAC`aff_ge {x} {v:real^3}`
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[]]]);;
let aff_gt_1_2_subset_aff_1_3111=prove(`!x y z v u w:real^3.
~coplanar {x,v,u,w}
/\ y IN aff_gt {x} {v,u}
/\ z IN aff_gt {x} {v,w}
==> aff_gt {x} {y,z} SUBSET aff_gt {x} {v,u,w}`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN DISCH_THEN(LABEL_TAC"LINH1")
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`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`u:real^3`;`y:real^3`]
THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`w:real^3`;`z:real^3`]
THEN MRESA_TAC th3[`x:real^3`;`y:real^3`;`v:real^3`]
THEN MRESA_TAC th3[`x:real^3`;`z:real^3`;`v:real^3`]
THEN REMOVE_THEN "LINH" MP_TAC
THEN REMOVE_THEN "LINH1" MP_TAC
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`;`w:real^3`][IN_ELIM_THM]
THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`]
THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u} <=> ~(x=v) /\ ~(x=u)`;SUBSET]
THEN REPEAT RESA_TAC
THEN REWRITE_TAC[VECTOR_ARITH` t1'' % x +
t2'' % (t1' % x + t2' % v + t3' % u) +
t3'' % (t1 % x + t2 % v + t3 % w)
= (t1''+ t2''* t1'+ t3'' *t1) % x +
(t2'' * t2'+ t3'' *t2) % v + (t2''* t3') % u +
(t3''* t3) % w`]
THEN EXISTS_TAC`t1'' + t2'' * t1' + t3'' * t1:real`
THEN EXISTS_TAC`t2'' * t2' + t3'' * t2:real`
THEN EXISTS_TAC`t2'' * t3':real`
THEN EXISTS_TAC`t3'' * t3:real`
THEN ASM_REWRITE_TAC[REAL_ARITH`(t1'' + t2'' * t1' + t3'' * t1) +
(t2'' * t2' + t3'' * t2) +
t2'' * t3' +
t3'' * t3 = t1'' +
t2'' * (t1' + t2'+ t3') +
t3'' * (t1 + t2 + t3 )`;REAL_ARITH`A * &1=A`]
THEN STRIP_TAC
THENL[
MATCH_MP_TAC (REAL_ARITH`&0< A/\ &0< B==> &0< A+B`)
THEN STRIP_TAC
THEN MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[];
STRIP_TAC
THEN MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[]]);;
let AFF_GT_1_3_SUBSET_AFF_GT_1_3=prove(`!x v u w:real^3 t:real.
~coplanar {x,v,u,w}/\ &0< t/\ t< &1
==> aff_gt {x} {v,u,(&1-t) %u+ t %w} SUBSET aff_gt {x} {v,u,w}`,
REPEAT STRIP_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`;`w:real^3`]
THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`u:real^3`]
THEN MRESA_TAC th3[`x:real^3`;`v:real^3`;`w:real^3`]
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 th3[`x:real^3`;`v:real^3`;`(&1-t) %u+ t %w:real^3`]
THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`]
THEN MRESAL_TAC AFF_GT_1_3[`x:real^3`;`v:real^3`;`u:real^3`;`(&1-t) %u+ t %w:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {v,u,w} <=> ~(x=v) /\ ~(x=u) /\ ~(x=w)`;SUBSET]
THEN REPEAT RESA_TAC
THEN EXISTS_TAC`t1:real`
THEN EXISTS_TAC`t2:real`
THEN EXISTS_TAC`t3 + t4 *( &1- t):real`
THEN EXISTS_TAC`t4 *t:real`
THEN ASM_REWRITE_TAC[VECTOR_ARITH`t1 % x + t2 % v + t3 % u + t4 % ((&1 - t) % u + t % w) =
t1 % x + t2 % v + (t3 + t4 * (&1 - t)) % u + (t4 * t) % w:real^3`;REAL_ARITH`t1 + t2 + (t3 + t4 * (&1 - t)) + t4 * t=t1 +t2+t3+t4`
]
THEN STRIP_TAC
THENL[
MATCH_MP_TAC (REAL_ARITH`&0< A /\ &0< B==> &0< A+B`)
THEN ASM_REWRITE_TAC[]
THEN MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- A<=> A< &1`];
MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0< &1- A<=> A< &1`]]);;
let lemma_connect_hypermap=prove(`!x:real^3 (V:real^3->bool) (E:(real^3->bool)->bool) f1 f2.
FAN(x,V,E)
/\ conforming_fan (x,V,E)
/\ (!v. v IN V==>CARD (set_of_edge v V E) > 1)
/\ fan80(x,V,E)
/\ f1 IN d_fan(x,V,E) /\ f2 IN d_fan(x,V,E)
==> ?D. D IN set_of_components(hypermap1_of_fanx (x,V,E))
/\ f1 IN D /\ f2 IN D`,
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN REPEAT STRIP_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 ABBREV_TAC`ds= face (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`ds1= face (hypermap1_of_fanx (x,V,E)) (f2:real^3#real^3#real^3#real^3)`
THEN ABBREV_TAC`Z=(:real^3) DIFF (UNIONS {aff_ge {x} {v:real^3}| v IN V})`
THEN SUBGOAL_THEN`ds IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*1*)[
ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3`
THEN EXPAND_TAC"ds"
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[];(*1*)
SUBGOAL_THEN`ds1 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*2*)[
ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`f2:real^3#real^3#real^3#real^3`
THEN EXPAND_TAC"ds1"
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[];(*2*)
SUBGOAL_THEN`f2 IN ds1:real^3#real^3#real^3#real^3->bool` ASSUME_TAC
THENL(*3*)[
EXPAND_TAC"ds1"
THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;(*3*)
SUBGOAL_THEN`f1 IN ds:real^3#real^3#real^3#real^3->bool` ASSUME_TAC
THENL(*4*)[
EXPAND_TAC"ds"
THEN REWRITE_TAC[face;orbit_map;IN_ELIM_THM]
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[POWER;I_DEF]
THEN ARITH_TAC;(*4*)
ABBREV_TAC`D= comb_component (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)`
THEN MRESA_TAC lemma_component_subset[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`]
THEN SUBGOAL_THEN`D IN set_of_components(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*5*)[
ASM_REWRITE_TAC[set_of_components;set_part_components;IN_ELIM_THM]
THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];(*5*)
SUBGOAL_THEN`(f1:real^3#real^3#real^3#real^3) IN D`ASSUME_TAC
THENL(*6*)[
EXPAND_TAC"D"
THEN REWRITE_TAC[comb_component;IN_ELIM_THM;is_in_component]
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`(\m. (f1_fan (x:real^3) V E POWER m) f1)`
THEN EXISTS_TAC`0`
THEN REWRITE_TAC[POWER;I_DEF;is_path];(*6*)
MRESAL_TAC connected_in_dartset_leads_into_fan_union_aff_gt[`x:real^3`;` (V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`][segment;IN_ELIM_THM]
THEN
ABBREV_TAC`TA={t| &0 <= t /\ t <= &1 /\ (?f. f IN D /\ (&1 - t) % (y:real^3) + t % z IN dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f))}`
THEN ABBREV_TAC`t1= sup (TA:real->bool)`
THEN SUBGOAL_THEN`&0 IN TA:real->bool `ASSUME_TAC
THENL(*7*)[
EXPAND_TAC"TA"
THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`]
THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];(*7*)
MP_TAC(SET_RULE`&0 IN TA ==> ~(TA ={})`)
THEN RESA_TAC
THEN EXISTS_TAC`D:real^3#real^3#real^3#real^3->bool`
THEN ASM_REWRITE_TAC[]
THEN DISJ_CASES_TAC(SET_RULE`(y=z:real^3) \/ ~(z=y)`)
THENL(*8*)[
POP_ASSUM(fun th-> ASM_TAC THEN REWRITE_TAC[th] THEN 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)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds1`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th)
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y:real^3`;`z:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN 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 RESA_TAC
THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th)
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`z:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)`
THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E (ds:real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM(fun th-> MRESA1_TAC th ` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` (ds:real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`]
THEN ASM_TAC
THEN SET_TAC[];(*8*)
SUBGOAL_THEN`(?b. !a. a IN TA ==> a <= b)` ASSUME_TAC
THENL(*9*)[
EXISTS_TAC`&1`
THEN EXPAND_TAC"TA"
THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[];(*9*)
SUBGOAL_THEN`(!a. a IN TA ==> a <= &1)` ASSUME_TAC
THENL(*10*)[
EXPAND_TAC"TA"
THEN REWRITE_TAC[IN_ELIM_THM;REAL_ARITH`&0<= &0 /\ &0<= &1`;VECTOR_ARITH`(&1 - &0) % y + &0 % z=y`]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[];(*10*)
MRESA1_TAC SUP`TA:real->bool`
THEN POP_ASSUM(fun th-> MRESA1_TAC th `&1` THEN POP_ASSUM MP_TAC THEN ASSUME_TAC th THEN STRIP_TAC)
THEN DISJ_CASES_TAC(SET_RULE` (t1:real) IN TA\/ ~(t1 IN TA)`)
THENL(*11*)[
POP_ASSUM MP_TAC
THEN EXPAND_TAC "TA"
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E)) (f:real^3#real^3#real^3#real^3)`
THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f IN D==> f IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN SUBGOAL_THEN`ds2 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*12*)[
ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3`
THEN EXPAND_TAC"ds2"
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[];(*12*)
MP_TAC(REAL_ARITH`(t1:real) <= &1 ==> t1= &1 \/ t1< &1`)
THEN RESA_TAC
THENL(*13*)[
ASM_REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`]
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`z:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN FIND_ASSUM MP_TAC`z IN dartset_leads_into_fan (x:real^3) V E ds1`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th)
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`z:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)`
THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E (ds2:real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM(fun th-> MRESA1_TAC th ` (ds1:real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` (ds2:real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f:real^3#real^3#real^3#real^3`]
THEN ASM_TAC
THEN SET_TAC[];(*13*)
STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E ds2`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[open_def]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(&1 - t1) % y + t1 % z:real^3`)
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[dist]
THEN ABBREV_TAC`t2=min (inv(norm(z-y:real^3)) *e) (&1- t1)/ &2 + t1 `
THEN MRESAL_TAC imp_norm_gl_zero_fan[`z:real^3`;`y:real^3`][REAL_ARITH`A>B <=> B t1< min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1/\ min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1 <= &1 /\ &0 <= min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1/\ &0 <= min (inv (norm (z - y)) * e) (&1 - t1) / &2
/\ min (inv (norm (z - y)) * e) (&1 - t1) / &2 < e * inv (norm (z - y)) `)
THEN RESA_TAC
THEN MP_TAC(ISPEC`min (inv (norm (z - y:real^3)) * e) (&1 - t1) / &2:real`REAL_ABS_REFL)
THEN RESA_TAC
THEN SUBGOAL_THEN`norm (((&1 - t2) % y + t2 % z:real^3) - ((&1 - t1) % y + t1 % z)) < e`
ASSUME_TAC
THENL(*14*)[
EXPAND_TAC"t2"
THEN REWRITE_TAC[VECTOR_ARITH`(((&1 - (min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1)) % y +
(min (inv (norm (z - y)) * e) (&1 - t1) / &2 + t1) % z) -
((&1 - t1) % y + t1 % z))
= (min (inv (norm (z - y)) * e) (&1 - t1) / &2) % (z-y)`;NORM_MUL]
THEN ASM_REWRITE_TAC[]
THEN MRESA_TAC imp_norm_not_zero_fan[`z:real^3`;`y:real^3`]
THEN MRESA1_TAC NORM_POS_LE`z-y:real^3`
THEN MP_TAC(REAL_ARITH`&0 <= norm (z - y) /\ ~(norm (z - y) = &0) ==> &0 < norm (z - y:real^3)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_MUL_LINV`norm(z-y:real^3)`
THEN MRESAL_TAC REAL_LT_RMUL[`min (inv (norm (z - y:real^3)) * e) (&1 - t1) / &2`;`e * inv (norm (z - y:real^3))`;`norm (z - y:real^3)`][REAL_ARITH`(A * B) *C= A *(B*C)`;REAL_ARITH`A * &1=A`];(*14*)
STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`((&1 - t2) % y + t2 % z:real^3)`)
THEN SUBGOAL_THEN`(t2:real) IN TA` ASSUME_TAC
THENL(*15*)[
EXPAND_TAC "TA"
THEN REWRITE_TAC[IN_ELIM_THM]
THEN ASM_REWRITE_TAC[]
THEN EXISTS_TAC`f:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];(*15*)
FIND_ASSUM (fun th-> MP_TAC(ISPEC `t2:real` th))`!x:real. x IN TA ==> x <= t1`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th;REAL_ARITH`A<=B <=> ~(B< A)`])
THEN ASM_REWRITE_TAC[]](*15*)](*14*)](*13*)](*12*);(*11*)
POP_ASSUM (fun th-> MP_TAC th THEN ASSUME_TAC th)
THEN EXPAND_TAC "TA"
THEN REWRITE_TAC[IN_ELIM_THM;DE_MORGAN_THM]
THEN ASM_REWRITE_TAC[]
THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC`&0` th))`!x. x IN TA ==> x <= t1:real`
THEN FIND_ASSUM (fun th-> REWRITE_TAC[th])`&0 IN TA`
THEN RESA_TAC
THEN REWRITE_TAC[NOT_EXISTS_THM;DE_MORGAN_THM]
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN DISJ_CASES_TAC(SET_RULE`~(!e.
&0< e ==>
?e1 f3. &0 < e1 /\ e1< e /\ f3 IN D
/\ ((&1 -(t1-e1)) % y + (t1-e1) % z:real^3) IN
dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f3))\/ (!e.
&0< e ==>
?e1 f3. &0 < e1 /\ e1< e /\ f3 IN D
/\ ((&1 -(t1-e1)) % y + (t1-e1) % z) IN
dartset_leads_into_fan x V E (face (hypermap1_of_fanx (x:real^3,V,E)) f3)) `)
THENL(*12*)[
POP_ASSUM MP_TAC
THEN REWRITE_TAC[NOT_EXISTS_THM;NOT_IMP;NOT_FORALL_THM]
THEN REWRITE_TAC[DE_MORGAN_THM]
THEN STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN SUBGOAL_THEN`(!a. a IN TA ==> a <= t1- e/ &2)`ASSUME_TAC
THENL(*13*)[
GEN_TAC THEN
STRIP_TAC
THEN POP_ASSUM( fun th-> MP_TAC th THEN ASSUME_TAC th)
THEN EXPAND_TAC "TA"
THEN REWRITE_TAC[IN_ELIM_THM]
THEN REPEAT STRIP_TAC
THEN MP_TAC(REAL_ARITH`&0< e ==> &0< e/ &2 /\ e/ &2 < e`)
THEN RESA_TAC
THEN FIND_ASSUM (fun th-> MP_TAC(ISPEC `a:real` th))`!x. x IN TA ==> x <= t1:real`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`a:real IN TA`
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`a<= t1==> a=t1 \/ a< t1`)
THEN RESA_TAC
THENL(*14*)[
FIND_ASSUM MP_TAC`a:real IN TA`
THEN POP_ASSUM (fun th-> REWRITE_TAC[th;] )
THEN EXPAND_TAC"TA"
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THEN REMOVE_THEN"LINH"(fun th-> MRESA1_TAC th`f':real^3#real^3#real^3#real^3`);(*14*)
MP_TAC(REAL_ARITH`a &0< t1 -a`)
THEN RESA_TAC
THEN REMOVE_THEN "LINH1"(fun th-> MRESAL_TAC th[`t1-a:real`;`f:real^3#real^3#real^3#real^3`][REAL_ARITH`(t1 - (t1 - a))=a`])
THEN MP_TAC(REAL_ARITH`~(t1 - a < e) /\ &0< e==> a<= t1 - e/ &2`)
THEN RESA_TAC](*14*);(*13*)
FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1- e / &2` th))`!b. (!x. x IN TA ==> x <= b) ==> t1 <= b:real`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC](*13*);(*12*)
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH1")
THEN SUBGOAL_THEN`(&1 - t1) % y + t1 % z IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC
THENL(*13*)[
REWRITE_TAC[IN_ELIM_THM]
THEN EXISTS_TAC`t1:real`
THEN ASM_REWRITE_TAC[];(*13*)
MP_TAC(SET_RULE`(&1 - t1) % y + t1 % z IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} /\ {(&1 - u) % y + u % z | &0 <= u /\ u <= &1} SUBSET Z ==> (&1 - t1) % y + t1 % z IN Z`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC yfan_union_aff_gt_fan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`]
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th; UNION;IN_ELIM_THM;GSYM UNIONS_TOPOLOGICAL_COMPONENT_EQ_YFAN;UNIONS])
THEN STRIP_TAC
THENL(*14*)[
POP_ASSUM MP_TAC
THEN MRESA_TAC version_JUTSTKG[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`u:real^3->bool`]
THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[SYM th])
THEN REPEAT STRIP_TAC
THEN MRESA_TAC OPEN_TOPOLOGICAL_COMPONENT_YFAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`dartset_leads_into_fan x V E f`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[open_def]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(&1 - t1) % y + t1 % z:real^3`)
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[dist]
THEN DISCH_THEN(LABEL_TAC"LINH2")
THEN MRESAL_TAC imp_norm_gl_zero_fan[`z:real^3`;`y:real^3`][REAL_ARITH`A>B <=> B MRESA1_TAC th ` inv(norm(z-y:real^3)) * e:real`)
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`norm (((&1 - (t1- e1)) % y + (t1- e1) % z:real^3) - ((&1 - t1) % y + t1 % z)) < e`
ASSUME_TAC
THENL(*15*)[
REWRITE_TAC[VECTOR_ARITH`(((&1 - (t1 - e1)) % y + (t1 - e1) % z) - ((&1 - t1) % y + t1 % z))
= --(e1 %(z-y))`;NORM_NEG;NORM_MUL]
THEN MRESA_TAC imp_norm_not_zero_fan[`z:real^3`;`y:real^3`]
THEN MRESA1_TAC NORM_POS_LE`z-y:real^3`
THEN MP_TAC(REAL_ARITH`&0 <= norm (z - y) /\ ~(norm (z - y) = &0) /\ &0< e1 ==> &0 < norm (z - y:real^3)/\ &0<= e1`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_MUL_LINV`norm(z-y:real^3)`
THEN MP_TAC(ISPEC`e1:real`REAL_ABS_REFL)
THEN RESA_TAC
THEN MRESAL_TAC REAL_LT_RMUL[`e1:real`;`inv (norm (z - y:real^3)) * (e:real)`;`(norm (z - y:real^3))`][REAL_ARITH`(A * B) *C= B*(A*C)`;REAL_ARITH`A * &1=A`];(*15*)
REMOVE_THEN"LINH2"(fun th-> MRESA1_TAC th`((&1 - (t1 - e1)) % y + (t1 - e1) % z):real^3`)
THEN POP_ASSUM MP_TAC
THEN ABBREV_TAC`y12=((&1 - (t1 - e1)) % y + (t1 - e1) % z):real^3`
THEN ABBREV_TAC`ds2= face (hypermap1_of_fanx (x,V,E)) (f3:real^3#real^3#real^3#real^3)`
THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN SUBGOAL_THEN`ds2 IN face_set(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*16*)[
ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3`
THEN EXPAND_TAC"ds2"
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[];(*16*)
STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds2:real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y12:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN FIND_ASSUM MP_TAC`dartset_leads_into_fan x V E f IN topological_component_yfan (x:real^3,V,E)`
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y12:real^3`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_THEN "LINH"(fun th-> MRESA1_TAC th`f3:real^3#real^3#real^3#real^3`)
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> POP_ASSUM MP_TAC THEN ASM_REWRITE_TAC[SYM th])](*16*)](*15*);(*14*)
POP_ASSUM MP_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(fun th-> POP_ASSUM MP_TAC THEN REWRITE_TAC[th] THEN STRIP_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 MP_TAC(REAL_ARITH`(t1:real) <= &1 ==> t1= &1 \/ t1< &1`)
THEN RESA_TAC
THENL(*15*)[
REWRITE_TAC[VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`]
THEN STRIP_TAC
THEN MRESA_TAC aff_ge_eq_aff_gt_union_aff_ge[`(x:real^3)`;`(v:real^3)`;` (w:real^3)`]
THEN MP_TAC(SET_RULE`z IN aff_gt {x} {v, w} /\ aff_ge {x} {v, w} =
aff_gt {x} {v, w} UNION aff_ge {x} {v} UNION aff_ge {x} {w}
==> z IN aff_ge {x} {v, w:real^3} `)
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN SUBGOAL_THEN`z IN xfan(x:real^3,V:real^3->bool,E)`ASSUME_TAC
THENL(*16*)[
REWRITE_TAC[xfan;IN_ELIM_THM]
THEN EXISTS_TAC`{v,w:real^3}`
THEN ASM_REWRITE_TAC[IN]
THEN ASM_MESON_TAC[IN];(*16*)
MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` ds1:real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`z IN dartset_leads_into_fan x V E ds1 /\ dartset_leads_into_fan x V E ds1 SUBSET yfan(x:real^3,V,E) ==> z IN yfan(x:real^3,V,E)`)
THEN ASM_REWRITE_TAC[yfan;IN_ELIM_THM;DIFF]](*16*);(*15*)
STRIP_TAC
THEN ABBREV_TAC`v1=(&1 - t1) % y + t1 % z:real^3`
THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v:real^3`;`w:real^3`;`v1:real^3`]
THEN MP_TAC(SET_RULE`{v,w:real^3} IN E==> ~(E={})`)
THEN RESA_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 MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`]
THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds):real^3->bool`;` y:real^3`]
THEN MRESA_TAC point_in_yfan_not_x_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`(dartset_leads_into_fan x V E ds1):real^3->bool`;` z:real^3`]
THEN SUBGOAL_THEN`~(collinear{x,y,z:real^3})` ASSUME_TAC
THENL(*16*)[
MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (z:real^3)`;`(y:real^3)`;][aff; AFFINE_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'= &0\/ &0< -- v' \/ &0 < v'`)
THENL(*17*)[
ASM_REWRITE_TAC[REAL_ARITH`A + &0=A`]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`&1 % x + &0 % z= x`];(*17*)
POP_ASSUM MP_TAC
THEN STRIP_TAC
THENL(*18*)[
REWRITE_TAC[VECTOR_ARITH`y = u' % x + v' % z <=> u' % x =y +(--v') % z `]
THEN DISJ_CASES_TAC(SET_RULE`u'= &0 \/ ~(u'= &0)`)
THENL(*19*)[
ASM_REWRITE_TAC[REAL_ARITH`&0+A=A`;]
THEN RESA_TAC
THEN ASM_REWRITE_TAC[VECTOR_ARITH`&0 % x = y + -- &1 % z <=> y=z`];(*19*)
STRIP_TAC
THEN MRESA1_TAC REAL_MUL_LINV`u':real`
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`u' % x = y + --v' % z ==> (inv (u')) %(u' % x ) = inv (u')%(y + --v' % z: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)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
THEN STRIP_TAC
THEN SUBGOAL_THEN`x IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC
THENL(*20*)[
MP_TAC(REAL_ARITH`~(u'= &0) ==> &0< u'\/ &0 < -- u'`)
THEN RESA_TAC
THENL(*21*)[
REWRITE_TAC[IN_ELIM_THM]
THEN EXISTS_TAC`(inv u' * --v')`
THEN ASM_REWRITE_TAC[REAL_ARITH`(&1 - inv u' * --v')=( &1 - inv u' * u')+ inv u' *(u'+v') `;REAL_ARITH`&1 - &1 + inv u' * &1 = inv u'`;REAL_ARITH`A<= &1<=> &0<= &1 -A `]
THEN MP_TAC(REAL_ARITH`&0< -- v' /\ &0 < u' ==> &0<= -- v' /\ &0 <= u'`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_LE_INV`u':real`
THEN MATCH_MP_TAC REAL_LE_MUL
THEN ASM_REWRITE_TAC[];(*21*)
MP_TAC(REAL_ARITH`&0< --v' /\ &0 < -- u' ==> &0 < --(u'+v')`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC](*21*);(*20*)
MP_TAC(SET_RULE`x IN {(&1 - u) % y + u % z | &0 <= u /\ u <= &1}
/\ {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} SUBSET Z
==> x IN Z`)
THEN ASM_REWRITE_TAC[]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN EXPAND_TAC"Z"
THEN REWRITE_TAC[DIFF;IN_ELIM_THM;SET_RULE`x IN (:real^3)`;UNIONS;IN_ELIM_THM]
THEN EXISTS_TAC`aff_ge {x} {v:real^3}`
THEN MRESA_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `]
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[]](*20*)](*19*);(*18*)
REPEAT STRIP_TAC
THEN SUBGOAL_THEN`y IN aff_gt {x} {z:real^3}` ASSUME_TAC
THENL(*19*)[
MRESAL_TAC AFF_GT_1_1[`x:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT {x} {y}<=> ~(x=y)`]
THEN EXISTS_TAC`u':real`
THEN EXISTS_TAC`v':real`
THEN ASM_REWRITE_TAC[];(*19*)
MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`ds1:real^3#real^3#real^3#real^3->bool`;`z:real^3`]
THEN MP_TAC(SET_RULE`y IN aff_gt {x} {z:real^3}/\ aff_gt {x} {z} SUBSET dartset_leads_into_fan x V E ds1
==> y IN dartset_leads_into_fan x V E ds1`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_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 REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN REMOVE_ASSUM_TAC
THEN FIND_ASSUM MP_TAC`y IN dartset_leads_into_fan (x:real^3) V E ds`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th] THEN ASSUME_TAC th)
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN STRIP_TAC
THEN SUBGOAL_THEN`&1 IN TA:real->bool` ASSUME_TAC
THENL(*20*)[
EXPAND_TAC "TA"
THEN REWRITE_TAC[IN_ELIM_THM; REAL_ARITH`&0<= &1 /\ &1<= &1`;VECTOR_ARITH`(&1 - &1) % y + &1 % z=z`]
THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];(*20*)
FIND_ASSUM (fun th-> MP_TAC(ISPEC `&1` th))`!x. x IN TA ==> x <= t1:real`
THEN POP_ASSUM(fun th-> REWRITE_TAC[th])
THEN ASM_REWRITE_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](*20*)](*19*)](*18*)](*17*);(*16*)
POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`v1 IN {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1}` ASSUME_TAC
THENL(*17*)[
REWRITE_TAC[IN_ELIM_THM]
THEN EXISTS_TAC`t1:real`
THEN ASM_REWRITE_TAC[];(*17*)
SUBGOAL_THEN`~(x= v1:real^3)` ASSUME_TAC
THENL(*18*)[
STRIP_TAC
THEN MP_TAC(SET_RULE`v1 IN {(&1 - u) % y + u % z | &0 <= u /\ u <= &1}
/\ {(&1 - u) % y + u % z:real^3 | &0 <= u /\ u <= &1} SUBSET Z
==> v1 IN Z`)
THEN ASM_REWRITE_TAC[]
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN EXPAND_TAC"Z"
THEN REWRITE_TAC[DIFF;IN_ELIM_THM;SET_RULE`x IN (:real^3)`;UNIONS;IN_ELIM_THM]
THEN EXISTS_TAC`aff_ge {x} {v:real^3}`
THEN MRESA_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `]
THEN EXISTS_TAC`v:real^3`
THEN ASM_REWRITE_TAC[];(*18*)
MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`)
THEN RESA_TAC
THEN STRIP_TAC
THEN SUBGOAL_THEN`~collinear{x,y,v1:real^3}` ASSUME_TAC
THENL(*19*)[
POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (y:real^3)`;`(z:real^3)`;][aff; AFFINE_HULL_2;IN_ELIM_THM]
THEN MRESAL_TAC collinear1_fan[`(x:real^3)` ;` (y:real^3)`;`(v1:real^3)`;][aff; AFFINE_HULL_2;IN_ELIM_THM]
THEN REWRITE_TAC[CONTRAPOS_THM]
THEN EXPAND_TAC"v1"
THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t1) % y + t1 % z = u' % x + v' % y
<=> t1 % z= u' % x + (v'- &1 +t1) %y`]
THEN MRESA1_TAC REAL_MUL_LINV`t1:real`
THEN REPEAT STRIP_TAC
THEN MP_TAC(SET_RULE`t1 % z = u' % x + (v' - &1 + t1) % y ==> (inv (t1)) %(t1 % z ) = inv (t1)%(u' % x + (v' - &1 + t1) % y: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)=A%B+A%C`;VECTOR_ARITH`&1 %A=A`]
THEN RESA_TAC
THEN EXISTS_TAC`inv t1 * u':real`
THEN EXISTS_TAC`(inv t1 * (v' - &1 + t1)):real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * u' +(inv t1 * (v' - &1 + t1))= inv t1 * ((u'+ v')- &1 +t1)`;REAL_ARITH`&1- &1+A=A`];(*19*)
POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN STRIP_TAC
THEN SUBGOAL_THEN`v1 IN aff_gt {x} {y,z:real^3}` ASSUME_TAC
THENL(*20*)[
MRESAL_TAC AFF_GT_1_2[`x:real^3`;`y:real^3`;`z:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`]
THEN EXISTS_TAC`&0`
THEN EXISTS_TAC`&1- t1`
THEN EXISTS_TAC`t1:real`
THEN ASM_REWRITE_TAC[VECTOR_ARITH`A= &0 % X +A`;REAL_ARITH`&0< &1- t1 <=> t1< &1`;]
THEN MP_TAC(REAL_ARITH`&0<= t1 /\ ~(t1= &0)==> &0< t1`)
THEN RESA_TAC
THEN REAL_ARITH_TAC;(*20*)
MRESAL_TAC aff_gt3_subset_aff_gt[`x:real^3`;`y:real^3`;`z:real^3`;`v1:real^3`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN RESA_TAC
THEN DISJ_CASES_TAC(SET_RULE`coplanar{x,v1,v,y}\/ ~coplanar{x,v1,v,y:real^3}`)
THENL(*21*)[
MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`][DE_MORGAN_THM;]
THENL(*22*)[
MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`]
THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x,v1:real^3}`;`{v:real^3}`]
THEN MP_TAC(SET_RULE`y IN aff_gt {x, v1} {v}/\ aff_gt {x, v1} {v} SUBSET aff_ge {x, v1} {v}
==> y IN aff_ge {x, v1} {v:real^3}`)
THEN RESA_TAC
THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`]
THENL(*23*)[
POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESAL_TAC aff_gt_subset_dartset_leads_into_fan_union_aff_gt[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`;`y:real^3`;`z:real^3`][segment]
THEN MP_TAC(SET_RULE`v IN aff_gt {x} {y,v1:real^3}/\ aff_gt {x} {y, v1} SUBSET aff_gt {x} {y, z}
/\ aff_gt {x} {y, z} SUBSET Z==> v IN Z`)
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC"Z"
THEN REWRITE_TAC[DIFF;IN_ELIM_THM;UNIONS;NOT_EXISTS_THM;DE_MORGAN_THM]
THEN MRESAL_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(v:real^3) `][IN_SING]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `aff_ge {x} {v:real^3}`)
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`);(*23*)
POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3}`;`{v:real^3,w}`]
THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w:real^3}
/\ v1 IN aff_gt {x} {v, w} ==> v1 IN aff_ge {x} {v, w}`)
THEN RESA_TAC
THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`w:real^3`; `v:real^3`;`v1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`aff_ge {x} {v, v1} SUBSET aff_ge {x} {v, w} /\ y IN aff_ge {x} {v, v1} ==> y IN aff_ge {x} {v, w:real^3}`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
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`y IN dartset_leads_into_fan x V E ds
/\ dartset_leads_into_fan x V E ds SUBSET yfan(x,V,E)==> y IN yfan(x:real^3,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan;DIFF;IN_ELIM_THM;xfan;NOT_EXISTS_THM;DE_MORGAN_THM]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v,w:real^3}`)
THEN ASM_TAC
THEN REWRITE_TAC[IN]
THEN REPEAT RESA_TAC](*23*);(*22*)
MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`v:real^3`;`v1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B,C}={A,C,B}`]
THEN STRIP_TAC
THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3 `;`v1:real^3`]
THEN MRESAL_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`w:real^3`;`y:real^3`][REAL_ARITH`pi<=pi`;REAL_ARITH`pi = pi + azim x v1 w y <=> azim x v1 w y= &0`]
THEN MRESA_TAC AZIM_EQ_0_ALT[`x:real^3`;`v1:real^3`;`w:real^3`;`y:real^3`]
THEN MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x,v1:real^3}`;`{w:real^3}`]
THEN MP_TAC(SET_RULE`y IN aff_gt {x, v1} {w}/\ aff_gt {x, v1} {w} SUBSET aff_ge {x, v1} {w}
==> y IN aff_ge {x, v1} {w:real^3}`)
THEN RESA_TAC
THEN MRESA_TAC decomposition_planar_by_angle_fan[`x:real^3`;`v1:real^3`;`w:real^3`;`y:real^3`]
THENL(*23*)[
POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESAL_TAC aff_gt_subset_dartset_leads_into_fan_union_aff_gt[`x:real^3`;`(V:real^3->bool)` ;`(E:(real^3->bool)->bool)`;`ds:real^3#real^3#real^3#real^3->bool`;`ds1:real^3#real^3#real^3#real^3->bool`;`Z:real^3->bool`;`y:real^3`;`z:real^3`][segment]
THEN MP_TAC(SET_RULE`w IN aff_gt {x} {y,v1:real^3}/\ aff_gt {x} {y, v1} SUBSET aff_gt {x} {y, z}
/\ aff_gt {x} {y, z} SUBSET Z==> w IN Z`)
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC"Z"
THEN REWRITE_TAC[DIFF;IN_ELIM_THM;UNIONS;NOT_EXISTS_THM;DE_MORGAN_THM]
THEN MRESAL_TAC point_in_aff_ge_1_1[`(x:real^3)`;`(w:real^3) `][IN_SING]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `aff_ge {x} {w:real^3}`)
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`)
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 ASM_REWRITE_TAC[];(*23*)
MRESA_TAC AFF_GT_SUBSET_AFF_GE[`{x:real^3}`;`{v:real^3,w}`]
THEN MP_TAC(SET_RULE`aff_gt {x} {v, w} SUBSET aff_ge {x} {v, w:real^3}
/\ v1 IN aff_gt {x} {v, w} ==> v1 IN aff_ge {x} {v, w}`)
THEN RESA_TAC
THEN MRESA_TAC aff_ge1_subset_aff_ge[`x:real^3`;`v:real^3`; `w:real^3`;`v1:real^3`]
THEN MP_TAC(SET_RULE`aff_ge {x} {v1,w} SUBSET aff_ge {x} {v, w} /\ y IN aff_ge {x} {v1,w} ==> y IN aff_ge {x} {v, w:real^3}`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
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`y IN dartset_leads_into_fan x V E ds
/\ dartset_leads_into_fan x V E ds SUBSET yfan(x,V,E)==> y IN yfan(x:real^3,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan;DIFF;IN_ELIM_THM;xfan;NOT_EXISTS_THM;DE_MORGAN_THM]
THEN STRIP_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`{v,w:real^3}`)
THEN ASM_TAC
THEN REWRITE_TAC[IN]
THEN REPEAT RESA_TAC](*23*)](*22*);(*21*)
MRESAL_TAC AZIM_EQ_0_PI_EQ_COPLANAR[`x:real^3`;`v1:real^3`;`v:real^3`;`y:real^3`][DE_MORGAN_THM;]
THEN MP_TAC(REAL_ARITH`&0<= azim x v1 v y /\ azim x v1 v y < &2 * pi /\ ~(azim x v1 v y = &0)/\ ~(azim x v1 v y= pi)==> (&0< azim x v1 v y/\ azim x v1 v y < pi)\/ (pi< azim x v1 v y/\ azim x v1 v y < &2 * pi)`)
THEN ASM_REWRITE_TAC[azim]
THEN STRIP_TAC
THENL(*22*)[
MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `y:real^3`;`v:real^3`]
THEN ABBREV_TAC`u123=inverse1_sigma_fan x V E v w:real^3`
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`)
THEN STRIP_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u123:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u123:real^3)`;
` (v:real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`v:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`; `w:real^3`;`u123: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[CROSS_TRIPLE]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN MRESA_TAC aff_gt_1_2_cross_dotr_4point_neg[`x:real^3`;`v1:real^3`;`y:real^3`;`v:real^3`;`w:real^3`;]
THEN POP_ASSUM MP_TAC
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN REWRITE_TAC[GSYM DOT_LNEG;GSYM CROSS_SKEW]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (w:real^3)`;`(v:real^3)`;`(u123:real^3)`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN SUBGOAL_THEN`(!h. &0 < h /\ h < t1' / &2 ==> ~collinear {x, (&1 - h) % v + h % u123, w:real^3})`ASSUME_TAC
THENL(*23*)[
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"CHANGE")
THEN GEN_TAC THEN STRIP_TAC
THEN REMOVE_THEN "CHANGE"(fun th-> MRESA1_TAC th`h:real`)
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;(*23*)
MP_TAC(REAL_ARITH`&0< t1' /\ t1'<= &1==> &0< t1'/ &2 /\ t1'/ &2 < &1`)
THEN RESA_TAC
THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`y:real^3`;`w:real^3`;` v:real^3`;`u123:real^3`;`t1'/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`]
THEN POP_ASSUM MP_TAC
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 RESA_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w) IN d1_fan(x:real^3,V,E)`
ASSUME_TAC
THENL(*24*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`sigma_fan x V E v w:real^3`
THEN ASM_REWRITE_TAC[];(*24*)
SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) IN
face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*25*)[
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;]
THEN EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)`
THEN ASM_REWRITE_TAC[face];(*25*)
SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v) IN d1_fan(x:real^3,V,E)`
ASSUME_TAC
THENL(*26*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E w v:real^3`
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*26*)
SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) IN
face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*27*)[
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;]
THEN EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)`
THEN ASM_REWRITE_TAC[face];(*27*)
SUBGOAL_THEN`(x,v,u123,w:real^3) IN face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)`ASSUME_TAC
THENL(*28*)[
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`SUC 0:num`
THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;])
THEN REWRITE_TAC[f1_fan]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`];(*28*)
MP_TAC(REAL_ARITH`&0< t /\ t< &1==> &0< t/ &2 /\ t/ &2< t/\ t/ &2< &1/\ t/ &2<= &1 /\ &0<= t/ &2/\ ~(t/ &2 = &0)`)
THEN RESA_TAC
THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`t/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u123:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`w:real^3`;`v:real^3`;`u123:real^3`][UNIONS;IN_ELIM_THM]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`;` v:real^3`;` u123:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\
u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\
x' IN u} SUBSET
dart_leads_into x V E v u123
/\ a IN aff_gt {x} {(&1 - t / &2) % v + t / &2 % u123, w:real^3}
/\ &0 < t / &2 /\ t / &2 < &1
==> a IN dart_leads_into x V E v u123`)
THEN RESA_TAC
THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;
`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,w,v,sigma_fan x V E w v)) :real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,v:real^3,u123:real^3,w:real^3)`[pr2;pr3])
THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(y:real^3)`;`(v1:real^3)`;`(a:real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`]
THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`y:real^3`;`v1:real^3`;`a: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}={A,C,B}`]
THEN RESA_TAC
THEN MRESA_TAC th3[`(x:real^3)` ;` (a:real^3)`;`(y:real^3)`;]
THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3}`ASSUME_TAC
THENL(*29*)[
MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a:real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM]
THEN EXISTS_TAC`&1-a':real`
THEN EXISTS_TAC` a':real`
THEN ASM_REWRITE_TAC[]
THEN REAL_ARITH_TAC;(*29*)
MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`;`a:real^3`]
THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {(&1 - t / &2) % v + t / &2 % u123, w:real^3}`
ASSUME_TAC
THENL(*30*)[
MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u123:real^3`;`t/ &2:real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC th3[`x:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`w:real^3`]
THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`w:real^3`]
THEN POP_ASSUM (fun th-> MRESAL_TAC th[`a:real^3`;`a':real`][VECTOR_ARITH`a' % (a - x) + x=(&1 - a') % x + a' % a`])
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC;(*30*)
MRESA_TAC continuous_coplanar_fan[`x:real^3 `;`w:real^3`;`v:real^3`;`u123:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `t/ &2:real`)
THEN MRESA_TAC aff_gt_1_2_subset_aff_1_3111[`x:real^3`;`(&1 - t') % y + t' % v1:real^3`;`v1:real^3`;`w:real^3`;`(&1 - t / &2) % v + t / &2 % u123:real^3`;`v:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC AFF_GT_1_3_SUBSET_AFF_GT_1_3[`x:real^3 `;`w:real^3`;`v:real^3`;`u123:real^3`;`t/ &2 :real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`aff_gt {x} {w, (&1 - t / &2) % v + t / &2 % u123, v} SUBSET
{x' | ?u. (?a. (&0 < a /\ a < &1) /\
u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\
x' IN u}
/\ {x' | ?u. (?a. (&0 < a /\ a < &1) /\
u = aff_gt {x} {(&1 - a) % v + a % u123, w}) /\
x' IN u} SUBSET
dart_leads_into x V E v u123
==>
aff_gt {x} {w, (&1 - t / &2) % v + t / &2 % u123, v:real^3} SUBSET
dart_leads_into x V E v u123
`)
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET
aff_gt {x} {w, v, (&1 - t / &2) % v + t / &2 % u123}
/\ aff_gt {x} {w, v, (&1 - t / &2) % v + t / &2 % u123} SUBSET
dart_leads_into x V E v u123
==>
aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET
dart_leads_into x V E v u123
`)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`)
THEN MP_TAC(REAL_ARITH`t'< &1/\ &0<= t1 /\ ~(t1= &0)==> &0< &1- t' /\ ~(&1- t' = &0) /\ &0< t1`)
THEN RESA_TAC
THEN MRESAL_TAC REAL_LT_MUL[`t1:real`;`&1- t':real`][REAL_ARITH`t1*(&1- t')= t1- t' * t1`]
THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th `t1 - t' * t1:real`)
THEN SUBGOAL_THEN`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3}`
ASSUME_TAC
THENL(*31*)[
MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3}
/\ aff_gt {x} {a} SUBSET dart_leads_into x V E v u123
/\ dart_leads_into x V E v u123 SUBSET yfan (x,V,E)
==> (&1 - t') % y + t' % v1 IN yfan(x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF]
THEN STRIP_TAC
THEN MRESA_TAC x_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN MP_TAC(SET_RULE`~((&1 - t') % y + t' % v1 IN xfan (x,V:real^3->bool,E)) /\ x IN xfan (x,V,E)
==> ~(x= (&1 - t') % y + t' % v1:real^3)`)
THEN RESA_TAC
THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`(&1 - t') % y + t' % v1:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;
VECTOR_ARITH`t1' % x + t2 % v1 + t3 % ((&1 - t') % y + t' % v1)
= t1' % x + (t3 *(&1 - t')) % y + (t2+ t3*t') % v1`]
THEN EXPAND_TAC"v1"
THEN REWRITE_TAC[VECTOR_ARITH`t1' % x +
(t3 * (&1 - t')) % y +
(t2 + t3 * t') % ((&1 - t1) % y + t1 % z)
= t1' % x +
(t3 * (&1 - t') + (t2 + t3 * t') * (&1 - t1)) % y +
((t2 + t3 * t') * t1) % z`]
THEN MRESA1_TAC REAL_MUL_LINV`&1- t':real`
THEN MRESA1_TAC REAL_MUL_LINV`t1:real`
THEN EXISTS_TAC`&0`
THEN EXISTS_TAC `inv t1 * (t1- e1)- ((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t')* t' :real`
THEN EXISTS_TAC`((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t'):real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * (t1 - e1) - a1 * t' + a1 * t'= (t1- e1)* inv t1`; REAL_ARITH`(A*B)*C=A*(B*C)`;REAL_ARITH`&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)+
(t1 - e1) * inv t1 * (&1 - t1)= &1 - (t1 - e1)`; REAL_ARITH`A * &1=A`
;VECTOR_ARITH` &0 % x + A +B= A+B`;
REAL_ARITH`&0 +
inv t1 * (t1 - e1) -
(&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') * t' +
(&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t')
= inv t1 * (t1 - e1) +
(&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') *(&1- t')`;
REAL_ARITH`inv t1 * (t1 - e1) + &1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)
= (t1 - e1)*(inv t1 * t1 ) + &1 - (t1 - e1)`
; REAL_ARITH`A+ &1-A= &1`]
THEN ASM_REWRITE_TAC[REAL_ARITH`&1-(t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)=
&1- (&1+ inv t1 - inv t1* t1) *(t1 - e1) `; REAL_ARITH`A +B-A=B`
;REAL_ARITH`inv t1 * (t1 - e1) = inv t1 * t1 - inv t1 * e1`
;REAL_ARITH`A-(A-B)=B`;
REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') * t'
= &1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * inv (&1 - t') * (&1-t')`;
REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * &1=
&1- (inv t1 * e1) * inv (&1 - t')` ]
THEN STRIP_TAC
THENL(*32*)[
REWRITE_TAC[ REAL_ARITH`&0< &1 - (inv t1 * e1) * inv (&1 - t')
<=> ((inv t1) * inv (&1 -t')) * e1 < &1`;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`]
THEN MP_TAC(REAL_ARITH` &0< t1 - t' * t1==> ~(t1 - t' * t1= &0)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real`
THEN MRESA1_TAC REAL_MUL_LINV`t1- t' * t1:real`
THEN MRESA_TAC REAL_LT_LMUL[`inv (t1- t' * t1):real`;`e1:real`;`t1- t' * t1:real`];(*32*)
REWRITE_TAC[ REAL_ARITH`&0< (inv t1 * e1) * inv (&1 - t')
<=> &0< ((inv t1) * inv (&1 -t')) * e1 `;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`]
THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real`
THEN MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[]](*32*);(*31*)
MP_TAC(SET_RULE`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN
aff_gt {x} {v1, (&1 - t') % y + t' % v1}
/\ aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3} SUBSET
dart_leads_into x V E v u123
==> (&1 - (t1 - e1)) % y + (t1 - e1) % z IN
dart_leads_into x V E v u123`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) f3 IN
face_set (hypermap1_of_fanx (x:real^3,V,E))`
ASSUME_TAC
THENL(*32*)[
ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3`
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[];(*32*)
ABBREV_TAC`y123=(&1 - (t1 - e1)) % y + (t1 - e1) % z:real^3`
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y123:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y123:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`]
THEN STRIP_TAC
THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)`
THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM(fun th-> MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f3:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SUBGOAL_THEN` (x,w,v,sigma_fan x V E w v)IN face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)` ASSUME_TAC
THENL(*33*)[
REWRITE_TAC[face;IN_ELIM_THM; orbit_map]
THEN EXISTS_TAC`0`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>= 0`;POWER;I_DEF];(*33*)
STRIP_TAC
THEN MP_TAC(SET_RULE`x,w,v,sigma_fan x V E w v IN
face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3)
/\ face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) SUBSET D
==> x,w,v,sigma_fan x V E w v IN D`)
THEN RESA_TAC
THEN ABBREV_TAC`u12=inverse1_sigma_fan x V E w v:real^3`
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REPEAT STRIP_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`u12:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u12:real^3)`;
` (w:real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`; `v:real^3`;`u12: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[CROSS_TRIPLE]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN SUBGOAL_THEN`(!h. &0 < h /\ h < &1 / &2 ==> ~collinear {x, v, (&1 - h) % w + h % u12:real^3})`
ASSUME_TAC
THENL(*34*)[
REPEAT STRIP_TAC
THEN POP_ASSUM MP_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`;`w:real^3`;`u12:real^3`;`h:real`]
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;(*34*)
MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`z:real^3`;`y:real^3`;`v1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`z:real^3`;`y:real^3 `;`v1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REWRITE_TAC[SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y) /\ ~(x=z)`;]
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`azim x v1 v y < pi ==> azim x v1 v y <= pi`)
THEN RESA_TAC
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`v:real^3`;`y:real^3`]
THEN MP_TAC(REAL_ARITH`pi = azim x v1 z v + azim x v1 v y /\
&0< azim x v1 v y /\ azim x v1 v y< pi ==> &0< azim x v1 z v /\ azim x v1 z v < pi`)
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `v:real^3`;`z:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`z:real^3`;`v:real^3`;` w:real^3`;`u12:real^3`;`&1/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`]
THEN POP_ASSUM MP_TAC
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`t''/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM])
THEN POP_ASSUM MP_TAC
THEN MP_TAC(REAL_ARITH`&0 < t''/\ t'' < &1 ==> &0 < t'' / &2 /\ t'' / &2 < t''/\ t'' / &2< &1`)
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u12:real^3`]
THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`u12:real^3`][UNIONS;IN_ELIM_THM]
THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`;` u12:real^3`]
THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\
u = aff_gt {x} {v, (&1 - a) % w + a % u12}) /\
x' IN u} SUBSET
dart_leads_into x V E w u12
/\ a'' IN aff_gt {x} {v, (&1 - t'' / &2) % w + t'' / &2 % u12:real^3}
/\ &0< t''/ &2 /\ t''/ &2< &1
==> a'' IN dart_leads_into x V E w u12`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`x,w,u12,v IN
face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3)`ASSUME_TAC
THENL(*35*)[
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`SUC 0:num`
THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;])
THEN REWRITE_TAC[f1_fan]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`];(*35*)
MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;
`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,v,w,sigma_fan x V E v w)) :real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,w:real^3,u12:real^3,v:real^3)`[pr2;pr3])
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(v1:real^3)`;`(z:real^3)`;`(a'':real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`]
THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`a'':real^3`]
THEN MRESA_TAC th3[`(x:real^3)` ;` (a'':real^3)`;`(v1:real^3)`;]
THEN SUBGOAL_THEN`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a'':real^3}`ASSUME_TAC
THENL(*36*)[
MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a'':real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM]
THEN EXISTS_TAC`&1-a''':real`
THEN EXISTS_TAC` a''':real`
THEN ASM_REWRITE_TAC[]
THEN REAL_ARITH_TAC;(*36*)
MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`;`a'':real^3`]
THEN MP_TAC(SET_RULE`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a''}
/\ aff_gt {x} {a''} SUBSET
dartset_leads_into_fan x V E
(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3))
==> (&1 - t''') % v1 + t''' % z IN
dartset_leads_into_fan x V E
(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w))`)
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC"v1"
THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t''') % ((&1 - t1) % y + t1 % z) + t''' % z
=(&1 - (t1+ (&1 - t1)*t''')) % y + (t1+ (&1 - t1)*t''') % z`]
THEN SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w:real^3) IN D`ASSUME_TAC
THENL(*37*)[
MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`(x,w,v,sigma_fan x V E w v:real^3):real^3#real^3#real^3#real^3`]
THEN MRESA_TAC lemma_powers_in_component[`hypermap1_of_fanx (x:real^3,V,E)`;`(x,w,v,sigma_fan x V E w v :real^3)`;`SUC 0:num`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x,w,v,sigma_fan x V E w v:real^3):real^3#real^3#real^3#real^3`)
THEN REWRITE_TAC[e_fan;POWER;I_DEF;o_DEF];(*37*)
STRIP_TAC
THEN SUBGOAL_THEN `t1 + (&1 - t1) * t''' IN TA:real->bool`ASSUME_TAC
THENL(*38*)[
EXPAND_TAC"TA"
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THENL(*39*)[
MATCH_MP_TAC(REAL_ARITH`&0<= A /\ &0<=B ==> &0<=A+B`)
THEN ASM_REWRITE_TAC[]
THEN MATCH_MP_TAC REAL_LE_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`]
THEN MATCH_MP_TAC(REAL_ARITH`&0 &0<=A `)
THEN ASM_REWRITE_TAC[];(*39*)
STRIP_TAC
THENL(*40*)[
REWRITE_TAC[REAL_ARITH`t1 + (&1 - t1) * t''' <= &1<=> &0 <= (&1 - t1)* (&1- t''')`]
THEN MATCH_MP_TAC REAL_LE_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`]
THEN MATCH_MP_TAC(REAL_ARITH`A< &1 ==> A<= &1 `)
THEN ASM_REWRITE_TAC[];(*40*)
EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)`
THEN ASM_REWRITE_TAC[]](*40*)](*39*);(*38*)
FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1 + (&1 - t1) * t''':real` th))`!x. x IN TA ==> x <= t1`
THEN MP_TAC(SET_RULE`t1 + (&1 - t1) * t''' IN TA /\ ~(t1 IN TA)==> ~(t1=t1 + (&1 - t1) * t''')`)
THEN POP_ASSUM (fun th-> REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`t1 + (&1 - t1) * t''' <= t1 /\ ~(t1= t1 + (&1 - t1) * t''') /\ t1<= &1 /\ &0< t'''
==> (&1 - t1) * t'''< &0:real /\ &0<= (&1 -t1)/\ &0<= t'''`)
THEN RESA_TAC
THEN MRESA_TAC REAL_LE_MUL[`(&1- t1):real`;`t''':real`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC](*38*)](*37*)](*36*)](*35*)](*34*)](*33*)](*32*)](*31*)](*30*)](*29*)](*28*)](*27*)](*26*)](*25*)](*24*)](*23*);(*22*)
POP_ASSUM MP_TAC
THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`w:real^3`;`v:real^3`;`v1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`v:real^3`;`w:real^3 `;`v1:real^3`]
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`pi < azim x v1 v y==> pi <= azim x v1 v y`)
THEN RESA_TAC
THEN MRESA_TAC sum4_azim_fan[`x:real^3`;`v1:real^3`;`v:real^3`;`w:real^3`;`y:real^3`]
THEN MP_TAC(REAL_ARITH`pi < azim x v1 v y
/\ azim x v1 v y = pi + azim x v1 w y /\ azim x v1 v y< &2 * pi
==> &0< azim x v1 w y /\ azim x v1 w y< pi`)
THEN ASM_REWRITE_TAC[azim]
THEN STRIP_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `y:real^3`;`w:real^3`]
THEN ABBREV_TAC`u123=inverse1_sigma_fan x V E w v:real^3`
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `v:real^3`)
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REPEAT STRIP_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`w:real^3`;`u123:real^3`])
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u123:real^3)`;
` (w:real^3)`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`;`w:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`w:real^3`; `v:real^3`;`u123: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[CROSS_TRIPLE]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN MRESA_TAC aff_gt_1_2_cross_dotr_4point_neg[`x:real^3`;`v1:real^3`;`y:real^3`;`w:real^3`;`v:real^3`;]
THEN POP_ASSUM MP_TAC
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN REWRITE_TAC[GSYM DOT_LNEG;GSYM CROSS_SKEW]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN MRESA_TAC exists_open_not_collinear[`(x:real^3)` ;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (v:real^3)`;`(w:real^3)`;`(u123:real^3)`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN SUBGOAL_THEN`(!h. &0 < h /\ h < t1' / &2 ==> ~collinear {x, (&1 - h) % w + h % u123, v:real^3})`ASSUME_TAC
THENL(*23*)[
POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"CHANGE")
THEN GEN_TAC THEN STRIP_TAC
THEN REMOVE_THEN "CHANGE"(fun th-> MRESA1_TAC th`h:real`)
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC;(*23*)
MP_TAC(REAL_ARITH`&0< t1' /\ t1'<= &1==> &0< t1'/ &2 /\ t1'/ &2 < &1`)
THEN RESA_TAC
THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`y:real^3`;`v:real^3`;` w:real^3`;`u123:real^3`;`t1'/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`]
THEN POP_ASSUM MP_TAC
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 RESA_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"YEU")
THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v) IN d1_fan(x:real^3,V,E)`
ASSUME_TAC
THENL(*24*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`sigma_fan x V E w v:real^3`
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[];(*24*)
SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v) IN
face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*25*)[
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;]
THEN EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)`
THEN ASM_REWRITE_TAC[face];(*25*)
SUBGOAL_THEN`(x,v,w,sigma_fan x V E v w) IN d1_fan(x:real^3,V,E)`
ASSUME_TAC
THENL(*26*)[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`w:real^3`
THEN EXISTS_TAC`sigma_fan x V E v w:real^3`
THEN ASM_REWRITE_TAC[];(*26*)
SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) IN
face_set (hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL(*27*)[
REWRITE_TAC[face_set;IN_ELIM_THM;set_of_orbits;]
THEN EXISTS_TAC`(x,v,w,sigma_fan x V E v w:real^3)`
THEN ASM_REWRITE_TAC[face];(*27*)
SUBGOAL_THEN`(x,w,u123,v:real^3) IN face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)`ASSUME_TAC
THENL(*28*)[
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`SUC 0:num`
THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;])
THEN REWRITE_TAC[f1_fan]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`];(*28*)
MP_TAC(REAL_ARITH`&0< t /\ t< &1==> &0< t/ &2 /\ t/ &2< t/\ t/ &2< &1/\ t/ &2<= &1 /\ &0<= t/ &2/\ ~(t/ &2 = &0)`)
THEN RESA_TAC
THEN REMOVE_THEN "YEU" (fun th-> MRESAL1_TAC th`t/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM])
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u123:real^3`]
THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`v:real^3`;`w:real^3`;`u123:real^3`][UNIONS;IN_ELIM_THM]
THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` v:real^3`;` w:real^3`;` u123:real^3`]
THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\
u = aff_gt {x} {(&1 - a) % w + a % u123, v}) /\
x' IN u} SUBSET
dart_leads_into x V E w u123
/\ a IN aff_gt {x} {(&1 - t / &2) % w + t / &2 % u123, v:real^3}
/\ &0 < t / &2 /\ t / &2 < &1
==> a IN dart_leads_into x V E w u123`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;
`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,v,w,sigma_fan x V E v w)) :real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,w:real^3,u123:real^3,v:real^3)`[pr2;pr3])
THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(y:real^3)`;`(v1:real^3)`;`(a:real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`]
THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`y:real^3`;`v1:real^3`;`a: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}={A,C,B}`]
THEN RESA_TAC
THEN MRESA_TAC th3[`(x:real^3)` ;` (a:real^3)`;`(y:real^3)`;]
THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3}`ASSUME_TAC
THENL(*29*)[
MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a:real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM]
THEN EXISTS_TAC`&1-a':real`
THEN EXISTS_TAC` a':real`
THEN ASM_REWRITE_TAC[]
THEN REAL_ARITH_TAC;(*29*)
MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`;`a:real^3`]
THEN SUBGOAL_THEN`(&1 - t') % y + t' % v1 IN aff_gt {x} {(&1 - t / &2) % w + t / &2 % u123, v:real^3}`
ASSUME_TAC
THENL(*30*)[
MRESA_TAC not_collinear_is_properties_fully_surrounded1 [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`;`w:real^3`;`u123:real^3`;`t/ &2:real`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC th3[`x:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`v:real^3`]
THEN MRESA_TAC scale_aff_gt_fan[`x:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`v:real^3`]
THEN POP_ASSUM (fun th-> MRESAL_TAC th[`a:real^3`;`a':real`][VECTOR_ARITH`a' % (a - x) + x=(&1 - a') % x + a' % a`])
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC;(*30*)
MRESA_TAC continuous_coplanar_fan[`x:real^3 `;`v:real^3`;`w:real^3`;`u123:real^3`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th `t/ &2:real`)
THEN MRESA_TAC aff_gt_1_2_subset_aff_1_3111[`x:real^3`;`(&1 - t') % y + t' % v1:real^3`;`v1:real^3`;`v:real^3`;`(&1 - t / &2) % w + t / &2 % u123:real^3`;`w:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC AFF_GT_1_3_SUBSET_AFF_GT_1_3[`x:real^3 `;`v:real^3`;`w:real^3`;`u123:real^3`;`t/ &2 :real`]
THEN MP_TAC(SET_RULE`aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET
{x' | ?u. (?a. (&0 < a /\ a < &1) /\
u = aff_gt {x} {v, (&1 - a) % w + a % u123}) /\
x' IN u}
/\
{x' | ?u. (?a. (&0 < a /\ a < &1) /\
u = aff_gt {x} {v, (&1 - a) % w + a % u123}) /\
x' IN u} SUBSET
dart_leads_into x V E w u123
==>
aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET
dart_leads_into x V E w u123 `)
THEN RESA_TAC
THEN MP_TAC(SET_RULE`aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET
aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123}
/\
aff_gt {x} {v, w, (&1 - t / &2) % w + t / &2 % u123} SUBSET
dart_leads_into x V E w u123
==> aff_gt {x} {v1, (&1 - t') % y + t' % v1} SUBSET
dart_leads_into x V E w u123`)
THEN RESA_TAC
THEN MP_TAC(SET_RULE`&0 IN TA /\ ~(t1 IN TA)==> ~(t1= &0)`)
THEN MP_TAC(REAL_ARITH`t'< &1/\ &0<= t1 /\ ~(t1= &0)==> &0< &1- t' /\ ~(&1- t' = &0) /\ &0< t1`)
THEN RESA_TAC
THEN MRESAL_TAC REAL_LT_MUL[`t1:real`;`&1- t':real`][REAL_ARITH`t1*(&1- t')= t1- t' * t1`]
THEN REMOVE_THEN "LINH1"(fun th-> MRESA1_TAC th `t1 - t' * t1:real`)
THEN SUBGOAL_THEN`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3}`
ASSUME_TAC
THENL(*31*)[
MRESA_TAC dartset_leads_into_subset_yfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` (face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool`]
THEN MP_TAC(SET_RULE`(&1 - t') % y + t' % v1 IN aff_gt {x} {a:real^3}
/\ aff_gt {x} {a} SUBSET dart_leads_into x V E w u123
/\ dart_leads_into x V E w u123 SUBSET yfan (x,V,E)
==> (&1 - t') % y + t' % v1 IN yfan(x,V,E)`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[yfan;IN_ELIM_THM;DIFF]
THEN STRIP_TAC
THEN MRESA_TAC x_in_xfan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`]
THEN MP_TAC(SET_RULE`~((&1 - t') % y + t' % v1 IN xfan (x,V:real^3->bool,E)) /\ x IN xfan (x,V,E)
==> ~(x= (&1 - t') % y + t' % v1:real^3)`)
THEN RESA_TAC
THEN MRESAL_TAC AFF_GT_1_2[`x:real^3`;`v1:real^3`;`(&1 - t') % y + t' % v1:real^3`][IN_ELIM_THM;SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;
VECTOR_ARITH`t1' % x + t2 % v1 + t3 % ((&1 - t') % y + t' % v1)
= t1' % x + (t3 *(&1 - t')) % y + (t2+ t3*t') % v1`]
THEN EXPAND_TAC"v1"
THEN REWRITE_TAC[VECTOR_ARITH`t1' % x +
(t3 * (&1 - t')) % y +
(t2 + t3 * t') % ((&1 - t1) % y + t1 % z)
= t1' % x +
(t3 * (&1 - t') + (t2 + t3 * t') * (&1 - t1)) % y +
((t2 + t3 * t') * t1) % z`]
THEN MRESA1_TAC REAL_MUL_LINV`&1- t':real`
THEN MRESA1_TAC REAL_MUL_LINV`t1:real`
THEN EXISTS_TAC`&0`
THEN EXISTS_TAC `inv t1 * (t1- e1)- ((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t')* t' :real`
THEN EXISTS_TAC`((&1 - (t1 - e1)) - inv t1 * (t1- e1) *(&1- t1)) * inv(&1- t'):real`
THEN ASM_REWRITE_TAC[REAL_ARITH`inv t1 * (t1 - e1) - a1 * t' + a1 * t'= (t1- e1)* inv t1`; REAL_ARITH`(A*B)*C=A*(B*C)`;REAL_ARITH`&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)+
(t1 - e1) * inv t1 * (&1 - t1)= &1 - (t1 - e1)`; REAL_ARITH`A * &1=A`
;VECTOR_ARITH` &0 % x + A +B= A+B`;
REAL_ARITH`&0 +
inv t1 * (t1 - e1) -
(&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') * t' +
(&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t')
= inv t1 * (t1 - e1) +
(&1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)) * inv (&1 - t') *(&1- t')`;
REAL_ARITH`inv t1 * (t1 - e1) + &1 - (t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)
= (t1 - e1)*(inv t1 * t1 ) + &1 - (t1 - e1)`
; REAL_ARITH`A+ &1-A= &1`]
THEN ASM_REWRITE_TAC[REAL_ARITH`&1-(t1 - e1) - inv t1 * (t1 - e1) * (&1 - t1)=
&1- (&1+ inv t1 - inv t1* t1) *(t1 - e1) `; REAL_ARITH`A +B-A=B`
;REAL_ARITH`inv t1 * (t1 - e1) = inv t1 * t1 - inv t1 * e1`
;REAL_ARITH`A-(A-B)=B`;
REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') * t'
= &1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * inv (&1 - t') * (&1-t')`;
REAL_ARITH`&1 - inv t1 * e1 - (inv t1 * e1) * inv (&1 - t') + (inv t1 * e1) * &1=
&1- (inv t1 * e1) * inv (&1 - t')` ]
THEN STRIP_TAC
THENL(*32*)[
REWRITE_TAC[ REAL_ARITH`&0< &1 - (inv t1 * e1) * inv (&1 - t')
<=> ((inv t1) * inv (&1 -t')) * e1 < &1`;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`]
THEN MP_TAC(REAL_ARITH` &0< t1 - t' * t1==> ~(t1 - t' * t1= &0)`)
THEN RESA_TAC
THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real`
THEN MRESA1_TAC REAL_MUL_LINV`t1- t' * t1:real`
THEN MRESA_TAC REAL_LT_LMUL[`inv (t1- t' * t1):real`;`e1:real`;`t1- t' * t1:real`];(*32*)
REWRITE_TAC[ REAL_ARITH`&0< (inv t1 * e1) * inv (&1 - t')
<=> &0< ((inv t1) * inv (&1 -t')) * e1 `;GSYM REAL_INV_MUL; REAL_ARITH`A*( &1- B)=A- B*A`]
THEN MRESA1_TAC REAL_LT_INV`t1- t' * t1:real`
THEN MATCH_MP_TAC REAL_LT_MUL
THEN ASM_REWRITE_TAC[]](*32*);(*31*)
MP_TAC(SET_RULE`(&1 - (t1 - e1)) % y + (t1 - e1) % z IN
aff_gt {x} {v1, (&1 - t') % y + t' % v1}
/\ aff_gt {x} {v1, (&1 - t') % y + t' % v1:real^3} SUBSET
dart_leads_into x V E w u123
==> (&1 - (t1 - e1)) % y + (t1 - e1) % z IN
dart_leads_into x V E w u123`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN MP_TAC(SET_RULE`D SUBSET d1_fan (x:real^3,V,E) /\ f3 IN D==> f3 IN d1_fan (x,V,E)`)
THEN RESA_TAC
THEN SUBGOAL_THEN`face (hypermap1_of_fanx (x,V,E)) f3 IN
face_set (hypermap1_of_fanx (x:real^3,V,E))`
ASSUME_TAC
THENL(*32*)[
ASM_REWRITE_TAC[face_set;set_of_orbits;IN_ELIM_THM]
THEN EXISTS_TAC`f3:real^3#real^3#real^3#real^3`
THEN REWRITE_TAC[face]
THEN ASM_REWRITE_TAC[];(*32*)
ABBREV_TAC`y123=(&1 - (t1 - e1)) % y + (t1 - e1) % z:real^3`
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y':real^3`;`y123:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w):real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM MP_TAC
THEN REWRITE_TAC[topological_component_yfan;IN_ELIM_THM;]
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC CONNECTED_COMPONENT_EQ[`yfan(x:real^3, (V:real^3->bool) ,E)`;`y'':real^3`;`y123:real^3`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN MRESA_TAC dartset_leads_into_is_topological_component_yfan[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool`]
THEN STRIP_TAC
THEN FIND_ASSUM MP_TAC`conforming_fan (x:real^3,V,E)`
THEN REWRITE_TAC[conforming_fan;conforming_bijection_fan;EXISTS_UNIQUE]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th `dartset_leads_into_fan x V E ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM(fun th-> MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) f3):real^3#real^3#real^3#real^3->bool)` THEN MRESA1_TAC th ` ((face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)):real^3#real^3#real^3#real^3->bool)`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`f3:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC lemma_face_subset_component[`hypermap1_of_fanx (x:real^3,V,E)`;`f3:real^3#real^3#real^3#real^3`]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN POP_ASSUM(fun th-> REWRITE_TAC[SYM th])
THEN SUBGOAL_THEN` (x,v,w,sigma_fan x V E v w)IN face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w)` ASSUME_TAC
THENL(*33*)[
REWRITE_TAC[face;IN_ELIM_THM; orbit_map]
THEN EXISTS_TAC`0`
THEN ASM_REWRITE_TAC[ARITH_RULE`0>= 0`;POWER;I_DEF];(*33*)
STRIP_TAC
THEN MP_TAC(SET_RULE`x,v,w,sigma_fan x V E v w IN
face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w:real^3)
/\ face (hypermap1_of_fanx (x,V,E)) (x,v,w,sigma_fan x V E v w) SUBSET D
==> x,v,w,sigma_fan x V E v w IN D`)
THEN RESA_TAC
THEN ABBREV_TAC`u12=inverse1_sigma_fan x V E v w:real^3`
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`v:real^3`]
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`)
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM (fun th-> MRESA1_TAC th `w:real^3`)
THEN REPEAT STRIP_TAC
THEN FIND_ASSUM MP_TAC`fan80 (x:real^3,V,E)`
THEN REWRITE_TAC[fan80]
THEN STRIP_TAC
THEN POP_ASSUM (fun th -> MRESA_TAC th [`v:real^3`;`u12:real^3`])
THEN MRESA_TAC remark1_fan[`(x:real^3) `;`(V:real^3->bool)`;` (E:(real^3->bool)->bool) `;` (u12:real^3)`;
` (v:real^3)`]
THEN MRESA_TAC sigma_fan_in_set_of_edge[`x:real^3`;`V:real^3->bool`;`E:(real^3->bool)->bool`;`w:real^3`;`v:real^3`]
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v:real^3`; `w:real^3`;`u12:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN SUBGOAL_THEN`(!h. &0 < h /\ h < &1 / &2 ==> ~collinear {x, w, (&1 - h) % v + h % u12:real^3})`
ASSUME_TAC
THENL(*34*)[
REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC not_collinear_is_properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u12:real^3`;`h:real`]
THEN POP_ASSUM MATCH_MP_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN REAL_ARITH_TAC;(*34*)
MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`z:real^3`;`y:real^3`;`v1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC aff_gt2_subset_aff_ge[`x:real^3`;`z:real^3`;`y:real^3 `;`v1:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN REWRITE_TAC[SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y) /\ ~(x=z)`;]
THEN RESA_TAC
THEN MP_TAC(REAL_ARITH`azim x v1 w y < pi ==> azim x v1 w y <= pi`)
THEN RESA_TAC
THEN MRESA_TAC sum5_azim_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`w:real^3`;`y:real^3`]
THEN MP_TAC(REAL_ARITH`pi = azim x v1 z w + azim x v1 w y /\
&0< azim x v1 w y /\ azim x v1 w y< pi ==> &0< azim x v1 z w /\ azim x v1 z w < pi`)
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESA_TAC cross_dot_fully_surrounded_fan[`x:real^3`;`v1:real^3`; `w:real^3`;`z:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN ONCE_REWRITE_TAC[CROSS_TRIPLE]
THEN STRIP_TAC
THEN MRESAL_TAC condition_4point_aff_gt_1_2inter_aff_gt_1_2[`x:real^3`;`v1:real^3`;`z:real^3`;`w:real^3`;` v:real^3`;`u12:real^3`;`&1/ &2:real`][REAL_ARITH`&1/ &2 < &1 /\ &0 < &1/ &2`]
THEN POP_ASSUM MP_TAC
THEN CONV_TAC(TOP_DEPTH_CONV let_CONV)
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN POP_ASSUM (fun th-> MRESAL1_TAC th`t''/ &2:real`[SET_RULE`~(A={}) <=> ?a. a IN A`;INTER;IN_ELIM_THM])
THEN POP_ASSUM MP_TAC
THEN MP_TAC(REAL_ARITH`&0 < t''/\ t'' < &1 ==> &0 < t'' / &2 /\ t'' / &2 < t''/\ t'' / &2< &1`)
THEN RESA_TAC
THEN STRIP_TAC
THEN MRESA_TAC properties_fully_surrounded [`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`w:real^3`;`v:real^3`;`u12:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN ASM_REWRITE_TAC[]
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN STRIP_TAC
THEN MRESAL_TAC aff_gt_1_3_eq_unions_aff_gt_1_2[`x:real^3`;`w:real^3`;`v:real^3`;`u12:real^3`][UNIONS;IN_ELIM_THM]
THEN MRESA_TAC aff_gt_1_3_subset_dart_leads_into_fan[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;` w:real^3`;` v:real^3`;` u12:real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MP_TAC(SET_RULE`{x' | ?u. (?a. (&0 < a /\ a < &1) /\
u = aff_gt {x} {(&1 - a) % v + a % u12,w}) /\
x' IN u} SUBSET
dart_leads_into x V E v u12
/\ a'' IN aff_gt {x} {(&1 - t'' / &2) % v + t'' / &2 % u12:real^3,w}
/\ &0< t''/ &2 /\ t''/ &2< &1
==> a'' IN dart_leads_into x V E v u12`)
THEN RESA_TAC
THEN POP_ASSUM MP_TAC
THEN SUBGOAL_THEN`x,v,u12,w IN
face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3)`ASSUME_TAC
THENL(*35*)[
REWRITE_TAC[face;IN_ELIM_THM;orbit_map]
THEN EXISTS_TAC`SUC 0:num`
THEN ASM_REWRITE_TAC[POWER; ARITH_RULE`SUC 0 >= 0`;I_DEF;o_DEF]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN POP_ASSUM(fun th-> MRESAL1_TAC th`(x,w,v,sigma_fan x V E w v):real^3#real^3#real^3#real^3`[POWER;I_DEF;o_DEF;])
THEN REWRITE_TAC[f1_fan]
THEN MRESA_TAC INVERSE1_SIGMA_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;`v:real^3`];(*35*)
MRESA_TAC DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;`(E:(real^3->bool)->bool)`;
`(face (hypermap1_of_fanx (x,V:real^3->bool,E)) (x,w,v,sigma_fan x V E w v)) :real^3#real^3#real^3#real^3->bool`]
THEN POP_ASSUM (fun th-> MRESAL1_TAC th `(x:real^3,v:real^3,u12:real^3,w:real^3)`[pr2;pr3])
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN STRIP_TAC
THEN MRESAL_TAC scale_in_edges_fan[`(x:real^3)`;`(v1:real^3)`;`(z:real^3)`;`(a'':real^3)`][SET_RULE`DISJOINT{x} {y,z} <=> ~(x= y)/\ ~(x=z)`;VECTOR_ARITH`a' % (a - x) = (&1 - t') % y + t' % v1 - x <=> (&1- a')% x + a' % a= (&1 - t') % y + t' % v1`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC properties_of_collinear4_points_fan[`x:real^3`;`v1:real^3`;`z:real^3`;`a'':real^3`]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN MRESA_TAC th3[`(x:real^3)` ;` (a'':real^3)`;`(v1:real^3)`;]
THEN POP_ASSUM MP_TAC
THEN ONCE_REWRITE_TAC[SET_RULE`{A,B}={B,A}`]
THEN RESA_TAC
THEN SUBGOAL_THEN`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a'':real^3}`ASSUME_TAC
THENL(*36*)[
MRESAL_TAC AFF_GT_1_1[`x:real^3`;`a'':real^3`][SET_RULE`DISJOINT{x} {y} <=> ~(x= y)`;IN_ELIM_THM]
THEN EXISTS_TAC`&1-a''':real`
THEN EXISTS_TAC` a''':real`
THEN ASM_REWRITE_TAC[]
THEN REAL_ARITH_TAC;(*36*)
MRESA_TAC AFF_GT_1_1_SUBSET_DARTSET_LEADS_INTO_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`;`(face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v)):real^3#real^3#real^3#real^3->bool`;`a'':real^3`]
THEN MP_TAC(SET_RULE`(&1 - t''') % v1 + t''' % z IN aff_gt {x} {a''}
/\ aff_gt {x} {a''} SUBSET
dartset_leads_into_fan x V E
(face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v:real^3))
==> (&1 - t''') % v1 + t''' % z IN
dartset_leads_into_fan x V E
(face (hypermap1_of_fanx (x,V,E)) (x,w,v,sigma_fan x V E w v))`)
THEN ASM_REWRITE_TAC[]
THEN EXPAND_TAC"v1"
THEN REWRITE_TAC[VECTOR_ARITH`(&1 - t''') % ((&1 - t1) % y + t1 % z) + t''' % z
=(&1 - (t1+ (&1 - t1)*t''')) % y + (t1+ (&1 - t1)*t''') % z`]
THEN SUBGOAL_THEN`(x,w,v,sigma_fan x V E w v:real^3) IN D`ASSUME_TAC
THENL(*37*)[
MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`f1:real^3#real^3#real^3#real^3`;`(x,v,w,sigma_fan x V E v w:real^3):real^3#real^3#real^3#real^3`]
THEN MRESA_TAC lemma_powers_in_component[`hypermap1_of_fanx (x:real^3,V,E)`;`(x,v,w,sigma_fan x V E v w :real^3)`;`SUC 0:num`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC 0:num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x,v,w,sigma_fan x V E v w:real^3):real^3#real^3#real^3#real^3`)
THEN REWRITE_TAC[e_fan;POWER;I_DEF;o_DEF];(*37*)
STRIP_TAC
THEN SUBGOAL_THEN `t1 + (&1 - t1) * t''' IN TA:real->bool`ASSUME_TAC
THENL(*38*)[
EXPAND_TAC"TA"
THEN REWRITE_TAC[IN_ELIM_THM]
THEN STRIP_TAC
THENL(*39*)[
MATCH_MP_TAC(REAL_ARITH`&0<= A /\ &0<=B ==> &0<=A+B`)
THEN ASM_REWRITE_TAC[]
THEN MATCH_MP_TAC REAL_LE_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`]
THEN MATCH_MP_TAC(REAL_ARITH`&0 &0<=A `)
THEN ASM_REWRITE_TAC[];(*39*)
STRIP_TAC
THENL(*40*)[
REWRITE_TAC[REAL_ARITH`t1 + (&1 - t1) * t''' <= &1<=> &0 <= (&1 - t1)* (&1- t''')`]
THEN MATCH_MP_TAC REAL_LE_MUL
THEN ASM_REWRITE_TAC[REAL_ARITH`&0<= &1- A<=> A<= &1`]
THEN MATCH_MP_TAC(REAL_ARITH`A< &1 ==> A<= &1 `)
THEN ASM_REWRITE_TAC[];(*40*)
EXISTS_TAC`(x,w,v,sigma_fan x V E w v:real^3)`
THEN ASM_REWRITE_TAC[]](*40*)](*39*);(*38*)
FIND_ASSUM (fun th-> MP_TAC(ISPEC `t1 + (&1 - t1) * t''':real` th))`!x. x IN TA ==> x <= t1`
THEN MP_TAC(SET_RULE`t1 + (&1 - t1) * t''' IN TA /\ ~(t1 IN TA)==> ~(t1=t1 + (&1 - t1) * t''')`)
THEN POP_ASSUM (fun th-> REWRITE_TAC[th])
THEN ASM_REWRITE_TAC[]
THEN STRIP_TAC
THEN STRIP_TAC
THEN MP_TAC(REAL_ARITH`t1 + (&1 - t1) * t''' <= t1 /\ ~(t1= t1 + (&1 - t1) * t''') /\ t1<= &1 /\ &0< t'''
==> (&1 - t1) * t'''< &0:real /\ &0<= (&1 -t1)/\ &0<= t'''`)
THEN RESA_TAC
THEN MRESA_TAC REAL_LE_MUL[`(&1- t1):real`;`t''':real`]
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM MP_TAC
THEN REAL_ARITH_TAC]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]);;
let WGVWSKE=prove(`!x V E.
FAN (x,V,E) /\
conforming_fan (x,V,E)
==> connected_hypermap(hypermap1_of_fanx (x,V,E))`,
REWRITE_TAC[connected_hypermap;number_of_components]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN STRIP_TAC THEN ASSUME_TAC th)
THEN FIND_ASSUM MP_TAC`FAN(x:real^3,V,E)`
THEN REWRITE_TAC[FAN;fan1;SET_RULE`~(V SUBSET {}) <=> ?v. v IN V`]
THEN STRIP_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN FIND_ASSUM(fun th-> MP_TAC(ISPEC `v:real^3` th))`(!v. v IN V==>CARD (set_of_edge (v:real^3) V E) > 1)`
THEN FIND_ASSUM(fun th-> REWRITE_TAC[th])`(v:real^3) IN V`
THEN STRIP_TAC
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 REMOVE_ASSUM_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 POP_ASSUM MP_TAC
THEN RESA_TAC
THEN ABBREV_TAC`f1=(x,v,u,sigma_fan x V E v u:real^3)`
THEN SUBGOAL_THEN`f1 IN d1_fan(x:real^3,V,E)`ASSUME_TAC
THENL[
REWRITE_TAC[d1_fan;IN_ELIM_THM]
THEN EXISTS_TAC`x:real^3`
THEN EXISTS_TAC`v:real^3`
THEN EXISTS_TAC`u:real^3`
THEN EXISTS_TAC`sigma_fan x V E v u:real^3`
THEN ASM_REWRITE_TAC[];
MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
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 ABBREV_TAC`D= comb_component (hypermap1_of_fanx (x,V,E)) (f1:real^3#real^3#real^3#real^3)`
THEN SUBGOAL_THEN`D IN set_of_components(hypermap1_of_fanx (x:real^3,V,E))` ASSUME_TAC
THENL[
ASM_REWRITE_TAC[set_of_components;set_part_components;IN_ELIM_THM]
THEN EXISTS_TAC`f1:real^3#real^3#real^3#real^3`
THEN ASM_REWRITE_TAC[];
SUBGOAL_THEN`set_of_components (hypermap1_of_fanx (x:real^3,V,E))={D}`
ASSUME_TAC
THENL[
REWRITE_TAC[EXTENSION;IN_ELIM_THM;]
THEN GEN_TAC
THEN EQ_TAC
THENL[
ASM_REWRITE_TAC[IN_SING;set_of_components;set_part_components;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESAL_TAC lemma_connect_hypermap[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`;`f1:real^3#real^3#real^3#real^3`;`x'':real^3#real^3#real^3#real^3`][set_of_components;set_part_components;IN_ELIM_THM]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN RESA_TAC
THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`f1:real^3#real^3#real^3#real^3`]
THEN MRESA_TAC lemma_component_identity[`hypermap1_of_fanx (x:real^3,V,E)`;`x''':real^3#real^3#real^3#real^3`;`x'':real^3#real^3#real^3#real^3`];
REWRITE_TAC[IN_SING]
THEN RESA_TAC];
ASM_REWRITE_TAC[CARD_SINGLETON]]]]);;
let CARD_EDGE_SET_FAN=prove(`!x V E e.
FAN (x,V,E)
/\ e IN edge_set (hypermap1_of_fanx (x,V,E))
/\ conforming_fan (x,V,E)
==> CARD e= 2`,
REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM MP_TAC
THEN DISCH_THEN(LABEL_TAC"LINH")
THEN REPEAT STRIP_TAC
THEN POP_ASSUM (fun th-> MP_TAC th THEN REWRITE_TAC[conforming_fan] THEN STRIP_TAC THEN ASSUME_TAC th)
THEN MRESA_TAC dartset_fully_surrounded_is_non_isolated_fan[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
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 REMOVE_THEN"LINH" MP_TAC
THEN RESA_TAC
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`SUC(SUC 0):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`)
THEN MRESA_TAC plain_hypermap_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`)
THEN MRESAL_TAC orbit_cyclic[`(res (e_fan x V E) (d1_fan (x:real^3,V,E)))`;`SUC (SUC 0):num`;`x':real^3#real^3#real^3#real^3`][POWER;I_DEF;o_DEF;ARITH_RULE`~(SUC (SUC 0) = 0)`]
THEN MRESA_TAC into_domain_power_efn_fan[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool) `;`(SUC 0):num`;`(\t. res (t x V E) (d1_fan (x,V,E)))`]
THEN REMOVE_ASSUM_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`)
THEN ASM_REWRITE_TAC[ARITH_RULE`k:num < SUC(SUC 0) <=> k = 0 \/ k= SUC 0`;
SET_RULE`{(res (e_fan x V E) (d1_fan (x,V,E)) POWER k) x' | k = 0 \/ k= SUC 0}
= {(res (e_fan x V E) (d1_fan (x,V,E)) POWER 0) x' , (res (e_fan x V E) (d1_fan (x,V,E)) POWER SUC(0)) x' }`;POWER;I_DEF;o_DEF]
THEN MRESA_TAC e_fan_no_fix_point[`x:real^3`;`V:real^3->bool`;`(E:(real^3->bool)->bool)`]
THEN POP_ASSUM(fun th-> MRESA1_TAC th`(x':real^3#real^3#real^3#real^3)`)
THEN POP_ASSUM MP_TAC
THEN MESON_TAC[CARD_2_FAN]);;
let REP_CARD_EDGE_SET_FAN=prove(`!x V E.
FAN (x,V,E)
/\ conforming_fan (x,V,E)
==> &(CARD (edge_set (hypermap1_of_fanx (x,V,E)))) * &2= &(CARD (dart (hypermap1_of_fanx (x,V,E))))`,
REPEAT STRIP_TAC
THEN MRESA1_TAC DART_EQ_UNIONS_FACE_SET_NODE_SET_EDGE_SET`(hypermap1_of_fanx (x:real^3,V:real^3->bool,E))`
THEN POP_ASSUM MP_TAC
THEN REMOVE_ASSUM_TAC
THEN POP_ASSUM (fun th-> REWRITE_TAC[SYM th])
THEN RESA_TAC
THEN SUBGOAL_THEN`(!t. t IN edge_set (hypermap1_of_fanx (x:real^3,V,E)) ==> FINITE t)`ASSUME_TAC
THENL[
REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN ASM_REWRITE_TAC[]
THEN MRESAL_TAC EDGE_FINITE[`(hypermap1_of_fanx (x:real^3,V,E))`;`x':real^3#real^3#real^3#real^3`][edge];
SUBGOAL_THEN`(!t u.
t IN edge_set (hypermap1_of_fanx (x,V,E)) /\
u IN edge_set (hypermap1_of_fanx (x:real^3,V,E)) /\
~(t = u)
==> t INTER u = {})`ASSUME_TAC
THENL[
REWRITE_TAC[edge_set;IN_ELIM_THM;set_of_orbits]
THEN REPEAT STRIP_TAC
THEN POP_ASSUM MP_TAC
THEN RESA_TAC
THEN DISJ_CASES_TAC(SET_RULE`(?a:real^3#real^3#real^3#real^3. a IN t INTER u) \/ (t INTER u = {}) `)
THENL[
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[INTER;IN_ELIM_THM]
THEN STRIP_TAC
THEN MRESAL_TAC lemma_edge_identity[`(hypermap1_of_fanx (x:real^3,V,E))`;`x':real^3#real^3#real^3#real^3`;`a:real^3#real^3#real^3#real^3`][edge]
THEN MRESAL_TAC lemma_edge_identity[`(hypermap1_of_fanx (x:real^3,V,E))`;`x'':real^3#real^3#real^3#real^3`;`a:real^3#real^3#real^3#real^3`][edge]
THEN POP_ASSUM MP_TAC
THEN POP_ASSUM(fun th-> ASM_REWRITE_TAC[SYM th]);
POP_ASSUM MP_TAC
THEN ASM_REWRITE_TAC[]];
MRESA_TAC CARD_EDGE_SET_FAN[`x:real^3`;`(V:real^3->bool)`; `(E:(real^3->bool)->bool)`]
THEN MRESAL_TAC HAS_SIZE_UNIONS[`(edge_set (hypermap1_of_fanx (x:real^3,V,E)))`;`(\x:real^3#real^3#real^3#real^3->bool. x)`;`CARD (edge_set (hypermap1_of_fanx (x:real^3,V,E)))`;`2:num`][HAS_SIZE;FINITE_HYPERMAP_ORBITS;SET_RULE`DISJOINT x y <=> x INTER y={}`
;SET_RULE`(!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E))
==> FINITE x' /\ CARD x' = 2)
<=> (!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E))
==> FINITE x' ) /\ (!x'. x' IN edge_set (hypermap1_of_fanx (x,V,E))
==> CARD x' = 2)`; SET_RULE`UNIONS {x' | x' IN edge_set (hypermap1_of_fanx (x,V,E))}
=UNIONS (edge_set (hypermap1_of_fanx (x,V,E)))`;REAL_OF_NUM_MUL]]]);;
let GGRLKHP=prove(`!x V E.
FAN (x,V,E) /\ conforming_fan (x,V,E)
==> planar_hypermap (hypermap1_of_fanx (x,V,E))`,
REPEAT STRIP_TAC
THEN MRESA_TAC SUM_CARD_FACE_NODE_DART_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`]
THEN POP_ASSUM MP_TAC
THEN MRESA_TAC REP_CARD_EDGE_SET_FAN[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`]
THEN REWRITE_TAC[REAL_ARITH`A+B-C=D<=> A+B+C=D + &2 *C`]
THEN POP_ASSUM(fun th-> GEN_REWRITE_TAC( LAND_CONV o LAND_CONV o ONCE_DEPTH_CONV)[SYM th])
THEN MRESAL_TAC WGVWSKE[`x:real^3`;`(V:real^3->bool)`;` (E:(real^3->bool)->bool)`][connected_hypermap]
THEN ASM_REWRITE_TAC[planar_hypermap;number_of_nodes;number_of_edges;number_of_faces;REAL_ARITH`&2 * &(CARD (face_set (hypermap1_of_fanx (x,V,E)))) +
&2 * &(CARD (node_set (hypermap1_of_fanx (x,V,E)))) +
&(CARD (edge_set (hypermap1_of_fanx (x,V,E)))) * &2 =
&4 + &2 * &(CARD (dart (hypermap1_of_fanx (x,V,E))))
<=>
&(CARD (node_set (hypermap1_of_fanx (x,V,E)))) +
&(CARD (edge_set (hypermap1_of_fanx (x,V,E))))
+ &(CARD (face_set (hypermap1_of_fanx (x,V,E))))
=
&(CARD (dart (hypermap1_of_fanx (x,V,E)))) + &2
`;REAL_OF_NUM_ADD;ARITH_RULE`2*1=2`;REAL_OF_NUM_EQ]);;
end;;