(`!(H:(A)hypermap) p n.
H p n ==>
?q m.
GEN_TAC THEN GEN_TAC THEN
INDUCT_TAC THEN REWRITE_TAC[
is_path] THENL
[
MAP_EVERY EXISTS_TAC [`p:num->A`; `0`] THEN
REWRITE_TAC[
is_path];
ALL_TAC
] THEN
STRIP_TAC THEN
FIRST_X_ASSUM (MP_TAC o check (is_imp o concl)) THEN
ASM_REWRITE_TAC[] THEN
STRIP_TAC THEN
FIRST_X_ASSUM (MP_TAC o check (fun
th -> rator (rator (concl
th)) = `
go_one_step (H:(A)hypermap)`)) THEN
REWRITE_TAC[
go_one_step] THEN
STRIP_TAC THENL
[
EXISTS_TAC `(\i:num. if i <= m then (q:num->A) i else (if i = m + 1 then
inverse (
node_map H) (q m) else
edge_map H ((p:num->A) n)))` THEN
EXISTS_TAC `SUC(SUC m)` THEN
BETA_TAC THEN
ASM_SIMP_TAC[
LE_0; ARITH_RULE `~(SUC (SUC m) <= m)`; ARITH_RULE `~(SUC(SUC m) = m + 1)`] THEN
REWRITE_TAC[
is_path] THEN
REPEAT STRIP_TAC THENL
[
MATCH_MP_TAC
truncated_path_lemma THEN
EXISTS_TAC `q:num->A` THEN
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[
LE_REFL; ARITH_RULE `~(m = m + 1)`; ARITH_RULE `~(SUC m <= m)`; ARITH_RULE `SUC m = m + 1`] THEN
REWRITE_TAC[
go_one_step] THEN
DISJ2_TAC THEN DISJ1_TAC THEN
GEN_REWRITE_TAC (RAND_CONV o DEPTH_CONV) [
node_map] THEN
REWRITE_TAC[
tuple_opposite_hypermap];
ASM_REWRITE_TAC[ARITH_RULE `~(SUC m <= m) /\ ~(SUC (SUC m) <= m) /\ ~(SUC (SUC m) = m + 1) /\ SUC m = m + 1`] THEN
REWRITE_TAC[
go_one_step] THEN
DISJ2_TAC THEN DISJ2_TAC THEN
REWRITE_TAC[
face_map] THEN
REWRITE_TAC[
tuple_opposite_hypermap] THEN
MP_TAC (SPEC `H:(A)hypermap`
inverse2_hypermap_maps) THEN
SIMP_TAC[
o_THM;
FUN_EQ_THM];
];
EXISTS_TAC `(\i:num. if i <= m then (q:num->A) i else (if i = m + 1 then ((
face_map H) o (
node_map H)) (q m) else
node_map H ((p:num->A) n)))` THEN
EXISTS_TAC `SUC(SUC m)` THEN
BETA_TAC THEN
ASM_SIMP_TAC[
LE_0; ARITH_RULE `~(SUC (SUC m) <= m)`; ARITH_RULE `~(SUC(SUC m) = m + 1)`] THEN
REWRITE_TAC[
is_path] THEN
REPEAT STRIP_TAC THENL
[
MATCH_MP_TAC
truncated_path_lemma THEN
EXISTS_TAC `q:num->A` THEN
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[
LE_REFL; ARITH_RULE `~(m = m + 1)`; ARITH_RULE `~(SUC m <= m)`; ARITH_RULE `SUC m = m + 1`] THEN
REWRITE_TAC[
go_one_step] THEN
DISJ1_TAC THEN
GEN_REWRITE_TAC (RAND_CONV o DEPTH_CONV) [
edge_map] THEN
REWRITE_TAC[
tuple_opposite_hypermap];
ASM_REWRITE_TAC[ARITH_RULE `~(SUC m <= m) /\ ~(SUC (SUC m) <= m) /\ ~(SUC (SUC m) = m + 1) /\ SUC m = m + 1`] THEN
REWRITE_TAC[
go_one_step] THEN
DISJ2_TAC THEN DISJ2_TAC THEN
REWRITE_TAC[
face_map] THEN
REWRITE_TAC[
tuple_opposite_hypermap] THEN
REWRITE_TAC[GSYM
face_map] THEN
REWRITE_TAC[
o_THM] THEN
MP_TAC (ISPECL [`
face_map (H:(A)hypermap)`; `dart (H:(A)hypermap)`]
PERMUTES_INVERSES_o) THEN
REWRITE_TAC[
hypermap_lemma;
FUN_EQ_THM;
o_THM;
I_THM] THEN
SIMP_TAC[];
];
EXISTS_TAC `(\i:num. if i <= m then (q:num->A) i else (if i = m + 1 then
inverse (
node_map H) (q m) else
face_map H ((p:num->A) n)))` THEN
EXISTS_TAC `SUC(SUC m)` THEN
BETA_TAC THEN
ASM_SIMP_TAC[
LE_0; ARITH_RULE `~(SUC (SUC m) <= m)`; ARITH_RULE `~(SUC(SUC m) = m + 1)`] THEN
REWRITE_TAC[
is_path] THEN
REPEAT STRIP_TAC THENL
[
MATCH_MP_TAC
truncated_path_lemma THEN
EXISTS_TAC `q:num->A` THEN
ASM_SIMP_TAC[];
ASM_REWRITE_TAC[
LE_REFL; ARITH_RULE `~(m = m + 1)`; ARITH_RULE `~(SUC m <= m)`; ARITH_RULE `SUC m = m + 1`] THEN
REWRITE_TAC[
go_one_step] THEN
DISJ2_TAC THEN DISJ1_TAC THEN
GEN_REWRITE_TAC (RAND_CONV o DEPTH_CONV) [
node_map] THEN
REWRITE_TAC[
tuple_opposite_hypermap];
ASM_REWRITE_TAC[ARITH_RULE `~(SUC m <= m) /\ ~(SUC (SUC m) <= m) /\ ~(SUC (SUC m) = m + 1) /\ SUC m = m + 1`] THEN
REWRITE_TAC[
go_one_step] THEN
DISJ1_TAC THEN
REWRITE_TAC[
edge_map] THEN
REWRITE_TAC[
tuple_opposite_hypermap] THEN
MP_TAC (ISPECL [`
node_map (H:(A)hypermap)`; `dart (H:(A)hypermap)`]
PERMUTES_INVERSES_o) THEN
REWRITE_TAC[
hypermap_lemma;
FUN_EQ_THM;
o_THM;
I_THM] THEN
SIMP_TAC[]
]
]);;