Definition split_resource r :=
match r with YES sh rsh k pp =>
(YES (fst (cleave sh)) (cleave_readable1 _ rsh) k pp ,
YES (snd (cleave sh)) (cleave_readable2 _ rsh) k pp)
| PURE k pp => (PURE k pp, PURE k pp)
| NO sh nsh => (NO (fst (cleave sh)) (cleave_nonreadable1 _ nsh),
NO (snd (cleave sh)) (cleave_nonreadable2 _ nsh))
end.

(* Specifications: *)
Lemma glb_cleave_lemma1: forall sh0 sh,
Share.glb Share.Rsh sh0 = Share.glb Share.Rsh sh ->
Share.glb Share.Rsh (fst (cleave sh0)) =
Share.glb Share.Rsh (fst (cleave sh)).
Lemma glb_cleave_lemma2: forall sh0 sh,
Share.glb Share.Rsh sh0 = Share.glb Share.Rsh sh ->
Share.glb Share.Rsh (snd (cleave sh0)) =
Share.glb Share.Rsh (snd (cleave sh)).
Lemma split_rmap_ok1: forall m,
resource_fmap (approx (level m)) (approx (level m)) oo (fun l => fst (split_resource (m @ l))) =
(fun l => fst (split_resource (m @ l))).
Lemma split_rmap_ok2: forall m,
resource_fmap (approx (level m)) (approx (level m)) oo (fun l => snd (split_resource (m @ l))) =
(fun l => snd (split_resource (m @ l))).