Commit 43d7f211 authored by Hai Dang's avatar Hai Dang

Merge branch 'hai/auth_frac' into 'master'

Bump Iris with changes in `auth`

See merge request iris/examples!17
parents 3e8fcd4c ffb27f4a
...@@ -9,6 +9,6 @@ build: [make "-j%{jobs}%"] ...@@ -9,6 +9,6 @@ build: [make "-j%{jobs}%"]
install: [make "install"] install: [make "install"]
remove: ["rm" "-rf" "%{lib}%/coq/user-contrib/iris_examples"] remove: ["rm" "-rf" "%{lib}%/coq/user-contrib/iris_examples"]
depends: [ depends: [
"coq-iris" { (= "dev.2019-04-17.0.60d28bbb") | (= "dev") } "coq-iris" { (= "dev.2019-05-24.0.c9984c7f") | (= "dev") }
"coq-autosubst" { = "dev.coq86" } "coq-autosubst" { = "dev.coq86" }
] ]
...@@ -50,7 +50,7 @@ Section proof. ...@@ -50,7 +50,7 @@ Section proof.
iIntros (Φ) "_ HΦ". iApply wp_fupd. iIntros (Φ) "_ HΦ". iApply wp_fupd.
iApply (newBag_spec b NB); eauto. iApply (newBag_spec b NB); eauto.
iNext. iIntros (v γb) "[#Hbag Hcntn]". iNext. iIntros (v γb) "[#Hbag Hcntn]".
iMod (own_alloc (! ! )) as (γ) "[Hown Hpart]"; first done. iMod (own_alloc (! ! )) as (γ) "[Hown Hpart]"; first by apply auth_both_valid.
iMod (inv_alloc NI _ ( X, bag_contents b γb X own γ (! X))%I with "[Hcntn Hown]") as "#Hinv". iMod (inv_alloc NI _ ( X, bag_contents b γb X own γ (! X))%I with "[Hcntn Hown]") as "#Hinv".
{ iNext. iExists _. iFrame. } { iNext. iExists _. iFrame. }
iApply "HΦ". iModIntro. iExists _,_. iFrame "Hinv Hbag Hpart". iApply "HΦ". iModIntro. iExists _,_. iFrame "Hinv Hbag Hpart".
......
...@@ -58,7 +58,7 @@ Section ccounter. ...@@ -58,7 +58,7 @@ Section ccounter.
iIntros (Φ) "_ HΦ". rewrite -wp_fupd. iIntros (Φ) "_ HΦ". rewrite -wp_fupd.
wp_apply newcounter_spec; auto. wp_apply newcounter_spec; auto.
iIntros () "H"; iDestruct "H" as (γ₂) "[#HCnt Hown]". iIntros () "H"; iDestruct "H" as (γ₂) "[#HCnt Hown]".
iMod (own_alloc (! m%nat ! m%nat)) as (γ₁) "[Hγ Hγ']"; first done. iMod (own_alloc (! m%nat ! m%nat)) as (γ₁) "[Hγ Hγ']"; first by apply auth_both_valid.
iMod (inv_alloc (N .@ "counter") _ (ccounter_inv γ₁ γ₂) with "[Hγ Hown]"). iMod (inv_alloc (N .@ "counter") _ (ccounter_inv γ₁ γ₂) with "[Hγ Hown]").
{ iNext. iExists _. by iFrame. } { iNext. iExists _. by iFrame. }
iModIntro. iApply "HΦ". rewrite /is_ccounter; eauto. iModIntro. iApply "HΦ". rewrite /is_ccounter; eauto.
......
...@@ -29,7 +29,7 @@ Section monotone_counter. ...@@ -29,7 +29,7 @@ Section monotone_counter.
algebra we shall be using. The Iris library contains all the ingredients algebra we shall be using. The Iris library contains all the ingredients
needed to compose this particular resource algebra from simpler components, needed to compose this particular resource algebra from simpler components,
however to illustrate how to define our own we will define it from scratch. however to illustrate how to define our own we will define it from scratch.
In the subsequent section we show how to obtain an equivalent resource In the subsequent section we show how to obtain an equivalent resource
algebra from the building blocks provided by the Iris Coq library. algebra from the building blocks provided by the Iris Coq library.
*) *)
...@@ -423,7 +423,7 @@ Section monotone_counter'. ...@@ -423,7 +423,7 @@ Section monotone_counter'.
Proof. Proof.
(* Use a simplified definition of validity for when the underlying CMRA is discrete, i.e., an RA. (* Use a simplified definition of validity for when the underlying CMRA is discrete, i.e., an RA.
The general definition also involves the use of step-indices, which is not needed in our case. *) The general definition also involves the use of step-indices, which is not needed in our case. *)
rewrite auth_valid_discrete_2. rewrite auth_both_valid.
split. split.
- intros [? _]; by apply mnat_included. - intros [? _]; by apply mnat_included.
- intros ?%mnat_included; done. - intros ?%mnat_included; done.
...@@ -460,7 +460,7 @@ Section monotone_counter'. ...@@ -460,7 +460,7 @@ Section monotone_counter'.
iIntros (Φ) "_ HCont". iIntros (Φ) "_ HCont".
rewrite /newCounter -wp_fupd. rewrite /newCounter -wp_fupd.
wp_lam. wp_lam.
iMod (own_alloc ( (0%nat : mnatUR) 0%nat)) as (γ) "[HAuth HFrac]". iMod (own_alloc ( (0%nat : mnatUR) (0%nat : mnatUR))) as (γ) "[HAuth HFrac]".
- apply mcounterRA_valid_auth_frag'; auto. - apply mcounterRA_valid_auth_frag'; auto.
- wp_alloc as "Hpt". - wp_alloc as "Hpt".
iMod (inv_alloc N _ (counter_inv' γ) with "[Hpt HAuth]") as "HInv". iMod (inv_alloc N _ (counter_inv' γ) with "[Hpt HAuth]") as "HInv".
...@@ -505,7 +505,7 @@ Section monotone_counter'. ...@@ -505,7 +505,7 @@ Section monotone_counter'.
iInv N as (k) ">[Hpt HOwnAuth]" "HClose". iInv N as (k) ">[Hpt HOwnAuth]" "HClose".
destruct (decide (k = m)); subst. destruct (decide (k = m)); subst.
+ wp_cas_suc. + wp_cas_suc.
iMod (own_update γ (( m n)) ( (S m : mnatUR) ( S n)) with "[HOwnFrag HOwnAuth]") as "[HOwnAuth HOwnFrag]". iMod (own_update γ (( m n)) ( (S m : mnatUR) ( (S n : mnatUR))) with "[HOwnFrag HOwnAuth]") as "[HOwnAuth HOwnFrag]".
{ apply mcounterRA_update'. } { apply mcounterRA_update'. }
{ rewrite own_op; iFrame. } { rewrite own_op; iFrame. }
iMod ("HClose" with "[Hpt HOwnAuth]") as "_". iMod ("HClose" with "[Hpt HOwnAuth]") as "_".
...@@ -606,7 +606,7 @@ Section ccounter. ...@@ -606,7 +606,7 @@ Section ccounter.
{{{ γ , RET #; is_ccounter γ 1 0%nat }}}. {{{ γ , RET #; is_ccounter γ 1 0%nat }}}.
Proof. Proof.
iIntros (Φ) "_ HΦ". rewrite -wp_fupd /newCounter /=. wp_lam. wp_alloc as "Hpt". iIntros (Φ) "_ HΦ". rewrite -wp_fupd /newCounter /=. wp_lam. wp_alloc as "Hpt".
iMod (own_alloc (! O%nat ! 0%nat)) as (γ) "[Hγ Hγ']"; first done. iMod (own_alloc (! O%nat ! 0%nat)) as (γ) "[Hγ Hγ']"; first by apply auth_both_valid.
iMod (inv_alloc N _ (ccounter_inv γ ) with "[Hpt Hγ]"). iMod (inv_alloc N _ (ccounter_inv γ ) with "[Hpt Hγ]").
{ iNext. iExists 0%nat. by iFrame. } { iNext. iExists 0%nat. by iFrame. }
iModIntro. iApply "HΦ". rewrite /is_ccounter; eauto. iModIntro. iApply "HΦ". rewrite /is_ccounter; eauto.
......
...@@ -165,7 +165,7 @@ Section logatom_hocap. ...@@ -165,7 +165,7 @@ Section logatom_hocap.
iIntros (Φ) "_ HΦ". iApply wp_fupd. iApply logatom.new_stack_spec; first done. iIntros (Φ) "_ HΦ". iApply wp_fupd. iApply logatom.new_stack_spec; first done.
iIntros "!>" (γs s) "[Hstack Hcont]". iIntros "!>" (γs s) "[Hstack Hcont]".
iMod (own_alloc ( Excl' [] Excl' [])) as (γw) "[Hs● Hs◯]". iMod (own_alloc ( Excl' [] Excl' [])) as (γw) "[Hs● Hs◯]".
{ apply auth_valid_discrete_2. split; done. } { apply auth_both_valid. split; done. }
iApply ("HΦ" $! (γs, γw)). rewrite /hocap_is_stack. iFrame. iApply ("HΦ" $! (γs, γw)). rewrite /hocap_is_stack. iFrame.
iApply inv_alloc. eauto with iFrame. iApply inv_alloc. eauto with iFrame.
Qed. Qed.
...@@ -212,11 +212,11 @@ Section logatom_hocap. ...@@ -212,11 +212,11 @@ Section logatom_hocap.
iIntros (???) "Hf1 Hf2". iDestruct (own_valid_2 with "Hf1 Hf2") as %[]. iIntros (???) "Hf1 Hf2". iDestruct (own_valid_2 with "Hf1 Hf2") as %[].
Qed. Qed.
Next Obligation. Next Obligation.
iIntros (???) "Ha1 Ha2". iDestruct (own_valid_2 with "Ha1 Ha2") as %[]. iIntros (???) "Ha1 Ha2". by iDestruct (own_valid_2 with "Ha1 Ha2") as %[].
Qed. Qed.
Next Obligation. Next Obligation.
iIntros (???) "Hf Ha". iDestruct (own_valid_2 with "Ha Hf") as iIntros (???) "Hf Ha". iDestruct (own_valid_2 with "Ha Hf") as
%[->%Excl_included%leibniz_equiv _]%auth_valid_discrete_2. done. %[->%Excl_included%leibniz_equiv _]%auth_both_valid. done.
Qed. Qed.
Next Obligation. Next Obligation.
iIntros (???) "Hf Ha". iMod (own_update_2 with "Ha Hf") as "[? ?]". iIntros (???) "Hf Ha". iMod (own_update_2 with "Ha Hf") as "[? ?]".
......
...@@ -175,7 +175,7 @@ Section stack. ...@@ -175,7 +175,7 @@ Section stack.
wp_apply alloc_spec; first done. iIntros (head) "Hhead". wp_let. wp_apply alloc_spec; first done. iIntros (head) "Hhead". wp_let.
wp_apply alloc_spec; first done. iIntros (offer) "Hoffer". wp_let. wp_apply alloc_spec; first done. iIntros (offer) "Hoffer". wp_let.
iMod (own_alloc ( Excl' [] Excl' [])) as (γs) "[Hs● Hs◯]". iMod (own_alloc ( Excl' [] Excl' [])) as (γs) "[Hs● Hs◯]".
{ apply auth_valid_discrete_2. split; done. } { apply auth_both_valid. split; done. }
iMod (inv_alloc stackN _ (stack_inv γs head offer) with "[-HΦ Hs◯]"). iMod (inv_alloc stackN _ (stack_inv γs head offer) with "[-HΦ Hs◯]").
{ iNext. iExists None, None, _. iFrame. done. } { iNext. iExists None, None, _. iFrame. done. }
wp_pures. iApply "HΦ". iFrame "Hs◯". iModIntro. iExists _, _. auto. wp_pures. iApply "HΦ". iFrame "Hs◯". iModIntro. iExists _, _. auto.
...@@ -209,7 +209,7 @@ Section stack. ...@@ -209,7 +209,7 @@ Section stack.
- (* The CAS succeeded. Update everything accordingly. *) - (* The CAS succeeded. Update everything accordingly. *)
iMod "AU" as (l') "[Hl' [_ Hclose]]". iMod "AU" as (l') "[Hl' [_ Hclose]]".
iDestruct (own_valid_2 with "Hs● Hl'") as iDestruct (own_valid_2 with "Hs● Hl'") as
%[->%Excl_included%leibniz_equiv _]%auth_valid_discrete_2. %[->%Excl_included%leibniz_equiv _]%auth_both_valid.
iMod (own_update_2 with "Hs● Hl'") as "[Hs● Hl']". iMod (own_update_2 with "Hs● Hl'") as "[Hs● Hl']".
{ eapply auth_update, option_local_update, (exclusive_local_update _ (Excl _)). done. } { eapply auth_update, option_local_update, (exclusive_local_update _ (Excl _)). done. }
iMod ("Hclose" with "Hl'") as "HΦ". iModIntro. iMod ("Hclose" with "Hl'") as "HΦ". iModIntro.
...@@ -283,7 +283,7 @@ Section stack. ...@@ -283,7 +283,7 @@ Section stack.
iDestruct "Hlist" as ">%". subst stack_rep. iDestruct "Hlist" as ">%". subst stack_rep.
iMod "AU" as (l') "[Hl' [_ Hclose]]". iMod "AU" as (l') "[Hl' [_ Hclose]]".
iDestruct (own_valid_2 with "Hs● Hl'") as iDestruct (own_valid_2 with "Hs● Hl'") as
%[->%Excl_included%leibniz_equiv _]%auth_valid_discrete_2. %[->%Excl_included%leibniz_equiv _]%auth_both_valid.
iMod ("Hclose" with "Hl'") as "HΦ". iMod ("Hclose" with "Hl'") as "HΦ".
iSplitR "HΦ"; first by eauto 10 with iFrame. iSplitR "HΦ"; first by eauto 10 with iFrame.
iIntros "!>". wp_pures. by iApply "HΦ". iIntros "!>". wp_pures. by iApply "HΦ".
...@@ -305,7 +305,7 @@ Section stack. ...@@ -305,7 +305,7 @@ Section stack.
and we are done. *) and we are done. *)
iMod "AU" as (l') "[Hl' [_ Hclose]]". iMod "AU" as (l') "[Hl' [_ Hclose]]".
iDestruct (own_valid_2 with "Hs● Hl'") as iDestruct (own_valid_2 with "Hs● Hl'") as
%[->%Excl_included%leibniz_equiv _]%auth_valid_discrete_2. %[->%Excl_included%leibniz_equiv _]%auth_both_valid.
destruct l as [|v' l]; simpl. destruct l as [|v' l]; simpl.
{ (* Contradiction. *) iDestruct "Hlist" as ">%". done. } { (* Contradiction. *) iDestruct "Hlist" as ">%". done. }
iDestruct "Hlist" as (tail' q' rep') "[>Heq [>Htail' Hlist]]". iDestruct "Hlist" as (tail' q' rep') "[>Heq [>Htail' Hlist]]".
...@@ -345,13 +345,13 @@ Section stack. ...@@ -345,13 +345,13 @@ Section stack.
iInv stackN as (stack_rep offer_rep l) "(>Hs● & >H↦ & Hlist & Hoff)". iInv stackN as (stack_rep offer_rep l) "(>Hs● & >H↦ & Hlist & Hoff)".
iMod "AUoff" as (l') "[Hl' [_ Hclose]]". iMod "AUoff" as (l') "[Hl' [_ Hclose]]".
iDestruct (own_valid_2 with "Hs● Hl'") as iDestruct (own_valid_2 with "Hs● Hl'") as
%[->%Excl_included%leibniz_equiv _]%auth_valid_discrete_2. %[->%Excl_included%leibniz_equiv _]%auth_both_valid.
iMod (own_update_2 with "Hs● Hl'") as "[Hs● Hl']". iMod (own_update_2 with "Hs● Hl'") as "[Hs● Hl']".
{ eapply auth_update, option_local_update, (exclusive_local_update _ (Excl _)). done. } { eapply auth_update, option_local_update, (exclusive_local_update _ (Excl _)). done. }
iMod ("Hclose" with "Hl'") as "HQoff". iMod ("Hclose" with "Hl'") as "HQoff".
iMod "AU" as (l') "[Hl' [_ Hclose]]". iMod "AU" as (l') "[Hl' [_ Hclose]]".
iDestruct (own_valid_2 with "Hs● Hl'") as iDestruct (own_valid_2 with "Hs● Hl'") as
%[->%Excl_included%leibniz_equiv _]%auth_valid_discrete_2. %[->%Excl_included%leibniz_equiv _]%auth_both_valid.
iMod (own_update_2 with "Hs● Hl'") as "[Hs● Hl']". iMod (own_update_2 with "Hs● Hl'") as "[Hs● Hl']".
{ eapply auth_update, option_local_update, (exclusive_local_update _ (Excl _)). done. } { eapply auth_update, option_local_update, (exclusive_local_update _ (Excl _)). done. }
iMod ("Hclose" with "Hl'") as "HΦ". iMod ("Hclose" with "Hl'") as "HΦ".
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
From iris.program_logic Require Export weakestpre. From iris.program_logic Require Export weakestpre.
From iris.heap_lang Require Export lang proofmode notation. From iris.heap_lang Require Export lang proofmode notation.
From iris.algebra Require Import auth frac gmap agree. From iris.algebra Require Import excl auth frac gmap agree.
From iris.bi Require Import fractional. From iris.bi Require Import fractional.
From iris.base_logic Require Import auth. From iris.base_logic Require Import auth.
......
...@@ -160,11 +160,11 @@ Section atomic_snapshot. ...@@ -160,11 +160,11 @@ Section atomic_snapshot.
wp_alloc ly as "Hly". wp_alloc ly as "Hly".
set (Excl' (v1, v2)) as p. set (Excl' (v1, v2)) as p.
iMod (own_alloc ( p p)) as (γ1) "[Hp⚫ Hp◯]". { iMod (own_alloc ( p p)) as (γ1) "[Hp⚫ Hp◯]". {
rewrite /p. apply auth_valid_discrete_2. split; done. rewrite /p. apply auth_both_valid. split; done.
} }
set (new_timestamp 0 v1) as t. set (new_timestamp 0 v1) as t.
iMod (own_alloc ( gmap_to_UR t gmap_to_UR t)) as (γ2) "[Ht⚫ Ht◯]". { iMod (own_alloc ( gmap_to_UR t gmap_to_UR t)) as (γ2) "[Ht⚫ Ht◯]". {
rewrite /t /new_timestamp. apply auth_valid_discrete_2. rewrite /t /new_timestamp. apply auth_both_valid.
split; first done. rewrite /gmap_to_UR map_fmap_singleton. apply singleton_valid. done. split; first done. rewrite /gmap_to_UR map_fmap_singleton. apply singleton_valid. done.
} }
wp_pures. iApply ("Hp" $! (γ1, γ2)). wp_pures. iApply ("Hp" $! (γ1, γ2)).
...@@ -192,7 +192,7 @@ Section atomic_snapshot. ...@@ -192,7 +192,7 @@ Section atomic_snapshot.
Proof. Proof.
iIntros "Hγ● Hγ◯". iIntros "Hγ● Hγ◯".
iDestruct (own_valid_2 with "Hγ● Hγ◯") as iDestruct (own_valid_2 with "Hγ● Hγ◯") as
%[H%Excl_included%leibniz_equiv _]%auth_valid_discrete_2. %[H%Excl_included%leibniz_equiv _]%auth_both_valid.
done. done.
Qed. Qed.
...@@ -223,7 +223,7 @@ Section atomic_snapshot. ...@@ -223,7 +223,7 @@ Section atomic_snapshot.
Proof. Proof.
iIntros "[Hγ⚫ Hγ◯]". iIntros "[Hγ⚫ Hγ◯]".
iDestruct (own_valid_2 with "Hγ⚫ Hγ◯") as iDestruct (own_valid_2 with "Hγ⚫ Hγ◯") as
%[H Hv]%auth_valid_discrete_2. iPureIntro. intros t x HT2. %[H Hv]%auth_both_valid. iPureIntro. intros t x HT2.
pose proof (iffLR (lookup_included (gmap_to_UR T2) (gmap_to_UR T1)) H t) as Ht. pose proof (iffLR (lookup_included (gmap_to_UR T2) (gmap_to_UR T1)) H t) as Ht.
rewrite !lookup_fmap HT2 /= in Ht. rewrite !lookup_fmap HT2 /= in Ht.
destruct (is_Some_included _ _ Ht) as [? [t2 [Ht2 ->]]%fmap_Some_1]; first by eauto. destruct (is_Some_included _ _ Ht) as [? [t2 [Ht2 ->]]%fmap_Some_1]; first by eauto.
......
...@@ -156,7 +156,7 @@ Lemma auth_agree γ xs ys : ...@@ -156,7 +156,7 @@ Lemma auth_agree γ xs ys :
own γ ( (Excl' xs)) - own γ ( (Excl' ys)) - xs = ys. own γ ( (Excl' xs)) - own γ ( (Excl' ys)) - xs = ys.
Proof. Proof.
iIntros "Hγ● Hγ◯". by iDestruct (own_valid_2 with "Hγ● Hγ◯") iIntros "Hγ● Hγ◯". by iDestruct (own_valid_2 with "Hγ● Hγ◯")
as %[<-%Excl_included%leibniz_equiv _]%auth_valid_discrete_2. as %[<-%Excl_included%leibniz_equiv _]%auth_both_valid.
Qed. Qed.
(** The view of the authority can be updated together with the local view. *) (** The view of the authority can be updated together with the local view. *)
...@@ -223,7 +223,8 @@ Proof. ...@@ -223,7 +223,8 @@ Proof.
our camera named [γ], containing the empty list. This step (and the next) our camera named [γ], containing the empty list. This step (and the next)
requires the fancy update modality that was introduced earlier. *) requires the fancy update modality that was introduced earlier. *)
iMod (own_alloc ( (Some (Excl [])) (Some (Excl [])))) iMod (own_alloc ( (Some (Excl [])) (Some (Excl []))))
as (γ) "[Hγ● Hγ◯]"; (* Validity is trivial. *) first done. as (γ) "[Hγ● Hγ◯]";
(* Validity is trivial. *) first by apply auth_both_valid.
(* We can then allocate the invariant (with mask [N]). Note that we can use (* We can then allocate the invariant (with mask [N]). Note that we can use
[eauto 10 with iFrame] to prove [▷ stack_inv ℓ γ]. *) [eauto 10 with iFrame] to prove [▷ stack_inv ℓ γ]. *)
iMod (inv_alloc N _ (stack_inv γ) with "[Hl Hγ●]") iMod (inv_alloc N _ (stack_inv γ) with "[Hl Hγ●]")
......
From iris.program_logic Require Import lifting. From iris.program_logic Require Import lifting.
From iris.algebra Require Import auth frac agree gmap list. From iris.algebra Require Import excl auth frac agree gmap list.
From iris_examples.logrel.F_mu_ref Require Export rules. From iris_examples.logrel.F_mu_ref Require Export rules.
From iris.proofmode Require Import tactics. From iris.proofmode Require Import tactics.
Import uPred. Import uPred.
...@@ -65,7 +65,7 @@ Section cfg. ...@@ -65,7 +65,7 @@ Section cfg.
iInv specN as ">Hspec" "Hclose". iInv specN as ">Hspec" "Hclose".
iDestruct "Hspec" as (e'' σ) "[Hown %]". iDestruct "Hspec" as (e'' σ) "[Hown %]".
iDestruct (@own_valid_2 with "Hown Hj") iDestruct (@own_valid_2 with "Hown Hj")
as %[[?%Excl_included%leibniz_equiv _]%prod_included Hvalid]%auth_valid_discrete_2; subst. as %[[?%Excl_included%leibniz_equiv _]%prod_included Hvalid]%auth_both_valid; subst.
iMod (own_update_2 with "Hown Hj") as "[Hown Hj]". iMod (own_update_2 with "Hown Hj") as "[Hown Hj]".
{ by eapply auth_update, prod_local_update_1, option_local_update, { by eapply auth_update, prod_local_update_1, option_local_update,
(exclusive_local_update _ (Excl (fill K e'))). } (exclusive_local_update _ (Excl (fill K e'))). }
...@@ -93,7 +93,7 @@ Section cfg. ...@@ -93,7 +93,7 @@ Section cfg.
iInv specN as ">Hinv'" "Hclose". iDestruct "Hinv'" as (e2 σ) "[Hown %]". iInv specN as ">Hinv'" "Hclose". iDestruct "Hinv'" as (e2 σ) "[Hown %]".
destruct (exist_fresh (dom (gset positive) σ)) as [l Hl%not_elem_of_dom]. destruct (exist_fresh (dom (gset positive) σ)) as [l Hl%not_elem_of_dom].
iDestruct (own_valid_2 _ with "Hown Hj") iDestruct (own_valid_2 _ with "Hown Hj")
as %[[?%Excl_included%leibniz_equiv _]%prod_included ?]%auth_valid_discrete_2. as %[[?%Excl_included%leibniz_equiv _]%prod_included ?]%auth_both_valid.
subst. subst.
iMod (own_update_2 with "Hown Hj") as "[Hown Hj]". iMod (own_update_2 with "Hown Hj") as "[Hown Hj]".
{ by eapply auth_update, prod_local_update_1, option_local_update, { by eapply auth_update, prod_local_update_1, option_local_update,
...@@ -117,10 +117,10 @@ Section cfg. ...@@ -117,10 +117,10 @@ Section cfg.
rewrite /spec_ctx /tpool_mapsto /heapS_mapsto. rewrite /spec_ctx /tpool_mapsto /heapS_mapsto.
iInv specN as ">Hinv'" "Hclose". iDestruct "Hinv'" as (e2 σ) "[Hown %]". iInv specN as ">Hinv'" "Hclose". iDestruct "Hinv'" as (e2 σ) "[Hown %]".
iDestruct (own_valid_2 _ with "Hown Hj") iDestruct (own_valid_2 _ with "Hown Hj")
as %[[?%Excl_included%leibniz_equiv _]%prod_included ?]%auth_valid_discrete_2. as %[[?%Excl_included%leibniz_equiv _]%prod_included ?]%auth_both_valid.
subst. subst.
iDestruct (own_valid_2 with "Hown Hl") iDestruct (own_valid_2 with "Hown Hl")
as %[[_ ?%gen_heap_singleton_included]%prod_included _]%auth_valid_discrete_2. as %[[_ ?%gen_heap_singleton_included]%prod_included _]%auth_both_valid.
iMod (own_update_2 with "Hown Hj") as "[Hown Hj]". iMod (own_update_2 with "Hown Hj") as "[Hown Hj]".
{ by eapply auth_update, prod_local_update_1, option_local_update, { by eapply auth_update, prod_local_update_1, option_local_update,
(exclusive_local_update _ (Excl (fill K (of_val v)))). } (exclusive_local_update _ (Excl (fill K (of_val v)))). }
...@@ -139,10 +139,10 @@ Section cfg. ...@@ -139,10 +139,10 @@ Section cfg.
rewrite /spec_ctx /tpool_mapsto /heapS_mapsto. rewrite /spec_ctx /tpool_mapsto /heapS_mapsto.
iInv specN as ">Hinv'" "Hclose". iDestruct "Hinv'" as (e2 σ) "[Hown %]". iInv specN as ">Hinv'" "Hclose". iDestruct "Hinv'" as (e2 σ) "[Hown %]".
iDestruct (own_valid_2 _ with "Hown Hj") iDestruct (own_valid_2 _ with "Hown Hj")
as %[[?%Excl_included%leibniz_equiv _]%prod_included ?]%auth_valid_discrete_2. as %[[?%Excl_included%leibniz_equiv _]%prod_included ?]%auth_both_valid.
subst. subst.
iDestruct (own_valid_2 _ with "Hown Hl") iDestruct (own_valid_2 _ with "Hown Hl")
as %[[_ Hl%gen_heap_singleton_included]%prod_included _]%auth_valid_discrete_2. as %[[_ Hl%gen_heap_singleton_included]%prod_included _]%auth_both_valid.
iMod (own_update_2 with "Hown Hj") as "[Hown Hj]". iMod (own_update_2 with "Hown Hj") as "[Hown Hj]".
{ by eapply auth_update, prod_local_update_1, option_local_update, { by eapply auth_update, prod_local_update_1, option_local_update,
(exclusive_local_update _ (Excl (fill K Unit))). } (exclusive_local_update _ (Excl (fill K Unit))). }
......
...@@ -17,7 +17,7 @@ Proof. ...@@ -17,7 +17,7 @@ Proof.
eapply (wp_adequacy Σ _); eauto. eapply (wp_adequacy Σ _); eauto.
iIntros (Hinv ?). iIntros (Hinv ?).
iMod (own_alloc ( to_gen_heap σ)) as (γ) "Hh". iMod (own_alloc ( to_gen_heap σ)) as (γ) "Hh".
{ apply (auth_auth_valid _ (to_gen_heap_valid _ _ σ)). } { by apply auth_auth_valid, to_gen_heap_valid. }
iModIntro. iExists (λ σ _, own γ ( to_gen_heap σ)); iFrame. iModIntro. iExists (λ σ _, own γ ( to_gen_heap σ)); iFrame.
set (HeapΣ := (HeapG Σ Hinv (GenHeapG _ _ Σ _ _ _ γ))). set (HeapΣ := (HeapG Σ Hinv (GenHeapG _ _ Σ _ _ _ γ))).
iApply (wp_wand with "[]"). iApply (wp_wand with "[]").
......
From iris_examples.logrel.F_mu_ref Require Export context_refinement. From iris_examples.logrel.F_mu_ref Require Export context_refinement.
From iris.algebra Require Import auth frac agree. From iris.algebra Require Import excl auth frac agree.
From iris.proofmode Require Import tactics. From iris.proofmode Require Import tactics.
From iris.program_logic Require Import adequacy. From iris.program_logic Require Import adequacy.
From iris_examples.logrel.F_mu_ref Require Import soundness. From iris_examples.logrel.F_mu_ref Require Import soundness.
...@@ -16,10 +16,10 @@ Proof. ...@@ -16,10 +16,10 @@ Proof.
eapply (wp_adequacy Σ); first by apply _. eapply (wp_adequacy Σ); first by apply _.
iIntros (Hinv ?). iIntros (Hinv ?).
iMod (own_alloc ( to_gen_heap )) as (γ) "Hh". iMod (own_alloc ( to_gen_heap )) as (γ) "Hh".
{ apply (auth_auth_valid _ (to_gen_heap_valid _ _ )). } { by apply auth_auth_valid, to_gen_heap_valid. }
iMod (own_alloc ( (Excl' e', ) iMod (own_alloc ( (Excl' e', )
((Excl' e', ) : cfgUR))) as (γc) "[Hcfg1 Hcfg2]". ((Excl' e', ) : cfgUR))) as (γc) "[Hcfg1 Hcfg2]".
{ apply auth_valid_discrete_2. split=>//. } { apply auth_both_valid. split=>//. }
set (Hcfg := CFGSG _ _ γc). set (Hcfg := CFGSG _ _ γc).
iMod (inv_alloc specN _ (spec_ctx ([e'], )) with "[Hcfg1]") as "#Hcfg". iMod (inv_alloc specN _ (spec_ctx ([e'], )) with "[Hcfg1]") as "#Hcfg".
{ iNext. iExists e', . iSplit; eauto. { iNext. iExists e', . iSplit; eauto.
...@@ -38,7 +38,7 @@ Proof. ...@@ -38,7 +38,7 @@ Proof.
iDestruct "Hinv" as (e'' σ) "[Hown %]". iDestruct "Hinv" as (e'' σ) "[Hown %]".
rewrite /tpool_mapsto /=. rewrite /tpool_mapsto /=.
iDestruct (own_valid_2 with "Hown Hj") as %Hvalid. iDestruct (own_valid_2 with "Hown Hj") as %Hvalid.
move: Hvalid=> /auth_valid_discrete_2 move: Hvalid=> /auth_both_valid
[/prod_included [Hv2 _] _]. apply Excl_included, leibniz_equiv in Hv2. subst. [/prod_included [Hv2 _] _]. apply Excl_included, leibniz_equiv in Hv2. subst.
iMod ("Hclose" with "[-]") as "_". iMod ("Hclose" with "[-]") as "_".
+ iExists (#v2), σ. auto. + iExists (#v2), σ. auto.
......
...@@ -47,7 +47,7 @@ Section Stack_refinement. ...@@ -47,7 +47,7 @@ Section Stack_refinement.
simpl. iApply wp_pure_step_later; trivial. iNext. simpl. simpl. iApply wp_pure_step_later; trivial. iNext. simpl.
iAsimpl. iAsimpl.
(* establishing the invariant *) (* establishing the invariant *)
iMod (own_alloc ( ( : stackUR))) as (γ) "Hemp"; first done. iMod (own_alloc ( ( : stackUR))) as (γ) "Hemp"; first by apply auth_auth_valid.
set (istkG := StackG _ _ γ). set (istkG := StackG _ _ γ).
change γ with (@stack_name _ istkG). change γ with (@stack_name _ istkG).
change H1 with (@stack_inG _ istkG). change H1 with (@stack_inG _ istkG).
......
...@@ -25,7 +25,7 @@ Section Rules. ...@@ -25,7 +25,7 @@ Section Rules.
Lemma stack_mapstos_agree l v w : l ↦ˢᵗᵏ v l ↦ˢᵗᵏ w v = w. Lemma stack_mapstos_agree l v w : l ↦ˢᵗᵏ v l ↦ˢᵗᵏ w v = w.
Proof. Proof.
rewrite -own_op -auth_frag_op op_singleton own_valid. rewrite -own_op -auth_frag_op op_singleton own_valid.
by iIntros (->%auth_own_valid%singleton_valid%agree_op_invL'). by iIntros (->%auth_frag_valid%singleton_valid%agree_op_invL').
Qed. Qed.
Program Definition StackLink_pre (Q : D) : D -n> D := λne P v, Program Definition StackLink_pre (Q : D) : D -n> D := λne P v,
...@@ -94,7 +94,7 @@ Section Rules. ...@@ -94,7 +94,7 @@ Section Rules.
Proof. Proof.
iIntros "[Howns Hls] Hl". iIntros "[Howns Hls] Hl".
iDestruct (own_valid_2 with "Howns Hl") iDestruct (own_valid_2 with "Howns Hl")
as %[[az [Haz Hq]]%singleton_included _]%auth_valid_discrete_2. as %[[az [Haz Hq]]%singleton_included _]%auth_both_valid.
rewrite lookup_fmap in Haz. rewrite lookup_fmap in Haz.
assert ( z, h !! l = Some z) as Hz. assert ( z, h !! l = Some z) as Hz.
{ revert Haz; case: (h !! l) => [z|] Hz; first (by eauto); inversion Hz. } { revert Haz; case: (h !! l) => [z|] Hz; first (by eauto); inversion Hz. }
......
From iris.program_logic Require Export language ectx_language ectxi_language. From iris.program_logic Require Export language ectx_language ectxi_language.
From iris.program_logic Require Import lifting. From iris.program_logic Require Import lifting.
From iris.algebra Require Import auth frac agree gmap list. From iris.algebra Require Import excl auth frac agree gmap list.
From iris_examples.logrel.F_mu_ref_conc Require Export rules. From iris_examples.logrel.F_mu_ref_conc Require Export rules.
From iris.proofmode Require Import tactics. From iris.proofmode Require Import tactics.
Import uPred. Import uPred.
...@@ -174,7 +174,7 @@ Section cfg. ...@@ -174,7 +174,7 @@ Section cfg.
iInv specN as (tp σ) ">[Hown Hrtc]" "Hclose". iInv specN as (tp σ) ">[Hown Hrtc]" "Hclose".
iDestruct "Hrtc" as %Hrtc. iDestruct "Hrtc" as %Hrtc.
iDestruct (own_valid_2 with "Hown Hj") iDestruct (own_valid_2 with "Hown Hj")
as %[[Htpj%tpool_singleton_included' _]%prod_included ?]%auth_valid_discrete_2. as %[[Htpj%tpool_singleton_included' _]%prod_included ?]%auth_both_valid.
iMod (own_update_2 with "Hown Hj") as "[Hown Hj]". iMod (own_update_2 with "Hown Hj") as "[Hown Hj]".
{ by eapply auth_update, prod_local_update_1, { by eapply auth_update, prod_local_update_1,
singleton_local_update, (exclusive_local_update _ (Excl (fill K e'))). } singleton_local_update, (exclusive_local_update _ (Excl (fill K e'))). }
...@@ -221,7 +221,7 @@ Section cfg. ...@@ -221,7 +221,7 @@ Section cfg.
iInv specN as (tp σ) ">[Hown %]" "Hclose". iInv specN as (tp σ) ">[Hown %]" "Hclose".
destruct (exist_fresh (dom (gset positive) σ)) as [l Hl%not_elem_of_dom]. destruct (exist_fresh (dom (gset positive) σ)) as [l Hl%not_elem_of_dom].
iDestruct (own_valid_2 with "Hown Hj") iDestruct (own_valid_2 with "Hown Hj")
as %[[?%tpool_singleton_included' _]%prod_included ?]%auth_valid_discrete_2. as %[[?%tpool_singleton_included' _]%prod_included ?]%auth_both_valid.
iMod (own_update_2 with "Hown Hj") as "[Hown Hj]". iMod (own_update_2 with "Hown Hj") as "[Hown Hj]".
{ by eapply auth_update, prod_local_update_1, { by eapply auth_update, prod_local_update_1,
singleton_local_update, (exclusive_local_update _ (Excl (fill K (Loc l)))). } singleton_local_update, (exclusive_local_update _ (Excl (fill K (Loc l)))). }
...@@ -244,9 +244,10 @@ Section cfg. ...@@ -244,9 +244,10 @@ Section cfg.
rewrite /spec_ctx /tpool_mapsto /heapS_mapsto. rewrite /spec_ctx /tpool_mapsto /heapS_mapsto.
iInv specN as (tp σ) ">[Hown %]" "Hclose". iInv specN as (tp σ) ">[Hown %]" "Hclose".
iDestruct (own_valid_2 with "Hown Hj") iDestruct (own_valid_2 with "Hown Hj")
as %[[?%tpool_singleton_included' _]%prod_included ?]%auth_valid_discrete_2. as %[[?%tpool_singleton_included' _]%prod_included ?]%auth_both_valid.
iDestruct (own_valid_2 with "Hown Hl") iDestruct (own_valid_2 with "Hown Hl")
as %[[? ?%gen_heap_singleton_included]%prod_included ?]%auth_valid_discrete_2. iMod (own_update_2 with "Hown Hj") as "[Hown Hj]". as %[[? ?%gen_heap_singleton_included]%prod_included ?]%auth_both_valid.
iMod (own_update_2 with "Hown Hj") as "[Hown Hj]".