Require Export VST.msl.msl_standard.
Require Export VST.veric.base.
Require Export VST.veric.shares.
Section Reference.
(* One common kind of PCM is one in which a central authority has a reference copy, and clients pass around partial knowledge. When a client recovers all pieces, it can gain full knowledge. *)
(* This is related to the snapshot PCM, but the snapshots aren't duplicable. *)

Lemma join_Bot : forall a b, sepalg.join a b Share.bot -> a = Share.bot /\ b = Share.bot.
Global Program Instance pos_PCM (P : Ghost) : Ghost := { G := option (share * G);
valid a := match a with Some (sh, _) => sh <> Share.bot | _ => True end;
Join_G a b c := match a, b, c with
| Some (sha, a'), Some (shb, b'), Some (shc, c') =>
sha <> Share.bot /\ shb <> Share.bot /\ sepalg.join sha shb shc /\ join a' b' c'
| Some (sh, a), None, Some c' | None, Some (sh, a), Some c' => c' = (sh, a)
| None, None, None => True
| _, _, _ => False
end }.