Module MA1:= Mf McA1.
(*======================================================== FACE OPERATIONS IN HMAPS: F, F_1, cF, cF_1 ========================================================*)
(* Following operations are designed for hmaps, but are defined on fmap for convenience *)
(* Successor F in a face - direct version, designed for hmaps: *)
Definition F(m:fmap)(z:dart):=
A_1 m one (A_1 m zero z).
(* To have a successor in a (direct) face for x: *)
Definition succf(m:fmap)(z:dart):Prop:=
pred m zero z /\ pred m one (A_1 m zero z).
(* Decidability of succf:*)
(* OK: *)
(* Predecessor in a face - direct version: *)
Definition F_1 (m:fmap)(z:dart):=
A m zero (A m one z).
(* To have a predecessor in a (direct) face for z: *)
Definition predf(m:fmap)(z:dart):Prop:=
succ m one z /\ succ m zero (A m one z).
(* Decidability of succf: *)
(* OK: *)
(* IDEM: *)
(* OK: *)
(* IDEM: *)
(* IDEM: *)
(* OK: *)
(* F and F_1 are inverses: *)
(* IDEM: *)
(* CAUTION !! PROPAGATION OF exd m (F_1 m z) IN PLACE OF exd m (F m z) *)

Lemma F_1_F : forall (m:fmap)(z:dart),
inv_hmap m -> exd m z -> exd m (F m z) ->
F_1 m (F m z) = z.