(** 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 a specific [address] *)
Lemma computeMap_1 :
forall (pmap : access_map) (dmap : delta_map) b ofs df (p : option permission),
Maps.PTree.get b dmap = Some df ->
df ofs = Some p ->
Maps.PMap.get b (computeMap pmap dmap) ofs = p.