Definition rmap' := sig valid.
Definition preds_fmap (f:(pred rmap)->(pred rmap)) (x:preds) : preds :=
match x with SomeP A ls => SomeP A (f oo ls) end.

(* Specifications: *)
Lemma preds_fmap_id : preds_fmap (id (pred rmap)) = id preds.
Lemma preds_fmap_comp : forall f g, preds_fmap g oo preds_fmap f = preds_fmap (g oo f).
Definition resource_fmap (f:(pred rmap)->(pred rmap)) (x:resource) : resource :=
match x with
| NO => NO
| YES sh k p => YES sh k (preds_fmap f p)
| PURE k p => PURE k (preds_fmap f p)
end.
Lemma valid_res_map : forall f m, valid m -> valid (resource_fmap f oo m).
Lemma resource_fmap_id : resource_fmap (id (pred rmap)) = id resource.
Lemma resource_fmap_comp : forall f g, resource_fmap g oo resource_fmap f = resource_fmap (g oo f).
Definition rmap_fmap (f:(pred rmap)->(pred rmap)) (x:rmap') : rmap' :=
match x with exist m H => exist (fun m => valid m) (resource_fmap f oo m) (valid_res_map f m H) end.
Lemma rmap_fmap_id : rmap_fmap (id (pred rmap)) = id rmap'.
Lemma rmap_fmap_comp : forall f g, rmap_fmap g oo rmap_fmap f = rmap_fmap (g oo f).
Definition rmap'2pre_rmap (r: rmap') : pre_rmap (pred rmap).