Commit d0a6e8d0 authored by Dan Frumin's avatar Dan Frumin

Use the most general rule for FAI in the ticket lock proof

parent b3b1911c
...@@ -71,9 +71,9 @@ Section contents. ...@@ -71,9 +71,9 @@ Section contents.
Lemma FAI_atomic R1 R2 Γ E1 E2 K x t τ Δ : Lemma FAI_atomic R1 R2 Γ E1 E2 K x t τ Δ :
R2 - R2 -
(|={E1,E2}=> n : nat, x ↦ᵢ #n R1 n (|={E1,E2}=> n : nat, x ↦ᵢ #n R1 n
(x ↦ᵢ #n R1 n ={E2,E1}= True) (( (m: nat), x ↦ᵢ #m R1 m) ={E2,E1}= True)
(x ↦ᵢ #(S n) R1 n - R2 - ( m, x ↦ᵢ #(S m) R1 m - R2 -
{E2,E1;Δ;Γ} fill K #n log t : τ)) {E2,E1;Δ;Γ} fill K #m log t : τ))
- ({E1;Δ;Γ} fill K (FAI #x) log t : τ). - ({E1;Δ;Γ} fill K (FAI #x) log t : τ).
Proof. Proof.
iIntros "HR2 #H". iIntros "HR2 #H".
...@@ -87,7 +87,7 @@ Section contents. ...@@ -87,7 +87,7 @@ Section contents.
iExists #n. iFrame. iNext. iIntros "Hx". iExists #n. iFrame. iNext. iIntros "Hx".
iDestruct "Hrev" as "[Hrev _]". iDestruct "Hrev" as "[Hrev _]".
iMod ("Hrev" with "[HR Hx]") as "_". iMod ("Hrev" with "[HR Hx]") as "_".
{ by iFrame. } { iExists _. by iFrame. }
rel_rec_l. rel_op_l. rel_rec_l. rel_op_l.
rel_cas_l_atomic. rel_cas_l_atomic.
iMod "H" as (n') "[Hx [HR HQ]]". iModIntro. iMod "H" as (n') "[Hx [HR HQ]]". iModIntro.
...@@ -104,7 +104,7 @@ Section contents. ...@@ -104,7 +104,7 @@ Section contents.
rel_if_l. rel_if_l.
iDestruct "HQ" as "[HQ _]". iDestruct "HQ" as "[HQ _]".
iMod ("HQ" with "[Hx HR]") as "_". iMod ("HQ" with "[Hx HR]") as "_".
{ by iFrame. } { iExists _. by iFrame. }
unlock FAI. unlock FAI.
by iApply "IH". by iApply "IH".
Qed. Qed.
...@@ -225,7 +225,7 @@ Section contents. ...@@ -225,7 +225,7 @@ Section contents.
rel_let_l. repeat rel_proj_l. rel_let_l. repeat rel_proj_l.
(* rel_apply_l (FAI_atomic). *) (* rel_apply_l (FAI_atomic). *)
rel_bind_l (FAI #ln). rel_bind_l (FAI #ln).
iApply (FAI_atomic (fun _ => True)%I True%I); first done. iApply (FAI_atomic (fun n => own γ ( GSet (seq_set 0 n)))%I True%I); first done.
iAlways. iAlways.
iInv N as (P) "[>HP Hpool]" "Hcl". iInv N as (P) "[>HP Hpool]" "Hcl".
iDestruct (lockPool_lookup with "HP Hls") as %Hls. iDestruct (lockPool_lookup with "HP Hls") as %Hls.
...@@ -233,17 +233,15 @@ Section contents. ...@@ -233,17 +233,15 @@ Section contents.
rewrite {1}/lockInv. rewrite {1}/lockInv.
iDestruct "Hlk" as (o n b) "(>Hlo & >Hln & >Hseq & Hl' & Hrest)". iDestruct "Hlk" as (o n b) "(>Hlo & >Hln & >Hseq & Hl' & Hrest)".
iModIntro. iExists _; iFrame. iModIntro. iExists _; iFrame.
iSplitR; first done.
iSplit. iSplit.
- iIntros "[Hln ?]". - iDestruct 1 as (m) "[Hln ?]".
iMod ("Hcl" with "[-]") as "_". iApply ("Hcl" with "[-]").
{ iNext. iExists P; iFrame. iNext. iExists P; iFrame.
iApply "Hpool". iExists _,_,_; iFrame. iFrame "Hrest". } iApply "Hpool". iExists _,_,_; by iFrame.
done. - iIntros (m) "[Hln Hseq] _".
- iIntros "[Hln ?] _".
iMod (own_update with "Hseq") as "[Hseq Hticket]". iMod (own_update with "Hseq") as "[Hseq Hticket]".
{ eapply auth_update_alloc. { eapply auth_update_alloc.
eapply (gset_disj_alloc_empty_local_update _ {[ n ]}). eapply (gset_disj_alloc_empty_local_update _ {[ m ]}).
apply (seq_set_S_disjoint 0). } apply (seq_set_S_disjoint 0). }
rewrite -(seq_set_S_union_L 0). rewrite -(seq_set_S_union_L 0).
iMod ("Hcl" with "[-Hticket]") as "_". iMod ("Hcl" with "[-Hticket]") as "_".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment