From 4271f4c52c5521bb002a739e998d094fc84fded7 Mon Sep 17 00:00:00 2001 From: Jacques-Henri Jourdan <jacques-henri.jourdan@normalesup.org> Date: Wed, 12 May 2021 13:04:49 +0200 Subject: [PATCH] unfold lftE into lftN. There is no point in using both these definitions everywhere. --- theories/typing/lib/arc.v | 4 ++-- theories/typing/lib/mutex/mutexguard.v | 2 +- theories/typing/lib/rc/rc.v | 2 +- theories/typing/lib/rc/weak.v | 2 +- theories/typing/lib/refcell/refmut.v | 2 +- theories/typing/lib/rwlock/rwlockwriteguard.v | 2 +- theories/typing/own.v | 2 +- theories/typing/programs.v | 4 ++-- theories/typing/type.v | 7 +++---- theories/typing/uniq_bor.v | 2 +- theories/typing/util.v | 8 ++++---- 11 files changed, 18 insertions(+), 19 deletions(-) diff --git a/theories/typing/lib/arc.v b/theories/typing/lib/arc.v index 0e21a980..56ed0432 100644 --- a/theories/typing/lib/arc.v +++ b/theories/typing/lib/arc.v @@ -105,7 +105,7 @@ Section arc. | _ => False end; ty_shr κ tid l := ∃ (l' : loc), &frac{κ} (λ q, l ↦{q} #l') ∗ - â–¡ ∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[κ] + â–¡ ∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[κ] ={F}[F∖↑shrN]â–·=∗ q.[κ] ∗ ∃ γ ν q', κ ⊑ ν ∗ arc_persist tid ν γ l' ty ∗ &at{κ, arc_shrN}(arc_tok γ q') @@ -227,7 +227,7 @@ Section arc. | _ => False end; ty_shr κ tid l := ∃ (l' : loc), &frac{κ} (λ q, l ↦{q} #l') ∗ - â–¡ ∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[κ] + â–¡ ∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[κ] ={F}[F∖↑shrN]â–·=∗ q.[κ] ∗ ∃ γ ν, arc_persist tid ν γ l' ty ∗ &at{κ, arc_shrN}(weak_tok γ) |}%I. diff --git a/theories/typing/lib/mutex/mutexguard.v b/theories/typing/lib/mutex/mutexguard.v index acc66566..2ca7e007 100644 --- a/theories/typing/lib/mutex/mutexguard.v +++ b/theories/typing/lib/mutex/mutexguard.v @@ -38,7 +38,7 @@ Section mguard. | _ => False end; ty_shr κ tid l := ∃ (l':loc), &frac{κ}(λ q', l ↦{q'} #l') ∗ - â–¡ ∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[α⊓κ] + â–¡ ∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[α⊓κ] ={F}[F∖↑shrN]â–·=∗ ty.(ty_shr) (α⊓κ) tid (l' +â‚— 1) ∗ q.[α⊓κ] |}%I. Next Obligation. by iIntros (? ty tid [|[[]|][]]) "H". Qed. diff --git a/theories/typing/lib/rc/rc.v b/theories/typing/lib/rc/rc.v index 38f7b51a..84266a6d 100644 --- a/theories/typing/lib/rc/rc.v +++ b/theories/typing/lib/rc/rc.v @@ -121,7 +121,7 @@ Section rc. | _ => False end; ty_shr κ tid l := ∃ (l' : loc), &frac{κ} (λ q, l ↦{q} #l') ∗ - â–¡ ∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[κ] + â–¡ ∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[κ] ={F}[F∖↑shrN]â–·=∗ q.[κ] ∗ ∃ γ ν q', κ ⊑ ν ∗ rc_persist tid ν γ l' ty ∗ &na{κ, tid, rc_shrN}(own γ (rc_tok q')) diff --git a/theories/typing/lib/rc/weak.v b/theories/typing/lib/rc/weak.v index c7f3a8b0..5f2f3df2 100644 --- a/theories/typing/lib/rc/weak.v +++ b/theories/typing/lib/rc/weak.v @@ -18,7 +18,7 @@ Section weak. | _ => False end; ty_shr κ tid l := ∃ (l' : loc), &frac{κ} (λ q, l ↦{q} #l') ∗ - â–¡ ∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[κ] + â–¡ ∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[κ] ={F}[F∖↑shrN]â–·=∗ q.[κ] ∗ ∃ γ ν, rc_persist tid ν γ l' ty ∗ &na{κ, tid, rc_shrN}(own γ weak_tok) |}%I. diff --git a/theories/typing/lib/refcell/refmut.v b/theories/typing/lib/refcell/refmut.v index a435bbda..ff6e32e0 100644 --- a/theories/typing/lib/refcell/refmut.v +++ b/theories/typing/lib/refcell/refmut.v @@ -33,7 +33,7 @@ Section refmut. ty_shr κ tid l := ∃ (lv lrc : loc), &frac{κ} (λ q, l↦∗{q} [ #lv; #lrc]) ∗ - â–¡ ∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[α ⊓ κ] + â–¡ ∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[α ⊓ κ] ={F}[F∖↑shrN]â–·=∗ ty.(ty_shr) (α ⊓ κ) tid lv ∗ q.[α ⊓ κ] |}%I. Next Obligation. iIntros (???[|[[]|][|[[]|][]]]); try iIntros "[]". by iIntros "_". diff --git a/theories/typing/lib/rwlock/rwlockwriteguard.v b/theories/typing/lib/rwlock/rwlockwriteguard.v index 7bffa2d3..f6ba19e9 100644 --- a/theories/typing/lib/rwlock/rwlockwriteguard.v +++ b/theories/typing/lib/rwlock/rwlockwriteguard.v @@ -29,7 +29,7 @@ Section rwlockwriteguard. ty_shr κ tid l := ∃ (l' : loc), &frac{κ} (λ q, l↦∗{q} [ #l']) ∗ - â–¡ ∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[α ⊓ κ] ={F}[F∖↑shrN]â–·=∗ + â–¡ ∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[α ⊓ κ] ={F}[F∖↑shrN]â–·=∗ ty.(ty_shr) (α ⊓ κ) tid (l' +â‚— 1) ∗ q.[α ⊓ κ] |}%I. Next Obligation. by iIntros (???[|[[]|][]]) "?". Qed. Next Obligation. diff --git a/theories/typing/own.v b/theories/typing/own.v index 0c345c96..a03beedf 100644 --- a/theories/typing/own.v +++ b/theories/typing/own.v @@ -60,7 +60,7 @@ Section own. end%I; ty_shr κ tid l := (∃ l':loc, &frac{κ}(λ q', l ↦{q'} #l') ∗ - â–¡ (∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[κ] ={F}[F∖↑shrN]â–·=∗ + â–¡ (∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[κ] ={F}[F∖↑shrN]â–·=∗ ty.(ty_shr) κ tid l' ∗ q.[κ]))%I |}. Next Obligation. by iIntros (q ty tid [|[[]|][]]) "H". Qed. Next Obligation. diff --git a/theories/typing/programs.v b/theories/typing/programs.v index 8b387f12..1a5e14ff 100644 --- a/theories/typing/programs.v +++ b/theories/typing/programs.v @@ -65,7 +65,7 @@ Section typing. (** Writing and Reading **) Definition typed_write_def (E : elctx) (L : llctx) (ty1 ty ty2 : type) : iProp Σ := - (â–¡ ∀ v tid F qmax qL, ⌜lftE ∪ (↑lrustN) ⊆ F⌠→ + (â–¡ ∀ v tid F qmax qL, ⌜↑lftN ∪ (↑lrustN) ⊆ F⌠→ lft_ctx -∗ elctx_interp E -∗ llctx_interp_noend qmax L qL -∗ ty1.(ty_own) tid [v] ={F}=∗ ∃ (l : loc) vl, ⌜length vl = ty.(ty_size) ∧ v = #l⌠∗ l ↦∗ vl ∗ (â–· l ↦∗: ty.(ty_own) tid ={F}=∗ @@ -85,7 +85,7 @@ Section typing. that nobody could possibly have changed the vl (because only half the fraction was given). So we go with the definition that is easier to prove. *) Definition typed_read_def (E : elctx) (L : llctx) (ty1 ty ty2 : type) : iProp Σ := - (â–¡ ∀ v tid F qmax qL, ⌜lftE ∪ ↑lrustN ⊆ F⌠→ + (â–¡ ∀ v tid F qmax qL, ⌜↑lftN ∪ ↑lrustN ⊆ F⌠→ lft_ctx -∗ elctx_interp E -∗ na_own tid F -∗ llctx_interp_noend qmax L qL -∗ ty1.(ty_own) tid [v] ={F}=∗ ∃ (l : loc) vl q, ⌜v = #l⌠∗ l ↦∗{q} vl ∗ â–· ty.(ty_own) tid vl ∗ diff --git a/theories/typing/type.v b/theories/typing/type.v index 627b5111..61c8cf75 100644 --- a/theories/typing/type.v +++ b/theories/typing/type.v @@ -13,7 +13,6 @@ Class typeG Σ := TypeG { type_frac_borrowG :> frac_borG Σ }. -Definition lftE : coPset := ↑lftN. Definition lrustN := nroot .@ "lrust". Definition shrN := lrustN .@ "shr". @@ -40,7 +39,7 @@ Record type `{!typeG Σ} := nicer (they would otherwise require a "∨ â–¡|=>[†κ]"), and (b) so that we can have emp == sum []. *) - ty_share E κ l tid q : lftE ⊆ E → + ty_share E κ l tid q : ↑lftN ⊆ E → lft_ctx -∗ &{κ} (l ↦∗: ty_own tid) -∗ q.[κ] ={E}=∗ ty_shr κ tid l ∗ q.[κ]; ty_shr_mono κ κ' tid l : @@ -175,7 +174,7 @@ Section ofe. Let P (x : T) : Prop := (∀ κ tid l, Persistent (x.2 κ tid l)) ∧ (∀ tid vl, x.1.2 tid vl -∗ ⌜length vl = x.1.1âŒ) ∧ - (∀ E κ l tid q, lftE ⊆ E → + (∀ E κ l tid q, ↑lftN ⊆ E → lft_ctx -∗ &{κ} (l ↦∗: λ vs, x.1.2 tid vs) -∗ q.[κ] ={E}=∗ x.2 κ tid l ∗ q.[κ]) ∧ (∀ κ κ' tid l, κ' ⊑ κ -∗ x.2 κ tid l -∗ x.2 κ' tid l). @@ -395,7 +394,7 @@ Fixpoint shr_locsE (l : loc) (n : nat) : coPset := Class Copy `{!typeG Σ} (t : type) := { copy_persistent tid vl : Persistent (t.(ty_own) tid vl); copy_shr_acc κ tid E F l q : - lftE ∪ ↑shrN ⊆ E → shr_locsE l (t.(ty_size) + 1) ⊆ F → + ↑lftN ∪ ↑shrN ⊆ E → shr_locsE l (t.(ty_size) + 1) ⊆ F → lft_ctx -∗ t.(ty_shr) κ tid l -∗ na_own tid F -∗ q.[κ] ={E}=∗ ∃ q', na_own tid (F ∖ shr_locsE l t.(ty_size)) ∗ â–·(l ↦∗{q'}: t.(ty_own) tid) ∗ diff --git a/theories/typing/uniq_bor.v b/theories/typing/uniq_bor.v index 674d69f5..f5ca1e03 100644 --- a/theories/typing/uniq_bor.v +++ b/theories/typing/uniq_bor.v @@ -16,7 +16,7 @@ Section uniq_bor. end; ty_shr κ' tid l := ∃ l':loc, &frac{κ'}(λ q', l ↦{q'} #l') ∗ - â–¡ ∀ F q, ⌜↑shrN ∪ lftE ⊆ F⌠-∗ q.[κ⊓κ'] + â–¡ ∀ F q, ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ q.[κ⊓κ'] ={F}[F∖↑shrN]â–·=∗ ty.(ty_shr) (κ⊓κ') tid l' ∗ q.[κ⊓κ'] |}%I. Next Obligation. by iIntros (q ty tid [|[[]|][]]) "H". Qed. diff --git a/theories/typing/util.v b/theories/typing/util.v index 857d6a42..6bf47379 100644 --- a/theories/typing/util.v +++ b/theories/typing/util.v @@ -25,10 +25,10 @@ Section util. *) Lemma delay_sharing_later N κ l ty tid : - lftE ⊆ N → + ↑lftN ⊆ N → lft_ctx -∗ &{κ}(â–· l ↦∗: ty_own ty tid) ={N}=∗ â–¡ ∀ (F : coPset) (q : Qp), - ⌜↑shrN ∪ lftE ⊆ F⌠-∗ (q).[κ] ={F}[F ∖ ↑shrN]â–·=∗ ty.(ty_shr) κ tid l ∗ (q).[κ]. + ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ (q).[κ] ={F}[F ∖ ↑shrN]â–·=∗ ty.(ty_shr) κ tid l ∗ (q).[κ]. Proof. iIntros (?) "#LFT Hbor". rewrite bor_unfold_idx. iDestruct "Hbor" as (i) "(#Hpb&Hpbown)". @@ -47,10 +47,10 @@ Section util. Qed. Lemma delay_sharing_nested N κ κ' κ'' l ty tid : - lftE ⊆ N → + ↑lftN ⊆ N → lft_ctx -∗ â–· (κ'' ⊑ κ ⊓ κ') -∗ &{κ'}(&{κ}(l ↦∗: ty_own ty tid)) ={N}=∗ â–¡ ∀ (F : coPset) (q : Qp), - ⌜↑shrN ∪ lftE ⊆ F⌠-∗ (q).[κ''] ={F}[F ∖ ↑shrN]â–·=∗ ty.(ty_shr) κ'' tid l ∗ (q).[κ'']. + ⌜↑shrN ∪ ↑lftN ⊆ F⌠-∗ (q).[κ''] ={F}[F ∖ ↑shrN]â–·=∗ ty.(ty_shr) κ'' tid l ∗ (q).[κ'']. Proof. iIntros (?) "#LFT #Hincl Hbor". rewrite bor_unfold_idx. iDestruct "Hbor" as (i) "(#Hpb&Hpbown)". -- GitLab