Skip to content
Snippets Groups Projects
Commit ca49296b authored by Ralf Jung's avatar Ralf Jung
Browse files

improve core: don't use implication

parent c82cc68e
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ Import bi. ...@@ -7,7 +7,7 @@ Import bi.
i.e. the conjunction of all persistent assertions that are weaker i.e. the conjunction of all persistent assertions that are weaker
than P (as in, implied by P). *) than P (as in, implied by P). *)
Definition coreP `{!BiPlainly PROP} (P : PROP) : PROP := Definition coreP `{!BiPlainly PROP} (P : PROP) : PROP :=
( Q : PROP, (Q -∗ <pers> Q) (P -∗ Q) Q)%I. ( Q : PROP, <affine> (Q -∗ <pers> Q) -∗ <affine> (P -∗ Q) -∗ Q)%I.
Instance: Params (@coreP) 1. Instance: Params (@coreP) 1.
Typeclasses Opaque coreP. Typeclasses Opaque coreP.
...@@ -26,11 +26,9 @@ Section core. ...@@ -26,11 +26,9 @@ Section core.
Global Instance coreP_persistent P : Persistent (coreP P). Global Instance coreP_persistent P : Persistent (coreP P).
Proof. Proof.
rewrite /coreP /Persistent. iIntros "HC" (Q). rewrite /coreP /Persistent. iIntros "HC" (Q).
iApply persistently_impl_plainly. iIntros "#HQ". iApply persistently_wand_affinely_plainly. iIntros "#HQ".
iApply persistently_impl_plainly. iIntros "#HPQ". iApply persistently_wand_affinely_plainly. iIntros "#HPQ".
iApply "HQ". iApply "HQ". iApply "HC"; auto.
(* FIXME: [iApply "HC"] should work. *)
iSpecialize ("HC" with "HQ"). iSpecialize ("HC" with "HPQ"). done.
Qed. Qed.
Global Instance coreP_ne : NonExpansive (coreP (PROP:=PROP)). Global Instance coreP_ne : NonExpansive (coreP (PROP:=PROP)).
...@@ -42,17 +40,7 @@ Section core. ...@@ -42,17 +40,7 @@ Section core.
Proof. solve_proper. Qed. Proof. solve_proper. Qed.
Lemma coreP_elim P : Persistent P coreP P -∗ P. Lemma coreP_elim P : Persistent P coreP P -∗ P.
Proof. Proof. rewrite /coreP. iIntros (?) "HCP". iApply "HCP"; auto. Qed.
rewrite /coreP. iIntros (?) "HCP". iSpecialize ("HCP" $! P).
(* FIXME: [iApply "HCP"] should work. *)
iAssert ( (P -∗ <pers> P))%I as "#HPpers".
{ iModIntro. iApply persistent. }
iSpecialize ("HCP" with "HPpers").
iAssert ( (P -∗ P))%I as "#HP".
{ iIntros "!> HP". done. }
iSpecialize ("HCP" with "HP").
done.
Qed.
(* TODO: Can we generalize this to non-affine BIs? *) (* TODO: Can we generalize this to non-affine BIs? *)
Lemma coreP_wand `{!BiAffine PROP} P Q : (coreP P Q) (P <pers> Q). Lemma coreP_wand `{!BiAffine PROP} P Q : (coreP P Q) (P <pers> Q).
......
...@@ -254,6 +254,14 @@ Proof. apply impl_intro_l. by rewrite plainly_and_sep_l_1 wand_elim_r. Qed. ...@@ -254,6 +254,14 @@ Proof. apply impl_intro_l. by rewrite plainly_and_sep_l_1 wand_elim_r. Qed.
Lemma impl_wand_affinely_plainly P Q : ( P Q) ⊣⊢ (<affine> P -∗ Q). Lemma impl_wand_affinely_plainly P Q : ( P Q) ⊣⊢ (<affine> P -∗ Q).
Proof. by rewrite -(persistently_plainly P) impl_wand_affinely_persistently. Qed. Proof. by rewrite -(persistently_plainly P) impl_wand_affinely_persistently. Qed.
Lemma persistently_wand_affinely_plainly P Q :
(<affine> P -∗ <pers> Q) <pers> (<affine> P -∗ Q).
Proof. rewrite -!impl_wand_affinely_plainly. apply persistently_impl_plainly. Qed.
Lemma plainly_wand_affinely_plainly P Q :
(<affine> P -∗ Q) (<affine> P -∗ Q).
Proof. rewrite -!impl_wand_affinely_plainly. apply plainly_impl_plainly. Qed.
Section plainly_affine_bi. Section plainly_affine_bi.
Context `{BiAffine PROP}. Context `{BiAffine PROP}.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment