(`!V E L (f:real^3#real^3->A#A).
L)
==> ?h.
L) /\
(!d. d
REPEAT GEN_TAC THEN STRIP_TAC THEN
FIRST_ASSUM MP_TAC THEN REWRITE_TAC[isomorphism] THEN STRIP_TAC THEN
SUBGOAL_THEN `!d:real^3#real^3. d
IN dart_of_fan (V,E) ==> (f d):A#A
IN darts_of_list L` ASSUME_TAC THENL
[
REPEAT STRIP_TAC THEN
FIRST_X_ASSUM (MP_TAC o check(fun
th -> (fst o dest_const o rator o rator o rator o concl)
th = "BIJ")) THEN
REWRITE_TAC[
BIJ;
INJ] THEN
DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun
th -> ALL_TAC)) THEN
DISCH_THEN (CONJUNCTS_THEN2 MP_TAC (fun
th -> ALL_TAC)) THEN
DISCH_THEN (MP_TAC o SPEC `d:real^3#real^3`) THEN
ASM_SIMP_TAC[
COMPONENTS_HYPERMAP_OF_FAN;
COMPONENTS_HYPERMAP_OF_LIST];
ALL_TAC
] THEN
ABBREV_TAC `h = (\v.
FST ((f:real^3#real^3->A#A) (v, if (v,v)
IN dart_of_fan (V,E) then v else
CHOICE (
set_of_edge v V E))))` THEN
EXISTS_TAC `h:real^3->A` THEN
SUBGOAL_THEN `?g. !v w:real^3. (v,w)
IN dart_of_fan (V,E) ==> f(v,w) = (h v:A, g (v,w):A)` ASSUME_TAC THENL
[
EXISTS_TAC `\d:real^3#real^3.
SND (f d:A#A)` THEN
REPEAT STRIP_TAC THEN
REWRITE_TAC[] THEN
MP_TAC (ISPEC `(f:real^3#real^3->A#A) (v,w)`
PAIR_SURJECTIVE) THEN
STRIP_TAC THEN
ASM_REWRITE_TAC[
PAIR_EQ] THEN
EXPAND_TAC "h" THEN
COND_CASES_TAC THENL
[
SUBGOAL_THEN `
set_of_edge (v:real^3) V E = {}` ASSUME_TAC THENL
[
POP_ASSUM MP_TAC THEN
REWRITE_TAC[
dart_of_fan; GSYM
dart1_of_fan;
IN_UNION;
IN_ELIM_THM] THEN
STRIP_TAC THENL
[
POP_ASSUM MP_TAC THEN REWRITE_TAC[
PAIR_EQ] THEN
ASM_SIMP_TAC[];
ALL_TAC
] THEN
MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `v:real^3`]
PAIR_IN_DART1_OF_FAN_IMP_NOT_EQ) THEN
ASM_REWRITE_TAC[];
ALL_TAC
] THEN
UNDISCH_TAC `v,w
IN dart_of_fan (V:real^3->bool, E)` THEN
REWRITE_TAC[
dart_of_fan; GSYM
dart1_of_fan;
IN_UNION;
IN_ELIM_THM] THEN
STRIP_TAC THENL
[
POP_ASSUM MP_TAC THEN REWRITE_TAC[
PAIR_EQ] THEN
DISCH_TAC THEN
UNDISCH_TAC `f(v:real^3,w:real^3) = x:A,y:A` THEN
ASM_SIMP_TAC[];
ALL_TAC
] THEN
MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`]
PAIR_IN_DART1_OF_FAN) THEN
ASM_REWRITE_TAC[
NOT_IN_EMPTY];
ALL_TAC
] THEN
SUBGOAL_THEN `v,w
IN dart1_of_fan (V:real^3->bool,E)` ASSUME_TAC THENL
[
UNDISCH_TAC `v,w
IN dart_of_fan (V:real^3->bool,E)` THEN
DISCH_TAC THEN FIRST_ASSUM MP_TAC THEN
REWRITE_TAC[
dart_of_fan; GSYM
dart1_of_fan;
IN_ELIM_THM;
IN_UNION] THEN
STRIP_TAC THEN ASM_REWRITE_TAC[] THEN
POP_ASSUM MP_TAC THEN REWRITE_TAC[
PAIR_EQ] THEN
DISCH_TAC THEN
UNDISCH_TAC `v,w
IN dart_of_fan (V:real^3->bool,E)` THEN
UNDISCH_TAC `~(v,v
IN dart_of_fan (V:real^3->bool,E))` THEN
ASM_SIMP_TAC[];
ALL_TAC
] THEN
ABBREV_TAC `w' =
CHOICE (
set_of_edge (v:real^3) V E)` THEN
SUBGOAL_THEN `(v,w')
IN node (
hypermap_of_fan (V,E)) (v,w)` MP_TAC THENL
[
ASM_SIMP_TAC[Hypermap_and_fan.NODE_HYPERMAP_OF_FAN_ALT] THEN
REWRITE_TAC[
IN_ELIM_THM] THEN
EXISTS_TAC `w':real^3` THEN
REWRITE_TAC[] THEN
EXPAND_TAC "w'" THEN
MATCH_MP_TAC
CHOICE_DEF THEN
DISCH_TAC THEN
MP_TAC (ISPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v:real^3`; `w:real^3`]
PAIR_IN_DART1_OF_FAN) THEN
ASM_REWRITE_TAC[
NOT_IN_EMPTY];
ALL_TAC
] THEN
REWRITE_TAC[Hypermap.node; Hypermap.node_map] THEN
ASM_SIMP_TAC[
HYPERMAP_OF_FAN] THEN
REWRITE_TAC[Hypermap.orbit_map;
IN_ELIM_THM] THEN
STRIP_TAC THEN
ASM_REWRITE_TAC[] THEN
MP_TAC (ISPECL [`f:real^3#real^3->A#A`; `
node_map (
hypermap_of_fan (V,E))`; `
node_map (
hypermap_of_list (L:((A)list)list))`; `dart (
hypermap_of_fan (V,E))`]
COMM_POWER_LEMMA_PERMUTES) THEN
ASM_SIMP_TAC[Hypermap.hypermap_lemma] THEN
DISCH_THEN (MP_TAC o SPEC `v:real^3,w:real^3`) THEN
DISCH_THEN (MP_TAC o SPEC `n:num`) THEN
ASM_SIMP_TAC[
COMPONENTS_HYPERMAP_OF_FAN] THEN
DISCH_THEN (fun
th -> ALL_TAC) THEN
ASM_SIMP_TAC[Hypermap.node_map;
HYPERMAP_OF_LIST] THEN
MATCH_MP_TAC (GSYM
FST_N_LIST_EXT_POWER) THEN
ASM_REWRITE_TAC[] THEN
FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN
ASM_REWRITE_TAC[];
ALL_TAC
] THEN
POP_ASSUM MP_TAC THEN STRIP_TAC THEN
REPEAT STRIP_TAC THENL
[
REWRITE_TAC[
BIJ;
INJ;
SURJ] THEN
SUBGOAL_THEN `!x:real^3. x
IN V ==> (h x):A
IN elements_of_list L` ASSUME_TAC THENL
[
REWRITE_TAC[
elements_of_list;
IN_SET_OF_LIST] THEN
REWRITE_TAC[
MEM_LIST_OF_ELEMENTS] THEN
X_GEN_TAC `v:real^3` THEN DISCH_TAC THEN
MP_TAC (SPEC_ALL
DART_EXISTS) THEN
ASM_REWRITE_TAC[] THEN
STRIP_TAC THEN
FIRST_X_ASSUM (MP_TAC o SPECL[`v:real^3`; `w:real^3`]) THEN
ASM_REWRITE_TAC[] THEN
DISCH_TAC THEN
EXISTS_TAC `g (v:real^3,w:real^3):A` THEN
POP_ASSUM (fun
th -> REWRITE_TAC[SYM
th]) THEN
REWRITE_TAC[GSYM
IN_SET_OF_LIST; GSYM
darts_of_list] THEN
FIRST_X_ASSUM MATCH_MP_TAC THEN
ASM_REWRITE_TAC[];
ALL_TAC
] THEN
ASM_REWRITE_TAC[] THEN
CONJ_TAC THENL
[
MAP_EVERY X_GEN_TAC [`v1:real^3`; `v2:real^3`] THEN
STRIP_TAC THEN
MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v1:real^3`]
DART_EXISTS) THEN
MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v2:real^3`]
DART_EXISTS) THEN
ASM_REWRITE_TAC[] THEN
DISCH_THEN (X_CHOOSE_THEN `w2:real^3` ASSUME_TAC) THEN
DISCH_THEN (X_CHOOSE_THEN `w1:real^3` ASSUME_TAC) THEN
ABBREV_TAC `d1:A#A = f (v1:real^3,w1:real^3)` THEN
ABBREV_TAC `d2:A#A = f (v2:real^3,w2:real^3)` THEN
SUBGOAL_THEN `
MEM (d1:A#A) (
list_of_darts L) /\
MEM (d2:A#A) (
list_of_darts L)` ASSUME_TAC THENL
[
REWRITE_TAC[GSYM
IN_SET_OF_LIST; GSYM
darts_of_list] THEN
POP_ASSUM (fun
th -> REWRITE_TAC[SYM
th]) THEN
POP_ASSUM (fun
th -> REWRITE_TAC[SYM
th]) THEN
ASM_SIMP_TAC[];
ALL_TAC
] THEN
SUBGOAL_THEN `d1:A#A
IN node (
hypermap_of_list L) d2` MP_TAC THENL
[
FIRST_ASSUM MP_TAC THEN REWRITE_TAC[GSYM
IN_SET_OF_LIST; GSYM
darts_of_list] THEN
DISCH_TAC THEN
ASM_SIMP_TAC[
GOOD_LIST_NODE] THEN
REWRITE_TAC[
IN_ELIM_THM] THEN
EXISTS_TAC `
SND (d1:A#A)` THEN
SUBGOAL_THEN `
FST (d2:A#A) =
FST (d1:A#A)` ASSUME_TAC THENL
[
FIRST_ASSUM (MP_TAC o SPECL [`v2:real^3`; `w2:real^3`]) THEN
FIRST_X_ASSUM (MP_TAC o SPECL [`v1:real^3`; `w1:real^3`]) THEN
ASM_SIMP_TAC[];
ALL_TAC
] THEN
ASM_REWRITE_TAC[];
ALL_TAC
] THEN
MP_TAC (ISPECL [`f:real^3#real^3->A#A`; `
hypermap_of_fan (V,E)`; `
hypermap_of_list (L:((A)list)list)`; `(v2:real^3,w2:real^3)`]
ISOMORPHISM_COMPONENT_IMAGE) THEN
ANTS_TAC THENL
[
ASM_REWRITE_TAC[] THEN
ASM_SIMP_TAC[
COMPONENTS_HYPERMAP_OF_FAN];
ALL_TAC
] THEN
ASM_REWRITE_TAC[] THEN
DISCH_THEN (fun
th -> REWRITE_TAC[
th]) THEN
REWRITE_TAC[
IN_IMAGE] THEN
STRIP_TAC THEN
SUBGOAL_THEN `x = (v1:real^3,w1:real^3)` ASSUME_TAC THENL
[
UNDISCH_TAC `
BIJ f (dart (
hypermap_of_fan (V,E))) (dart (
hypermap_of_list (L:((A)list)list)))` THEN
REWRITE_TAC[
BIJ;
INJ] THEN
STRIP_TAC THEN
FIRST_X_ASSUM MATCH_MP_TAC THEN
ASM_REWRITE_TAC[] THEN
CONJ_TAC THENL
[
MATCH_MP_TAC
IN_TRANS THEN
EXISTS_TAC `node (
hypermap_of_fan (V,E)) (v2,w2)` THEN
ASM_REWRITE_TAC[] THEN
MATCH_MP_TAC Hypermap.lemma_node_subset THEN
ASM_SIMP_TAC[
COMPONENTS_HYPERMAP_OF_FAN];
ALL_TAC
] THEN
ASM_SIMP_TAC[
COMPONENTS_HYPERMAP_OF_FAN];
ALL_TAC
] THEN
UNDISCH_TAC `x
IN node (
hypermap_of_fan (V,E)) (v2,w2)` THEN
POP_ASSUM (fun
th -> REWRITE_TAC[
th]) THEN
DISCH_TAC THEN
MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `v1:real^3,w1:real^3`; `v2:real^3,w2:real^3`]
FST_NODE_HYPERMAP_OF_FAN) THEN
ASM_REWRITE_TAC[];
ALL_TAC
] THEN
REWRITE_TAC[
elements_of_list;
IN_SET_OF_LIST;
MEM_LIST_OF_ELEMENTS] THEN
REWRITE_TAC[GSYM
IN_SET_OF_LIST; GSYM
darts_of_list] THEN
REPEAT STRIP_TAC THEN
UNDISCH_TAC `
BIJ f (dart (
hypermap_of_fan (V,E))) (dart (
hypermap_of_list (L:((A)list)list)))` THEN
REWRITE_TAC[
BIJ;
SURJ] THEN
STRIP_TAC THEN
FIRST_X_ASSUM (MP_TAC o SPEC `x:A,y:A`) THEN
ASM_SIMP_TAC[
COMPONENTS_HYPERMAP_OF_LIST;
COMPONENTS_HYPERMAP_OF_FAN] THEN
DISCH_THEN (X_CHOOSE_THEN `d:real^3#real^3` MP_TAC) THEN STRIP_TAC THEN
MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `d:real^3#real^3`]
IN_DART_OF_FAN) THEN
ASM_REWRITE_TAC[] THEN
STRIP_TAC THEN
EXISTS_TAC `v:real^3` THEN
ASM_REWRITE_TAC[] THEN
FIRST_X_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN
UNDISCH_TAC `f (d:real^3#real^3) = x:A,y:A` THEN
ASM_REWRITE_TAC[] THEN
DISCH_THEN (fun
th -> SIMP_TAC[
th;
PAIR_EQ]);
ALL_TAC
] THEN
MP_TAC (SPECL [`V:real^3->bool`; `E:(real^3->bool)->bool`; `d:real^3#real^3`]
IN_DART_OF_FAN) THEN
ASM_REWRITE_TAC[] THEN REMOVE_ASSUM THEN STRIP_TAC THEN
FIRST_ASSUM (MP_TAC o SPECL [`v:real^3`; `w:real^3`]) THEN
UNDISCH_TAC `v:real^3,w:real^3
IN dart_of_fan (V,E)` THEN
DISCH_TAC THEN FIRST_ASSUM (fun
th -> REWRITE_TAC[
th]) THEN
ASM_REWRITE_TAC[] THEN DISCH_TAC THEN
ASM_REWRITE_TAC[
PAIR_EQ] THEN
FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN
ASM_REWRITE_TAC[] THEN DISCH_TAC THEN
FIRST_X_ASSUM (MP_TAC o SPEC `v:real^3,w:real^3`) THEN
ASM_SIMP_TAC[
COMPONENTS_HYPERMAP_OF_FAN] THEN
DISCH_THEN (MP_TAC o CONJUNCT1) THEN
ASM_SIMP_TAC[
COMPONENTS_HYPERMAP_OF_LIST] THEN
ASM_REWRITE_TAC[
e_list_ext; res] THEN
ASM_SIMP_TAC[
E_FAN_PAIR_EXT_EXPLICIT] THEN
REWRITE_TAC[
e_list] THEN
FIRST_X_ASSUM (MP_TAC o SPECL [`w:real^3`; `v:real^3`]) THEN
ASM_REWRITE_TAC[
DART_OF_FAN_SYM] THEN
SIMP_TAC[
PAIR_EQ]);;