(*========================================================== ============================================================ AUGUST 2008 TOPOLOGICAL FMAPS, HMAPS - WITH EMBEDDINGS AND TAGS  (2008 RING FORMALIZATION)  PART 1: BASES, FMAPS, HMAPS, CLOSURES OF A, A_1  COMPLETE: OK! ============================================================ ==========================================================*)
(* cd Desktop/JFD/JFD08/GALAPAGOS/HMAPSTE_08 coqtop -opt *)
Global Set Asymmetric Patterns.
Require Export Reals.
Require Export Omega.
Open Scope R_scope.
(*======================================================== DIMENSIONS ========================================================*)
(* Dimensions: *)
Inductive dim:Set := zero : dim | one : dim.
(* Decidability of point equality: OK, but DANGEREOUS ! *)
(*======================================================== DARTS AS NATURALS ========================================================*)
(* For simplicity, dart is nat, but it could be a deferred type: *)
Definition dart := nat.
(* Decidability of dart equality: *)
Definition eq_dart_dec := eq_nat_dec.
(* Nil dart: *)
Definition nil := 0%nat.
(*======================================================== FREE MAPS, CONSTRUCTORS, OBSERVERS AND DESTRUCTORS ========================================================*)
Open Scope Z_scope.
(* Free maps: *)
Inductive fmap:Set :=
V : fmap
| I : fmap->dart->tag->point->fmap
| L : fmap->dim->dart->dart->fmap.
(* Map emptiness: *)
Definition empty(m:fmap): Prop:=
match m with
V => True
|  _ => False
end.
(* Map emptiness is decidable: *)
(* and the variant: *)
(* Relationship between succ and exd: *)
(* Idem: *)
(* Idem with: *)
(* Note that, in a hmap m, we have neither exd m z -> A m k z <> nil nor exd m z -> A_1 m k z <> nil *)
(* Note also: *)
(* Idem: *)
(* IDEM: *)
(*========================================================= A AND A_1 ARE INVERSES INJECTIONS IN A hmap: ==========================================================*)
(* In a qmap, A et A_1 are inverses: *)
(* Idem with A_1: *)
(* Partial injection on dart, Df giving the domain of f: *)
Definition inj_dart(Df:dart->Prop)(f:dart->dart):Prop:=
forall x x':dart,
(Df x)->(Df x')->(f x)=(f x')->x=x'.
(* (A m k) is an injection on (succ m k): OK *)
(* Idem, for pred and A_1: *)

Lemma inj_A_1 :
forall (m:fmap)(k:dim), inv_hmap m ->
inj_dart (pred m k) (A_1 m k).