core.v 1.19 KB
Newer Older
1
2
From iris.base_logic Require Import base_logic.
From iris.proofmode Require Import tactics.
3
Set Default Proof Using "Type".
4
5
6
7
8
9
10
Import uPred.

(** The "core" of an assertion is its maximal persistent part.
    It can be defined entirely within the logic... at least
    in the shallow embedding. *)

Definition coreP {M : ucmraT} (P : uPred M) : uPred M :=
11
  ( `(!PersistentP Q), P  Q  Q)%I.
Robbert Krebbers's avatar
Robbert Krebbers committed
12
13
Instance: Params (@coreP) 1.
Typeclasses Opaque coreP.
14
15
16
17
18

Section core.
  Context {M : ucmraT}.
  Implicit Types P Q : uPred M.

Ralf Jung's avatar
Ralf Jung committed
19
  Lemma coreP_intro P : P - coreP P.
Robbert Krebbers's avatar
Robbert Krebbers committed
20
  Proof. iIntros "HP". by iIntros (Q HQ ->). Qed.
21

Ralf Jung's avatar
Ralf Jung committed
22
  Global Instance coreP_persistent P : PersistentP (coreP P).
Robbert Krebbers's avatar
Robbert Krebbers committed
23
  Proof. rewrite /coreP. apply _. Qed.
24

Jacques-Henri Jourdan's avatar
Jacques-Henri Jourdan committed
25
26
  Global Instance coreP_mono : Proper (() ==> ()) (@coreP M).
  Proof.
Robbert Krebbers's avatar
Robbert Krebbers committed
27
    rewrite /coreP. iIntros (P P' ?) "H"; iIntros (Q ??).
28
    iApply ("H" $! Q with "[%]"). by etrans.
Jacques-Henri Jourdan's avatar
Jacques-Henri Jourdan committed
29
30
31
  Qed.

  Global Instance coreP_proper : Proper (() ==> ()) (@coreP M).
Robbert Krebbers's avatar
Robbert Krebbers committed
32
  Proof. intros P Q. rewrite !equiv_spec=>-[??]. by split; apply coreP_mono. Qed.
Jacques-Henri Jourdan's avatar
Jacques-Henri Jourdan committed
33

Ralf Jung's avatar
Ralf Jung committed
34
  Lemma coreP_elim P : PersistentP P  coreP P - P.
Robbert Krebbers's avatar
Robbert Krebbers committed
35
  Proof. rewrite /coreP. iIntros (?) "HCP". unshelve iApply ("HCP" $! P); auto. Qed.
36
37
End core.