Module ITree(X: INDEXED_TYPE).
Definition elt := X.t.
Definition elt_eq := X.eq.
Definition t : Type -> Type := PTree.t.
Definition empty (A: Type): t A := PTree.empty A.
Definition get (A: Type) (k: elt) (m: t A): option A := PTree.get (X.index k) m.
Definition set (A: Type) (k: elt) (v: A) (m: t A): t A := PTree.set (X.index k) v m.
Definition remove (A: Type) (k: elt) (m: t A): t A := PTree.remove (X.index k) m.
Definition beq: forall (A: Type), (A -> A -> bool) -> t A -> t A -> bool := PTree.beq.

Theorem beq_sound:
forall (A: Type) (eqA: A -> A -> bool) (t1 t2: t A),
beq eqA t1 t2 = true ->
forall (x: elt),
match get x t1, get x t2 with
| None, None => True
| Some y1, Some y2 => eqA y1 y2 = true
| _, _ => False
end.