(*========================================================== ============================================================  TOPOLOGICAL FMAPS, QHMAPS, HMAPS -  PROOFS OF THE GENUS THEOREM AND THE EULER RELATION  PART 1: BASES, FMAPS, QHMAPS, HMAPS, CLOSURES OF A, A_1  (J.-F. Dufourd, June 2006 - FOR PUBLICATION completed in October 2007)  ============================================================ ==========================================================*)
(* coqtop -opt *)
Global Set Asymmetric Patterns.
(*======================================================== DIMENSIONS ========================================================*)
(* Dimensions: *)
Inductive dim:Set := di0 : dim | di1 : dim.
(* Action of B_1 on exd: *)
induction m.
simpl in |- *.
tauto.
simpl in |- *.
intros.
generalize (IHm k x y).
tauto.
simpl in |- *.
intros k x y.
elim (eq_dim_dec k d).
elim (eq_dart_dec x d1).
generalize (IHm k x y).
tauto.
simpl in |- *.
generalize (IHm k x y).
tauto.
simpl in |- *.
intro.
apply IHm.
Qed.
(*========================================================== I- AND L-PRECONDITIONS, QUASI-HMAPS ==========================================================*)
(* For a unique insertion of a non nil dart in a (future) qhmap: *)
Definition prec_I (m:fmap)(x:dart):=
x <> nil /\ ~ exd m x .
(* For correctness of functional link insertion, maybe incomplete, in a (future) qhmap: *)
Definition prec_Lq (m:fmap)(k:dim)(x y:dart) :=
exd m x /\ exd m y /\ ~ succ m k x /\ ~ pred m k y.
(* Quasi-map's topological invariant: in 2 parts *)
Fixpoint inv_qhmap(m:fmap){struct m}:Prop:=
match m with
V => True
| I m0 x0 => inv_qhmap m0
/\ prec_I m0 x0
| L m0 k0 x0 y0 => inv_qhmap m0
/\ prec_Lq m0 k0 x0 y0
end.
(* Definition of the qhmap type: (not used) *)
Definition qhmap:Set := {m:fmap | inv_qhmap m}.
(* Projection of a qhmap to its fmap support: *)
Definition qhmap_to_fmap(q:qhmap):fmap:=
match q with exist m _=> m end.
(* The projection is declared as a coercion: *)
Coercion qhmap_to_fmap: qhmap >-> fmap.
(*========================================================= A LOT OF PROPERTIES NEEDING inv_qhmap ONLY ==========================================================*)
(* nil isn't in a qhmap: *)
(* and the inverse: *)
(* Relationship between succ and exd: *)
(* Idem with pred and exd: *)
(* A non existing dart has no successor: *)
(* Idem: *)
(* Note that, in a qmap m, it is not True that: exd m x -> A m k x <> nil, exd m x -> A_1 m k x <> nil *)
(* Note also: *)
(* A true successor always exists: *)
(* Idem with: *)
(* Inverses: *)

Lemma exd_A_exd :
forall (m : fmap) (k : dim) (x : dart),
inv_qhmap m -> exd m (A m k x) -> exd m x.