Commit 93792f5c authored by Robbert Krebbers's avatar Robbert Krebbers

Change notations of big_ops for upred.

Rationale: to make the code closer to what is on paper, I want the notations
to look like quantifiers, i.e. have a binder built-in. I thus introduced the
following notations:

  [★ map] k ↦ x ∈ m, P
  [★ set] x ∈ X, P

The good thing - contrary to the notations that we had before that required an
explicit lambda - is that type annotations of k and x are now not printed
making goals much easier to read.
parent 92768cff
Pipeline #1141 passed with stage
This diff is collapsed.
...@@ -22,8 +22,7 @@ Module uPred_reflection. Section uPred_reflection. ...@@ -22,8 +22,7 @@ Module uPred_reflection. Section uPred_reflection.
| ESep e1 e2 => flatten e1 ++ flatten e2 | ESep e1 e2 => flatten e1 ++ flatten e2
end. end.
Notation eval_list Σ l := Notation eval_list Σ l := ([] ((λ n, from_option True%I (Σ !! n)) <$> l))%I.
(uPred_big_sep ((λ n, from_option True%I (Σ !! n)) <$> l)).
Lemma eval_flatten Σ e : eval Σ e eval_list Σ (flatten e). Lemma eval_flatten Σ e : eval Σ e eval_list Σ (flatten e).
Proof. Proof.
induction e as [| |e1 IH1 e2 IH2]; induction e as [| |e1 IH1 e2 IH2];
......
...@@ -98,7 +98,7 @@ Section heap. ...@@ -98,7 +98,7 @@ Section heap.
(** Allocation *) (** Allocation *)
Lemma heap_alloc N E σ : Lemma heap_alloc N E σ :
authG heap_lang Σ heapR nclose N E authG heap_lang Σ heapR nclose N E
ownP σ (|={E}=> _ : heapG Σ, heap_ctx N Π★{map σ} (λ l v, l v)). ownP σ (|={E}=> _ : heapG Σ, heap_ctx N [ map] lv σ, l v).
Proof. Proof.
intros. rewrite -{1}(from_to_heap σ). etrans. intros. rewrite -{1}(from_to_heap σ). etrans.
{ rewrite [ownP _]later_intro. { rewrite [ownP _]later_intro.
......
...@@ -28,7 +28,7 @@ Local Notation iProp := (iPropG heap_lang Σ). ...@@ -28,7 +28,7 @@ Local Notation iProp := (iPropG heap_lang Σ).
Definition ress (P : iProp) (I : gset gname) : iProp := Definition ress (P : iProp) (I : gset gname) : iProp :=
( Ψ : gname iProp, ( Ψ : gname iProp,
(P - Π★{set I} Ψ) Π★{set I} (λ i, saved_prop_own i (Ψ i)))%I. (P - [ set] i I, Ψ i) [ set] i I, saved_prop_own i (Ψ i))%I.
Coercion state_to_val (s : state) : val := Coercion state_to_val (s : state) : val :=
match s with State Low _ => #0 | State High _ => #1 end. match s with State Low _ => #0 | State High _ => #1 end.
...@@ -159,7 +159,7 @@ Proof. ...@@ -159,7 +159,7 @@ Proof.
iSplit; [iPureIntro; by eauto using wait_step|]. iSplit; [iPureIntro; by eauto using wait_step|].
iDestruct "Hr" as {Ψ} "[HΨ Hsp]". iDestruct "Hr" as {Ψ} "[HΨ Hsp]".
iDestruct (big_sepS_delete _ _ i with "Hsp") as "[#HΨi Hsp]"; first done. iDestruct (big_sepS_delete _ _ i with "Hsp") as "[#HΨi Hsp]"; first done.
iAssert ( Ψ i Π★{set (I {[i]})} Ψ)%I with "[HΨ]" as "[HΨ HΨ']". iAssert ( Ψ i [ set] j I {[i]}, Ψ j)%I with "[HΨ]" as "[HΨ HΨ']".
{ iNext. iApply (big_sepS_delete _ _ i); first done. by iApply "HΨ". } { iNext. iApply (big_sepS_delete _ _ i); first done. by iApply "HΨ". }
iSplitL "HΨ' Hl Hsp"; [iNext|]. iSplitL "HΨ' Hl Hsp"; [iNext|].
+ rewrite {2}/barrier_inv /=; iFrame "Hl". + rewrite {2}/barrier_inv /=; iFrame "Hl".
......
...@@ -25,7 +25,7 @@ Record envs_wf {M} (Δ : envs M) := { ...@@ -25,7 +25,7 @@ Record envs_wf {M} (Δ : envs M) := {
}. }.
Coercion of_envs {M} (Δ : envs M) : uPred M := Coercion of_envs {M} (Δ : envs M) : uPred M :=
( envs_wf Δ Π env_persistent Δ Π★ env_spatial Δ)%I. ( envs_wf Δ [] env_persistent Δ [] env_spatial Δ)%I.
Instance: Params (@of_envs) 1. Instance: Params (@of_envs) 1.
Record envs_Forall2 {M} (R : relation (uPred M)) (Δ1 Δ2 : envs M) : Prop := { Record envs_Forall2 {M} (R : relation (uPred M)) (Δ1 Δ2 : envs M) : Prop := {
...@@ -102,7 +102,7 @@ Implicit Types Δ : envs M. ...@@ -102,7 +102,7 @@ Implicit Types Δ : envs M.
Implicit Types P Q : uPred M. Implicit Types P Q : uPred M.
Lemma of_envs_def Δ : Lemma of_envs_def Δ :
of_envs Δ = ( envs_wf Δ Π env_persistent Δ Π★ env_spatial Δ)%I. of_envs Δ = ( envs_wf Δ [] env_persistent Δ [] env_spatial Δ)%I.
Proof. done. Qed. Proof. done. Qed.
Lemma envs_lookup_delete_Some Δ Δ' i p P : Lemma envs_lookup_delete_Some Δ Δ' i p P :
...@@ -120,12 +120,12 @@ Proof. ...@@ -120,12 +120,12 @@ Proof.
rewrite /envs_lookup /envs_delete /of_envs=>?; apply const_elim_sep_l=> Hwf. rewrite /envs_lookup /envs_delete /of_envs=>?; apply const_elim_sep_l=> Hwf.
destruct Δ as [Γp Γs], (Γp !! i) eqn:?; simplify_eq/=. destruct Δ as [Γp Γs], (Γp !! i) eqn:?; simplify_eq/=.
- rewrite (env_lookup_perm Γp) //= always_and_sep always_sep. - rewrite (env_lookup_perm Γp) //= always_and_sep always_sep.
ecancel [ Π _; P; Π★ _]%I; apply const_intro. ecancel [ [] _; P; [] _]%I; apply const_intro.
destruct Hwf; constructor; destruct Hwf; constructor;
naive_solver eauto using env_delete_wf, env_delete_fresh. naive_solver eauto using env_delete_wf, env_delete_fresh.
- destruct (Γs !! i) eqn:?; simplify_eq/=. - destruct (Γs !! i) eqn:?; simplify_eq/=.
rewrite (env_lookup_perm Γs) //=. rewrite (env_lookup_perm Γs) //=.
ecancel [ Π _; P; Π★ _]%I; apply const_intro. ecancel [ [] _; P; [] _]%I; apply const_intro.
destruct Hwf; constructor; destruct Hwf; constructor;
naive_solver eauto using env_delete_wf, env_delete_fresh. naive_solver eauto using env_delete_wf, env_delete_fresh.
Qed. Qed.
...@@ -158,7 +158,7 @@ Lemma envs_lookup_delete_sound' Δ Δ' i p P : ...@@ -158,7 +158,7 @@ Lemma envs_lookup_delete_sound' Δ Δ' i p P :
envs_lookup_delete i Δ = Some (p,P,Δ') Δ (P Δ')%I. envs_lookup_delete i Δ = Some (p,P,Δ') Δ (P Δ')%I.
Proof. intros [? ->]%envs_lookup_delete_Some. by apply envs_lookup_sound'. Qed. Proof. intros [? ->]%envs_lookup_delete_Some. by apply envs_lookup_sound'. Qed.
Lemma envs_app_sound Δ Δ' p Γ : envs_app p Γ Δ = Some Δ' Δ (?p Π★ Γ - Δ'). Lemma envs_app_sound Δ Δ' p Γ : envs_app p Γ Δ = Some Δ' Δ (?p [] Γ - Δ').
Proof. Proof.
rewrite /of_envs /envs_app=> ?; apply const_elim_sep_l=> Hwf. rewrite /of_envs /envs_app=> ?; apply const_elim_sep_l=> Hwf.
destruct Δ as [Γp Γs], p; simplify_eq/=. destruct Δ as [Γp Γs], p; simplify_eq/=.
...@@ -182,7 +182,7 @@ Qed. ...@@ -182,7 +182,7 @@ Qed.
Lemma envs_simple_replace_sound' Δ Δ' i p Γ : Lemma envs_simple_replace_sound' Δ Δ' i p Γ :
envs_simple_replace i p Γ Δ = Some Δ' envs_simple_replace i p Γ Δ = Some Δ'
envs_delete i p Δ (?p Π★ Γ - Δ')%I. envs_delete i p Δ (?p [] Γ - Δ')%I.
Proof. Proof.
rewrite /envs_simple_replace /envs_delete /of_envs=> ?. rewrite /envs_simple_replace /envs_delete /of_envs=> ?.
apply const_elim_sep_l=> Hwf. destruct Δ as [Γp Γs], p; simplify_eq/=. apply const_elim_sep_l=> Hwf. destruct Δ as [Γp Γs], p; simplify_eq/=.
...@@ -206,11 +206,11 @@ Qed. ...@@ -206,11 +206,11 @@ Qed.
Lemma envs_simple_replace_sound Δ Δ' i p P Γ : Lemma envs_simple_replace_sound Δ Δ' i p P Γ :
envs_lookup i Δ = Some (p,P) envs_simple_replace i p Γ Δ = Some Δ' envs_lookup i Δ = Some (p,P) envs_simple_replace i p Γ Δ = Some Δ'
Δ (?p P (?p Π★ Γ - Δ'))%I. Δ (?p P (?p [] Γ - Δ'))%I.
Proof. intros. by rewrite envs_lookup_sound// envs_simple_replace_sound'//. Qed. Proof. intros. by rewrite envs_lookup_sound// envs_simple_replace_sound'//. Qed.
Lemma envs_replace_sound' Δ Δ' i p q Γ : Lemma envs_replace_sound' Δ Δ' i p q Γ :
envs_replace i p q Γ Δ = Some Δ' envs_delete i p Δ (?q Π★ Γ - Δ')%I. envs_replace i p q Γ Δ = Some Δ' envs_delete i p Δ (?q [] Γ - Δ')%I.
Proof. Proof.
rewrite /envs_replace; destruct (eqb _ _) eqn:Hpq. rewrite /envs_replace; destruct (eqb _ _) eqn:Hpq.
- apply eqb_prop in Hpq as ->. apply envs_simple_replace_sound'. - apply eqb_prop in Hpq as ->. apply envs_simple_replace_sound'.
...@@ -219,7 +219,7 @@ Qed. ...@@ -219,7 +219,7 @@ Qed.
Lemma envs_replace_sound Δ Δ' i p q P Γ : Lemma envs_replace_sound Δ Δ' i p q P Γ :
envs_lookup i Δ = Some (p,P) envs_replace i p q Γ Δ = Some Δ' envs_lookup i Δ = Some (p,P) envs_replace i p q Γ Δ = Some Δ'
Δ (?p P (?q Π★ Γ - Δ'))%I. Δ (?p P (?q [] Γ - Δ'))%I.
Proof. intros. by rewrite envs_lookup_sound// envs_replace_sound'//. Qed. Proof. intros. by rewrite envs_lookup_sound// envs_replace_sound'//. Qed.
Lemma envs_split_sound Δ lr js Δ1 Δ2 : Lemma envs_split_sound Δ lr js Δ1 Δ2 :
...@@ -228,21 +228,21 @@ Proof. ...@@ -228,21 +228,21 @@ Proof.
rewrite /envs_split /of_envs=> ?; apply const_elim_sep_l=> Hwf. rewrite /envs_split /of_envs=> ?; apply const_elim_sep_l=> Hwf.
destruct Δ as [Γp Γs], (env_split js _) as [[Γs1 Γs2]|] eqn:?; simplify_eq/=. destruct Δ as [Γp Γs], (env_split js _) as [[Γs1 Γs2]|] eqn:?; simplify_eq/=.
rewrite (env_split_perm Γs) // big_sep_app {1}always_sep_dup'. rewrite (env_split_perm Γs) // big_sep_app {1}always_sep_dup'.
destruct lr; simplify_eq/=; cancel [ Π Γp; Π Γp; Π★ Γs1; Π★ Γs2]%I; destruct lr; simplify_eq/=; cancel [ [] Γp; [] Γp; [] Γs1; [] Γs2]%I;
destruct Hwf; apply sep_intro_True_l; apply const_intro; constructor; destruct Hwf; apply sep_intro_True_l; apply const_intro; constructor;
naive_solver eauto using env_split_wf_1, env_split_wf_2, naive_solver eauto using env_split_wf_1, env_split_wf_2,
env_split_fresh_1, env_split_fresh_2. env_split_fresh_1, env_split_fresh_2.
Qed. Qed.
Lemma envs_clear_spatial_sound Δ : Lemma envs_clear_spatial_sound Δ :
Δ (envs_clear_spatial Δ Π★ env_spatial Δ)%I. Δ (envs_clear_spatial Δ [] env_spatial Δ)%I.
Proof. Proof.
rewrite /of_envs /envs_clear_spatial /=; apply const_elim_sep_l=> Hwf. rewrite /of_envs /envs_clear_spatial /=; apply const_elim_sep_l=> Hwf.
rewrite right_id -assoc; apply sep_intro_True_l; [apply const_intro|done]. rewrite right_id -assoc; apply sep_intro_True_l; [apply const_intro|done].
destruct Hwf; constructor; simpl; auto using Enil_wf. destruct Hwf; constructor; simpl; auto using Enil_wf.
Qed. Qed.
Lemma env_fold_wand Γ Q : env_fold uPred_wand Q Γ (Π★ Γ - Q). Lemma env_fold_wand Γ Q : env_fold uPred_wand Q Γ ([] Γ - Q).
Proof. Proof.
revert Q; induction Γ as [|Γ IH i P]=> Q /=; [by rewrite wand_True|]. revert Q; induction Γ as [|Γ IH i P]=> Q /=; [by rewrite wand_True|].
by rewrite IH wand_curry (comm uPred_sep). by rewrite IH wand_curry (comm uPred_sep).
......
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