Library zoo.iris.base_logic.lib.ghost_prop

Require Import zoo.prelude.
Require Export zoo.iris.base_logic.lib.base.
Require Import zoo.iris.base_logic.lib.ghost_var.
Require Import zoo.iris.diaframe.
Require Import zoo.options.

Class GhostPropG Σ :=
  { #[local] ghost_prop۰G۰ghost_var۰G :: GhostVarG Σ ( )
  }.

Definition ghost_prop۰Σ :=
  #[ghost_var۰Σ ( )
  ].
#[global] Instance subGghost_prop۰Σ Σ :
  subG ghost_prop۰Σ Σ
  GhostPropG Σ.

Section ghost_prop۰G.
  Context `{ghost_prop۰G : !GhostPropG Σ}.

  Implicit Type P : iProp Σ.

  Definition ghost_prop γ dq P :=
    ghost_var γ dq (Next P).

  #[global] Instance ghost_propcontractive γ dq :
    Contractive (ghost_prop γ dq).
  #[global] Instance ghost_propproper γ dq :
    Proper ((≡) ==> (≡)) (ghost_prop γ dq).

  #[global] Instance ghost_proppersistent γ P :
    Persistent (ghost_prop γ DfracDiscarded P).

  #[global] Instance ghost_propfractional γ P :
    Fractional (λ q, ghost_prop γ (DfracOwn q) P).
  #[global] Instance ghost_propas_fractional γ P q :
    AsFractional (ghost_prop γ (DfracOwn q) P) (λ q, ghost_prop γ (DfracOwn q) P) q.

  Lemma ghost_propalloc P :
     |==>
       γ,
      ghost_prop γ (DfracOwn 1) P.
  Lemma ghost_propalloccofinite (γs : gset gname) P :
     |==>
       γ,
      γ γs
      ghost_prop γ (DfracOwn 1) P.

  Lemma ghost_propvalid γ dq P :
    ghost_prop γ dq P
     dq.
  Lemma ghost_propcombine γ dq1 P1 dq2 P2 :
    ghost_prop γ dq1 P1 -∗
    ghost_prop γ dq2 P2 -∗
       (P1 P2)
      ghost_prop γ (dq1 dq2) P1.
  Lemma ghost_propvalidー2 γ dq1 P1 dq2 P2 :
    ghost_prop γ dq1 P1 -∗
    ghost_prop γ dq2 P2 -∗
       (dq1 dq2)
       (P1 P2).
  Lemma ghost_propagree γ dq1 P1 dq2 P2 :
    ghost_prop γ dq1 P1 -∗
    ghost_prop γ dq2 P2 -∗
     (P1 P2).
  Lemma ghost_propdfracne γ1 dq1 P1 γ2 dq2 P2 :
    ¬ (dq1 dq2)
    ghost_prop γ1 dq1 P1 -∗
    ghost_prop γ2 dq2 P2 -∗
    γ1 γ2.
  Lemma ghost_propne γ1 P1 γ2 dq2 P2 :
    ghost_prop γ1 (DfracOwn 1) P1 -∗
    ghost_prop γ2 dq2 P2 -∗
    γ1 γ2.
  Lemma ghost_propexclusive γ P1 dq2 P2 :
    ghost_prop γ (DfracOwn 1) P1 -∗
    ghost_prop γ dq2 P2 -∗
    False.
  Lemma ghost_proppersist γ dq P :
    ghost_prop γ dq P |==>
    ghost_prop γ DfracDiscarded P.

  Lemma ghost_propupdate {γ P} P' :
    ghost_prop γ (DfracOwn 1) P |==>
    ghost_prop γ (DfracOwn 1) P'.
End ghost_prop۰G.

#[global] Opaque ghost_prop.