Module Map. Section map.
Variables (B : Type).
Definition t := positive -> option B.
Definition get (h: t) (a:positive) : option B := h a.
Definition set (a:positive) (v: B) (h: t) : t :=
fun i => if ident_eq i a then Some v else h i.
Definition remove (a: positive) (h: t) : t :=
fun i => if ident_eq i a then None else h i.
Definition empty : t := fun _ => None.
(** MAP Axioms **)
unfold get, set; if_tac; intuition.
Qed.
unfold get, set; intros; if_tac; intuition.
Qed.
unfold get, remove; intros; if_tac; intuition.
Qed.
unfold get, remove; intros; if_tac; intuition.
Qed.

Lemma override_same : forall id t (x:B), get t id = Some x -> set id x t = t.