Section GVar.
Context {A : Type}.
Definition ghost_var (sh : share) (v : A) g :=
own(RA := @pos_PCM (discrete_PCM A)) g (Some (sh, v)) NoneP.
(*Lemma ghost_var_precise : forall sh p, precise (EX v : A, ghost_var sh v p).  Lemma ghost_var_precise' : forall sh v p, precise (ghost_var sh v p).  End GVar.  Section PVar. (* Like ghost variables, but the partial values may be out of date. *)
Global Program Instance nat_PCM: Ghost := { valid a := True; Join_G a b c := c = Nat.max a b }.
Next Obligation.
exists (fun _ => O); auto; intros.
apply Nat.max_0_l.
Defined.
Next Obligation.
constructor.
- unfold join; congruence.
- unfold join; eexists; split; eauto.
rewrite Nat.max_assoc; subst; auto.
- unfold join; intros.
rewrite Nat.max_comm; auto.
- unfold join; intros.
apply Nat.le_antisymm; [subst b | subst a]; apply Nat.le_max_l.
Defined.
Next Obligation.
auto.
Defined.
Global Instance max_order : PCM_order le.

Lemma snap_master_join' : forall v1 v2 p,
ghost_snap v1 p * ghost_master1 v2 p = !!(v1 <= v2)%nat && ghost_master1 v2 p.