(*========================================================== ============================================================ TOPOLOGICAL FMAPS, QHMAPS, HMAPS -  PROOF OF EULER RELATION AND GENUS THEOREM  PART 2: CLOSURE OF QHMAPS, FACES, PATHS  (J.-F. Dufourd, June 2006 - FOR PUBLICATION completed in October 2007)  ============================================================ ==========================================================*)
(*========================================================== CLOSURE of qhmap ==========================================================*)
Require Export Euler1.
(* Closure designed for qhmaps, but written on fmaps, as usual: *)
Fixpoint clos(m:fmap):fmap:=
match m with
V => V
| I m0 x0 =>
i (clos m0) x0
| L m0 k x0 y0 =>
let mr:= clos m0 in
if eq_dart_dec y0 (A mr k x0)
then mr
else l mr k x0 y0
end.
(* Preservation of the dart set in the closure: *)
(* Two corollaries more usable: *)
(* The closure is a true hypermap: *)
(* IDENTITY between A, A_1 on the closure and the closure of A, A_1: *)
(*======================================================== FACE OPERATIONS IN QHMAPS ========================================================*)
(* The following operations are designed for qhmaps, but are defined on fmap for convenience *)
(* Successor F in a face - direct version, designed for qhmaps: *)
Definition F(m:fmap)(x:dart):=
A_1 m di1 (A_1 m di0 x).
(* To have a successor in a (direct) face for x: *)
Definition succf(m:fmap)(x:dart):Prop:=
pred m di0 x /\ pred m di1 (A_1 m di0 x).
(* Decidability of succf:*)
(* OK: *)
(* Predecessor in a face - direct version: *)
Definition F_1 (m:fmap)(x:dart):=
A m di0 (A m di1 x).
(* To have a predecessor in a (direct) face for x: *)
Definition predf(m:fmap)(y:dart):Prop:=
succ m di1 y /\ succ m di0 (A m di1 y).
(* Decidability of succf: *)
(* OK: *)
(* Idem: *)
(* OK: *)
(* Idem: *)
(* Idem: *)
(* OK: *)
(* F and F_1 are inverses of each other: *)
(* Idem: *)
(* Idem: *)

Lemma inj_F_succf :
forall m:fmap, inv_qhmap m ->
inj_dart (succf m) (F m).