(*************************************************************************** * Generic Environments                                                     * *                                                                          * * Emmanuel Polonowski, April 2011, Coq v8.3                                * *                                                                          * * (Inspired by the work of A. Chargueraud :                                * *  http://www.chargueraud.org/softs/ln/index.php)                          * ***************************************************************************)
Set Implicit Arguments.
(* ********************************************************************** *)
(** * Module of the extension of an implementation of environments        *)
Require List.
Require Sets.Image.
Module GenericEnvironmentType (VarType : UsualDecidableType)
(CoreGE : CoreGenericEnvironmentType (VarType)).
Definition eq_var_dec := VarType.eq_dec.
Local Open Scope gen_env_scope.
Section ExtendedDefinitions.
Variable A : Type.
(** Asserts the binding of a variable in an environment. *)
Definition binds (x : TVar) (v : A) (E : gen_env A) := get x E = Some v.
(** Asserts the inclusion of an environment in another. *)
Definition all_binds (E F : gen_env A) :=
forall x v, binds x v E -> binds x v F.
(** Equivalence between environments *)
Definition eq (E F : gen_env A) := all_binds E F ∧ all_binds F E.
End ExtendedDefinitions.
(** [x '∹' v '⋲' E] to be read x is bound to v in E. *)
Notation "x '∹' v '⋲' E" := (binds x v E)
(at level 65) : gen_env_scope.
(** [E '⊏' F] to be read F all_binds E, i.e. E is included in F. *)
Notation "E '⊏' F" := (all_binds E F)
(at level 65) : gen_env_scope.
(** [E '≍' F] to be read F is equivalent to E, i.e. E binds as F. *)
Notation "E '≍' F" := (eq E F)
(at level 68) : gen_env_scope.
Bind Scope gen_env_scope with gen_env.
Delimit Scope gen_env_scope with gen_env.
Local Open Scope gen_env_scope.
(* ---------------------------------------------------------------------- *)
(** ** Properties *)
Section Properties.
Implicit Types x y : TVar.
Implicit Types xs ys : list TVar.
(* ---------------------------------------------------------------------- *)
(** **** Abstract properties of ok *)

(** Ok is equivalent to the non-duplication of the domain. *)
Theorem ok_NoDup_dom_eq : forall A (E : gen_env A),
ok E <-> List.NoDup (dom E).