(*************************************)
(* interpretation of syntactic heaps *)
(*************************************)
(* lookup functions for heaps and pointers *)
Definition plook := [fun i => onth (ptr_ctx i)].
(* notation for lookups with default *)
Notation plook' i x := (odflt null (plook i x)).
(* interpretation function for elements *)
Definition einterp i e :=
match e with
Pts x d =>
if plook i x is Some x'
then x' :-> Dyn.val d
else Undef
| Var h => if hlook i h is Some h' then h' else Undef
end.
(* main interpretation function *)
Fixpoint interp i t :=
if t is e :: t' then
if t' is [::] then einterp i e else einterp i e :+ interp i t'
else empty.

Lemma interp_perm i : forall t1 t2, perm t1 t2 -> interp i t1 = interp i t2.