(** Apply a [delta_map] to an [access_map]*)
Definition computeMap (pmap : access_map) (delta : delta_map) : access_map :=
(pmap.1,
@Maps.PTree.combine (Z -> option permission) (Z -> option (option permission))
(Z -> option permission)
(fun p1 pd => match pd, p1 with
| Some pd', Some p1' =>
Some (fun z => match pd' z with
Some pd'' => pd''
| _ => p1' z
end)
| Some pd', None =>
Some (fun z => match pd' z with
Some pd'' => pd''
| _ => pmap.1 z
end)
| None, _ => p1
end)
pmap.2 delta).

(** If the [delta_map] does not change the [access_map] at this [block] *)
Lemma computeMap_3 :
forall (pmap : access_map) (dmap : delta_map) b ofs,
Maps.PTree.get b dmap = None ->
Maps.PMap.get b (computeMap pmap dmap) ofs = Maps.PMap.get b pmap ofs.