Section AMap2PMap.
(*Need to build a permission map from a finite map*)
(*The pmap is used in the compcert memory. *)
Context {lock_info: Type}.
Variable am: AMap.t lock_info.
Definition A2PMap (*: Map.PMap*) :=
fold_left
(fun (pmap:access_map) (a:address * lock_info)=>
match a with
| ((b, ofs), _) => setPermBlock (Some Memtype.Writable) b ofs pmap LKSIZE_nat
end)
(AMap.elements am)
(PMap.init (fun _ => None)).
End AMap2PMap.
Instance EqDec_AMap_key : EqDec AMap.key.
Definition PMap_eq {A} (m m' : PMap.t (Z -> A)) := forall b' ofs', m !! b' ofs' = m' !! b' ofs'.

Lemma PMap_eq_refl {A} : reflexive _ (@PMap_eq A). intros f g. reflexivity. Qed.
Lemma PMap_eq_sym {A} : symmetric _ (@PMap_eq A). intros f g. unfold PMap_eq; symmetry; auto. Qed.
Lemma PMap_eq_trans {A} : transitive _ (@PMap_eq A). intros ? ? ? E E' ? ?. rewrite E, E'. auto. Qed.