Library zoo.program_logic.biglater

Require Import zoo.prelude.
Require Export zoo.program_logic.wp.
Require Import zoo.diaframe.
Require Import zoo.options.

Section zoo۰G.
  Context `{zoo۰G : !ZooG Σ}.

  Implicit Type P : iProp Σ.

  Definition biglater P : iProp Σ :=
     ns,
     ns
    ▷^(later۰function ns) P.
End zoo۰G.

Notation "▶ P" := (
  biglater P
)(at level 20,
  right associativity
) : bi_scope.

#[local] Instance : CustomIpat "biglater" :=
  " ( %ns{} & #H⧖{_{}} & HP{} ) ".

Section zoo۰G.
  Context `{zoo۰G : !ZooG Σ}.

  Implicit Type P : iProp Σ.

  #[global] Instance biglaterne :
    NonExpansive biglater.
  #[global] Instance biglaterproper :
    Proper ((≡) ==> (≡)) biglater.

  Lemma biglaterintro P :
    P |==>
     P.

  Lemma biglatermono P1 P2 :
    (P1 P2)
    ( P1) P2.
  #[global] Instance biglatermono' :
    Proper ((⊢) ==> (⊢)) biglater.
  #[global] Instance biglaterflipmono' :
    Proper (flip (⊢) ==> flip (⊢)) biglater.

  Lemma biglateror₁ P1 P2 :
     (P1 P2)
     P1 P2.
  Lemma biglateror₂ P1 P2 :
     P1 P2
     (P1 P2).
  Lemma biglateror P1 P2 :
     (P1 P2) ⊣⊢
     P1 P2.

  Lemma biglaterand P1 P2 :
     (P1 P2)
     P1 P2.

  Lemma biglaterexist₁ `{!Inhabited X} (Φ : X iProp Σ) :
     ( x, Φ x)
     x, Φ x.
  Lemma biglaterexist₂ `(Φ : X iProp Σ) :
    ( x, Φ x)
     x, Φ x.
  Lemma biglaterexist `{!Inhabited X} (Φ : X iProp Σ) :
     ( x, Φ x) ⊣⊢
     x, Φ x.

  Lemma biglater `(Φ : X iProp Σ) :
     ( x, Φ x)
     x, Φ x.

  Lemma biglatersep₁ P1 P2 :
     (P1 P2)
       P1
       P2.
  Lemma biglatersep₂ P1 P2 :
     P1 -∗
     P2 -∗
     (P1 P2).
  Lemma biglatersep P1 P2 :
     (P1 P2) ⊣⊢
       P1
       P2.

  Lemma biglaterframel P1 P2 :
    P1 -∗
     P2 -∗
     (P1 P2).
  Lemma biglaterframer P1 P2 :
     P1 -∗
    P2 -∗
     (P1 P2).

  Lemma biglaterwandl P1 P2 :
    (P1 -∗ P2) -∗
    ( P1) -∗
     P2.
  Lemma biglaterwandr P1 P2 :
    ( P1) -∗
    (P1 -∗ P2) -∗
     P2.

  Lemma biglaterpersistently P :
     <pers> P
    <pers> P.
End zoo۰G.

Section zoo۰G.
  Context `{zoo۰G : !ZooG Σ}.

  Implicit Type P : iProp Σ.

  #[global] Instance into_wandbiglater p q R P Q :
    IntoWand false false R P Q
    IntoWand p q ( R) ( P) ( Q).
  #[global] Instance into_wandbiglaterargs p q R P Q :
    IntoWand p false R P Q
    IntoWand' p q R ( P) ( Q).

  #[global] Instance from_sepbiglater P Q1 Q2 :
    FromSep P Q1 Q2
    FromSep ( P) ( Q1) ( Q2).

  #[global] Instance maybe_combine_sep_asbiglater Q1 Q2 P progress :
    MaybeCombineSepAs Q1 Q2 P progress
    MaybeCombineSepAs ( Q1) ( Q2) ( P) progress.

  #[global] Instance combine_sep_givesbiglater Q1 Q2 P :
    CombineSepGives Q1 Q2 P
    CombineSepGives ( Q1) ( Q2) ( P).

  #[global] Instance into_andbiglater P Q1 Q2 :
    IntoAnd false P Q1 Q2
    IntoAnd false ( P) ( Q1) ( Q2).

  #[global] Instance into_sepbiglater P Q1 Q2 :
    IntoSep P Q1 Q2
    IntoSep ( P) ( Q1) ( Q2).

  #[global] Instance from_orbiglater P Q1 Q2 :
    FromOr P Q1 Q2
    FromOr ( P) ( Q1) ( Q2).

  #[global] Instance into_orbiglater P Q1 Q2 :
    IntoOr P Q1 Q2
    IntoOr ( P) ( Q1) ( Q2).

  #[global] Instance from_existbiglater {X} P (Φ : X iProp Σ) :
    FromExist P Φ
    FromExist ( P) (λ x, Φ x)%I.

  #[global] Instance into_existbiglater {X} P (Φ : X iProp Σ) name :
    IntoExist P Φ name
    Inhabited X
    IntoExist ( P) (λ a, (Φ a))%I name.

  #[global] Instance into_forallbiglater {X} P (Φ : X iProp Σ) :
    IntoForall P Φ
    IntoForall ( P) (λ x, Φ x)%I.

  #[global] Instance framebiglater p R P Q :
    Frame p R P Q
    Frame p R ( P) ( Q)
  | 2.

  #[global] Instance biglaterstrong_modality :
    ModalityStrongMono biglater.
End zoo۰G.