destruct r as [f ?].
unfold pre_rmap.
assert (valid' _ (fun x: address => resource2res (f x))).
unfold valid'. unfold valid, compose in v.
eapply same_valid; try apply v.
intros. simpl.
destruct (f x); simpl; auto. destruct p0; simpl; auto. destruct p; simpl; auto.
eauto.
Defined.
Definition pre_rmap2rmap' (r: pre_rmap (pred rmap)) : rmap'.
destruct r as [f ?].
unfold rmap', valid' in *.
assert (valid (fun l: address => res2resource (f l))).
unfold valid, compose.
replace (fun l : address => res_option (res2resource (f l))) with (fun l : address => SM.res_option (pred rmap) (f l)); auto.
extensionality l. rewrite res_option_rewrite.
unfold compose; simpl. rewrite res2resource2res. auto.
eauto.
Defined.

Lemma pre_rmap2rmap'2pre_rmap :
forall x,  pre_rmap2rmap' (rmap'2pre_rmap x) = x.