Module RML := Rmaps_Lemmas(R).
Export RML.
Export R.
Definition mk_rshare: forall p: Share.t, pure_readable_share p -> rshare := exist pure_readable_share.
Definition rshare_sh (p: rshare) : Share.t := proj1_sig p.
(* Definition mk_pshare : forall p: Share.t, nonunit p -> pshare := exist nonunit. *)
Definition fixup_splitting
(a:address -> Share.t) (z: address -> option (rshare * kind)) : address -> option (rshare * kind) :=
fun l =>
match z l with
| Some (sh, k) =>
match dec_readable (a l) with
| left p => Some (readable_part p,  k)
| right _ => None
end
| None => None
end.
Definition share_of (x: option (rshare * kind)) : Share.t :=
match x with Some (p,_) => proj1_sig p | None => Share.bot end.
Definition Join_pk := (Join_lower (Join_prod rshare _ kind (Join_equiv _))).

Lemma join_share_of: forall a b c,
@join _ Join_pk a b c -> join (share_of a) (share_of b) (share_of c).