(*========================================================== ============================================================ 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: *)

Theorem A_clos_eq_cA :
forall (m:fmap)(k:dim)(z:dart),
inv_qhmap m -> exd m z ->
A (clos m) k z = cA m k z
/\ A_1 (clos m) k z = cA_1 m k z.