(*This is my map!*)
Module AMap:= Make AddressOrdered.
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.

(* Specifications: *)
Lemma AMap_find_map {A B} m (f : A -> B) k (x : A) :
AMap.find k m = Some x ->
AMap.find k (AMap.map f m) = Some (f x).
Lemma AMap_find_map_None {A B} m (f : A -> B) k :
AMap.find k m = None ->
AMap.find k (AMap.map f m) = None.
Lemma AMap_find_map_inv {A B} m (f : A -> B) k (y : B) :
AMap.find k (AMap.map f m) = Some y ->
exists x,
AMap.find k m = Some x /\
y = f x.
Lemma AMap_map {A B} (f : A -> B) m :
map snd (AMap.elements (AMap.map f m)) =
map f (map snd (AMap.elements m)).
Lemma AMap_find_map_option_map {A B} m (f : A -> B) k :
AMap.find k (AMap.map f m) =
option_map f (AMap.find k m).