(** 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] changes the [access_map] at this [block] but not at this [offset] *)
Lemma computeMap_2 :
forall (pmap : access_map) (dmap : delta_map) b ofs df,
Maps.PTree.get b dmap = Some df ->
df ofs = None ->
Maps.PMap.get b (computeMap pmap dmap) ofs = Maps.PMap.get b pmap ofs.