Commit 67d0a0ab authored by Dan Frumin's avatar Dan Frumin

Introduce a single typeclass for logical state for logical relations

parent c61b7c2a
From iris.program_logic Require Export weakestpre adequacy.
From iris_logrel.F_mu_ref_conc Require Export rules.
From iris.algebra Require Import auth.
From iris.proofmode Require Import tactics.
Set Default Proof Using "Type".
Class heapPreG Σ := HeapPreG {
heap_preG_iris :> invPreG Σ;
heap_preG_heap :> gen_heapPreG loc val Σ
}.
Definition heapΣ : gFunctors := #[invΣ; gen_heapΣ loc val].
Instance subG_heapPreG {Σ} : subG heapΣ Σ heapPreG Σ.
Proof. solve_inG. Qed.
Definition heap_adequacy Σ `{heapPreG Σ} e σ φ :
( `{heapG Σ}, True WP e {{ v, ⌜φ v }})
adequate e σ φ.
Proof.
intros Hwp; eapply (wp_adequacy _ _); iIntros (?) "".
iMod (own_alloc ( to_gen_heap σ)) as (γ) "Hh".
{ apply: auth_auth_valid. exact: to_gen_heap_valid. }
iModIntro. iExists (λ σ, own γ ( to_gen_heap σ)); iFrame.
set (Hheap := GenHeapG loc val Σ _ _ _ γ).
iApply (Hwp (HeapG _ _ _)).
Qed.
...@@ -228,7 +228,7 @@ Ltac fold_interp := ...@@ -228,7 +228,7 @@ Ltac fold_interp :=
end. end.
Section bin_log_related_under_typed_ctx. Section bin_log_related_under_typed_ctx.
Context `{heapIG Σ, cfgSG Σ}. Context `{logrelG Σ}.
Ltac fundamental := Ltac fundamental :=
try (solve_ndisj); try (solve_ndisj);
......
...@@ -29,7 +29,7 @@ Definition FG_counter : expr := ...@@ -29,7 +29,7 @@ Definition FG_counter : expr :=
(FG_increment "x", counter_read "x"). (FG_increment "x", counter_read "x").
Section CG_Counter. Section CG_Counter.
Context `{heapIG Σ, cfgSG Σ}. Context `{logrelG Σ}.
(* Coarse-grained increment *) (* Coarse-grained increment *)
Lemma CG_increment_type Γ : Lemma CG_increment_type Γ :
...@@ -314,12 +314,6 @@ Theorem counter_ctx_refinement : ...@@ -314,12 +314,6 @@ Theorem counter_ctx_refinement :
FG_counter ctx CG_counter : FG_counter ctx CG_counter :
TProd (TArrow TUnit TUnit) (TArrow TUnit TNat). TProd (TArrow TUnit TUnit) (TArrow TUnit TNat).
Proof. Proof.
set (Σ := #[invΣ ; gen_heapΣ loc val ; authΣ cfgUR ]). eapply (logrel_ctxequiv logrelΣ); [solve_closed.. | intros ].
set (HG := HeapPreIG Σ _ _). apply FG_CG_counter_refinement.
eapply (logrel_ctxequiv Σ _).
(* TODO: how to get rid of this bullshit with closed conditions? *)
rewrite /FG_counter /CG_counter; try solve_closed.
rewrite /FG_counter /CG_counter; try solve_closed.
Transparent newlock. unfold newlock. solve_closed.
intros. apply FG_CG_counter_refinement.
Qed. Qed.
...@@ -17,7 +17,7 @@ Definition earlyChoice : val := λ: "x", ...@@ -17,7 +17,7 @@ Definition earlyChoice : val := λ: "x",
let: "r" := rand #() in "x" <- #n 0;; "r". let: "r" := rand #() in "x" <- #n 0;; "r".
Section Refinement. Section Refinement.
Context `{heapIG Σ, cfgSG Σ}. Context `{logrelG Σ}.
Definition choiceN : namespace := nroot .@ "choice". Definition choiceN : namespace := nroot .@ "choice".
......
...@@ -52,8 +52,7 @@ Qed. ...@@ -52,8 +52,7 @@ Qed.
Hint Resolve with_lock_type : typeable. Hint Resolve with_lock_type : typeable.
Section proof. Section proof.
Context `{cfgSG Σ}. Context `{logrelG Σ}.
Context `{heapIG Σ}.
Variable (E1 E2 : coPset). Variable (E1 E2 : coPset).
Lemma steps_newlock ρ j K Lemma steps_newlock ρ j K
......
...@@ -29,7 +29,7 @@ Qed. ...@@ -29,7 +29,7 @@ Qed.
Hint Resolve par_type : typeable. Hint Resolve par_type : typeable.
Section compatibility. Section compatibility.
Context `{heapIG Σ, cfgSG Σ}. Context `{logrelG Σ}.
Lemma bin_log_related_par Γ E e1 e2 e1' e2' τ1 τ2 : Lemma bin_log_related_par Γ E e1 e2 e1' e2' τ1 τ2 :
specN E specN E
......
...@@ -5,7 +5,7 @@ From iris.base_logic Require Export big_op. ...@@ -5,7 +5,7 @@ From iris.base_logic Require Export big_op.
From iris.program_logic Require Import ectx_lifting. From iris.program_logic Require Import ectx_lifting.
Section fundamental. Section fundamental.
Context `{heapIG Σ, cfgSG Σ}. Context `{logrelG Σ}.
Notation D := (prodC valC valC -n> iProp Σ). Notation D := (prodC valC valC -n> iProp Σ).
Implicit Types e : expr. Implicit Types e : expr.
Implicit Types Δ : listC D. Implicit Types Δ : listC D.
......
...@@ -25,7 +25,7 @@ Ltac inv_head_step := ...@@ -25,7 +25,7 @@ Ltac inv_head_step :=
end. end.
Section hax. Section hax.
Context `{heapIG Σ, cfgSG Σ}. Context `{logrelG Σ}.
Notation D := (prodC valC valC -n> iProp Σ). Notation D := (prodC valC valC -n> iProp Σ).
Implicit Types Δ : listC D. Implicit Types Δ : listC D.
......
...@@ -38,7 +38,7 @@ Definition logN : namespace := nroot .@ "logN". ...@@ -38,7 +38,7 @@ Definition logN : namespace := nroot .@ "logN".
(** interp : is a unary logical relation. *) (** interp : is a unary logical relation. *)
Section logrel. Section logrel.
Context `{heapIG Σ, cfgSG Σ}. Context `{logrelG Σ}.
Notation D := (prodC valC valC -n> iProp Σ). Notation D := (prodC valC valC -n> iProp Σ).
Implicit Types τi : D. Implicit Types τi : D.
Implicit Types Δ : listC D. Implicit Types Δ : listC D.
...@@ -372,7 +372,7 @@ Notation "⟦ τ ⟧ₑ" := (interp_expr ⊤ ⊤ ⟦ τ ⟧). ...@@ -372,7 +372,7 @@ Notation "⟦ τ ⟧ₑ" := (interp_expr ⊤ ⊤ ⟦ τ ⟧).
Notation "⟦ Γ ⟧*" := (interp_env Γ). Notation "⟦ Γ ⟧*" := (interp_env Γ).
Section bin_log_def. Section bin_log_def.
Context `{heapIG Σ, cfgSG Σ}. Context `{logrelG Σ}.
Notation D := (prodC valC valC -n> iProp Σ). Notation D := (prodC valC valC -n> iProp Σ).
Definition bin_log_related_def (E1 E2 : coPset) (Γ : stringmap type) (e e' : expr) (τ : type) : iProp Σ := ( Δ (vvs : stringmap (val * val)) ρ, Definition bin_log_related_def (E1 E2 : coPset) (Γ : stringmap type) (e e' : expr) (τ : type) : iProp Σ := ( Δ (vvs : stringmap (val * val)) ρ,
......
...@@ -10,7 +10,7 @@ Import lang. ...@@ -10,7 +10,7 @@ Import lang.
LHS once if necessary, to get rid of the lock added by the syntactic sugar. *) LHS once if necessary, to get rid of the lock added by the syntactic sugar. *)
Ltac solve_of_val_unlock := try apply of_val_unlock; fast_done. Ltac solve_of_val_unlock := try apply of_val_unlock; fast_done.
Lemma tac_rel_bind_gen `{heapIG Σ, !cfgSG Σ} Δ E1 E2 Γ e e' t t' τ : Lemma tac_rel_bind_gen `{logrelG Σ} Δ E1 E2 Γ e e' t t' τ :
e = e' e = e'
t = t' t = t'
(Δ bin_log_related E1 E2 Γ e' t' τ) (Δ bin_log_related E1 E2 Γ e' t' τ)
...@@ -19,13 +19,13 @@ Proof. ...@@ -19,13 +19,13 @@ Proof.
intros. subst t e. assumption. intros. subst t e. assumption.
Qed. Qed.
Lemma tac_rel_bind_l `{heapIG Σ, !cfgSG Σ} e' K Δ E1 E2 Γ e t τ : Lemma tac_rel_bind_l `{logrelG Σ} e' K Δ E1 E2 Γ e t τ :
e = fill K e' e = fill K e'
(Δ bin_log_related E1 E2 Γ (fill K e') t τ) (Δ bin_log_related E1 E2 Γ (fill K e') t τ)
(Δ bin_log_related E1 E2 Γ e t τ). (Δ bin_log_related E1 E2 Γ e t τ).
Proof. intros. eapply tac_rel_bind_gen; eauto. Qed. Proof. intros. eapply tac_rel_bind_gen; eauto. Qed.
Lemma tac_rel_bind_r `{heapIG Σ, !cfgSG Σ} t' K Δ E1 E2 Γ e t τ : Lemma tac_rel_bind_r `{logrelG Σ} t' K Δ E1 E2 Γ e t τ :
t = fill K t' t = fill K t'
(Δ bin_log_related E1 E2 Γ e (fill K t') τ) (Δ bin_log_related E1 E2 Γ e (fill K t') τ)
(Δ bin_log_related E1 E2 Γ e t τ). (Δ bin_log_related E1 E2 Γ e t τ).
...@@ -76,7 +76,7 @@ Tactic Notation "rel_bind_r" open_constr(efoc) := ...@@ -76,7 +76,7 @@ Tactic Notation "rel_bind_r" open_constr(efoc) :=
| (* new goal *) | (* new goal *)
]. ].
Lemma tac_rel_rec_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e K' f x ef e' efbody v eres t τ : Lemma tac_rel_rec_l `{logrelG Σ} Δ E1 Γ e K' f x ef e' efbody v eres t τ :
e = fill K' (App ef e') e = fill K' (App ef e')
ef = Rec f x efbody ef = Rec f x efbody
Closed (x :b: f :b: ) efbody Closed (x :b: f :b: ) efbody
...@@ -110,7 +110,7 @@ Tactic Notation "rel_rec_l" := ...@@ -110,7 +110,7 @@ Tactic Notation "rel_rec_l" :=
Tactic Notation "rel_seq_l" := rel_rec_l. Tactic Notation "rel_seq_l" := rel_rec_l.
Tactic Notation "rel_let_l" := rel_rec_l. Tactic Notation "rel_let_l" := rel_rec_l.
Lemma tac_rel_fst_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e e1 e2 v1 v2 K' t τ : Lemma tac_rel_fst_l `{logrelG Σ} Δ E1 Γ e e1 e2 v1 v2 K' t τ :
e = fill K' (Fst (Pair e1 e2)) e = fill K' (Fst (Pair e1 e2))
to_val e1 = Some v1 to_val e1 = Some v1
to_val e2 = Some v2 to_val e2 = Some v2
...@@ -132,7 +132,7 @@ Tactic Notation "rel_fst_l" := ...@@ -132,7 +132,7 @@ Tactic Notation "rel_fst_l" :=
|solve_to_val |solve_to_val
|iNext (* new goal *)]. |iNext (* new goal *)].
Lemma tac_rel_snd_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e e1 e2 v1 v2 K' t τ : Lemma tac_rel_snd_l `{logrelG Σ} Δ E1 Γ e e1 e2 v1 v2 K' t τ :
e = fill K' (Snd (Pair e1 e2)) e = fill K' (Snd (Pair e1 e2))
to_val e1 = Some v1 to_val e1 = Some v1
to_val e2 = Some v2 to_val e2 = Some v2
...@@ -154,7 +154,7 @@ Tactic Notation "rel_snd_l" := ...@@ -154,7 +154,7 @@ Tactic Notation "rel_snd_l" :=
|solve_to_val |solve_to_val
|iNext (* new goal *)]. |iNext (* new goal *)].
Lemma tac_rel_unfold_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e e1 v K' t τ : Lemma tac_rel_unfold_l `{logrelG Σ} Δ E1 Γ e e1 v K' t τ :
e = fill K' (Unfold (Fold e1)) e = fill K' (Unfold (Fold e1))
to_val e1 = Some v to_val e1 = Some v
(Δ bin_log_related E1 E1 Γ (fill K' e1) t τ) (Δ bin_log_related E1 E1 Γ (fill K' e1) t τ)
...@@ -174,7 +174,7 @@ Tactic Notation "rel_unfold_l" := ...@@ -174,7 +174,7 @@ Tactic Notation "rel_unfold_l" :=
Tactic Notation "rel_fold_l" := rel_unfold_l. Tactic Notation "rel_fold_l" := rel_unfold_l.
Lemma tac_rel_if_true_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e e1 e2 K' t τ : Lemma tac_rel_if_true_l `{logrelG Σ} Δ E1 Γ e e1 e2 K' t τ :
e = fill K' (If (# true) e1 e2) e = fill K' (If (# true) e1 e2)
Closed e1 Closed e1
Closed e2 Closed e2
...@@ -194,7 +194,7 @@ Tactic Notation "rel_if_true_l" := ...@@ -194,7 +194,7 @@ Tactic Notation "rel_if_true_l" :=
|try solve_closed |try solve_closed
|iNext (* new goal *)]. |iNext (* new goal *)].
Lemma tac_rel_if_false_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e e1 e2 K' t τ : Lemma tac_rel_if_false_l `{logrelG Σ} Δ E1 Γ e e1 e2 K' t τ :
e = fill K' (If (# false) e1 e2) e = fill K' (If (# false) e1 e2)
Closed e1 Closed e1
Closed e2 Closed e2
...@@ -214,7 +214,7 @@ Tactic Notation "rel_if_false_l" := ...@@ -214,7 +214,7 @@ Tactic Notation "rel_if_false_l" :=
|try solve_closed |try solve_closed
|iNext (* new goal *)]. |iNext (* new goal *)].
Lemma tac_rel_case_inl_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e e0 v e1 e2 K' t τ : Lemma tac_rel_case_inl_l `{logrelG Σ} Δ E1 Γ e e0 v e1 e2 K' t τ :
e = fill K' (Case (InjL e0) e1 e2) e = fill K' (Case (InjL e0) e1 e2)
to_val e0 = Some v to_val e0 = Some v
Closed e1 Closed e1
...@@ -236,7 +236,7 @@ Tactic Notation "rel_case_inl_l" := ...@@ -236,7 +236,7 @@ Tactic Notation "rel_case_inl_l" :=
|try solve_closed |try solve_closed
|iNext (* new goal *)]. |iNext (* new goal *)].
Lemma tac_rel_case_inr_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e e0 v e1 e2 K' t τ : Lemma tac_rel_case_inr_l `{logrelG Σ} Δ E1 Γ e e0 v e1 e2 K' t τ :
e = fill K' (Case (InjR e0) e1 e2) e = fill K' (Case (InjR e0) e1 e2)
to_val e0 = Some v to_val e0 = Some v
Closed e1 Closed e1
...@@ -258,7 +258,7 @@ Tactic Notation "rel_case_inr_l" := ...@@ -258,7 +258,7 @@ Tactic Notation "rel_case_inr_l" :=
|try solve_closed |try solve_closed
|iNext (* new goal *)]. |iNext (* new goal *)].
Lemma tac_rel_binop_l `{heapIG Σ, !cfgSG Σ} Δ E1 Γ e K' op a b eres t τ : Lemma tac_rel_binop_l `{logrelG Σ} Δ E1 Γ e K' op a b eres t τ :
e = fill K' (BinOp op (#n a) (#n b)) e = fill K' (BinOp op (#n a) (#n b))
eres = of_val (binop_eval op a b) eres = of_val (binop_eval op a b)
(Δ bin_log_related E1 E1 Γ (fill K' eres) t τ) (Δ bin_log_related E1 E1 Γ (fill K' eres) t τ)
...@@ -276,7 +276,7 @@ Tactic Notation "rel_op_l" := ...@@ -276,7 +276,7 @@ Tactic Notation "rel_op_l" :=
|simpl; reflexivity (* eres = of_val .. *) |simpl; reflexivity (* eres = of_val .. *)
|iNext (* new goal *)]. |iNext (* new goal *)].
Lemma tac_rel_fork_l `{heapIG Σ, !cfgSG Σ} Δ1 E1 E2 e' K' Γ e t τ : Lemma tac_rel_fork_l `{logrelG Σ} Δ1 E1 E2 e' K' Γ e t τ :
e = fill K' (Fork e') e = fill K' (Fork e')
Closed e' Closed e'
(Δ1 |={E1,E2}=> WP e' {{ _ , True }} bin_log_related E2 E1 Γ (fill K' (Lit Unit)) t τ) (Δ1 |={E1,E2}=> WP e' {{ _ , True }} bin_log_related E2 E1 Γ (fill K' (Lit Unit)) t τ)
...@@ -294,7 +294,7 @@ Tactic Notation "rel_fork_l" := ...@@ -294,7 +294,7 @@ Tactic Notation "rel_fork_l" :=
|solve_closed |solve_closed
|simpl (* new goal *) ]. |simpl (* new goal *) ].
Lemma tac_rel_alloc_l `{heapIG Σ, !cfgSG Σ} nam nam_cl Δ1 Δ2 E1 E2 p i1 N P e' v' K' Γ e t τ : Lemma tac_rel_alloc_l `{logrelG Σ} nam nam_cl Δ1 Δ2 E1 E2 p i1 N P e' v' K' Γ e t τ :
nclose N E1 nclose N E1
envs_lookup i1 Δ1 = Some (p, inv N P) envs_lookup i1 Δ1 = Some (p, inv N P)
E2 = E1 N E2 = E1 N
...@@ -345,7 +345,7 @@ Tactic Notation "rel_alloc_l" "under" constr(N) "as" constr(nam) constr(nam_cl) ...@@ -345,7 +345,7 @@ Tactic Notation "rel_alloc_l" "under" constr(N) "as" constr(nam) constr(nam_cl)
|env_cbv; reflexivity || fail "rel_alloc_l: this should not happen" |env_cbv; reflexivity || fail "rel_alloc_l: this should not happen"
|(* new goal *)]. |(* new goal *)].
Lemma tac_rel_alloc_l_simp `{heapIG Σ, !cfgSG Σ} Δ1 E1 e' v' K' Γ e t τ : Lemma tac_rel_alloc_l_simp `{logrelG Σ} Δ1 Δ2 E1 e' v' K' Γ e t τ :
e = fill K' (Alloc e') e = fill K' (Alloc e')
to_val e' = Some v' to_val e' = Some v'
(Δ1 l, (Δ1 l,
...@@ -366,7 +366,7 @@ Tactic Notation "rel_alloc_l" "as" ident(l) constr(H) := ...@@ -366,7 +366,7 @@ Tactic Notation "rel_alloc_l" "as" ident(l) constr(H) :=
|iIntros (l) H (* new goal *)]. |iIntros (l) H (* new goal *)].
Lemma tac_rel_load_l `{heapIG Σ, !cfgSG Σ} nam nam_cl Δ1 Δ2 E1 E2 p i1 N P l K' Γ e t τ : Lemma tac_rel_load_l `{logrelG Σ} nam nam_cl Δ1 Δ2 E1 E2 p i1 N P l K' Γ e t τ :
nclose N E1 nclose N E1
envs_lookup i1 Δ1 = Some (p, inv N P) envs_lookup i1 Δ1 = Some (p, inv N P)
E2 = E1 N E2 = E1 N
...@@ -416,7 +416,7 @@ Tactic Notation "rel_load_l" "under" constr(N) "as" constr(nam) constr(nam_cl) : ...@@ -416,7 +416,7 @@ Tactic Notation "rel_load_l" "under" constr(N) "as" constr(nam) constr(nam_cl) :
|env_cbv; reflexivity || fail "rel_load_l: this should not happen" |env_cbv; reflexivity || fail "rel_load_l: this should not happen"
|(* new goal *)]. |(* new goal *)].
Lemma tac_rel_load_l_simp `{heapIG Σ, !cfgSG Σ} Δ1 Δ2 E1 i1 l v K' Γ e t τ : Lemma tac_rel_load_l_simp `{logrelG Σ} Δ1 Δ2 E1 i1 l v K' Γ e t τ :
e = fill K' (Load (Loc l)) e = fill K' (Load (Loc l))
IntoLaterNEnvs 1 Δ1 Δ2 IntoLaterNEnvs 1 Δ1 Δ2
envs_lookup i1 Δ2 = Some (false, l ↦ᵢ v)%I envs_lookup i1 Δ2 = Some (false, l ↦ᵢ v)%I
...@@ -440,7 +440,7 @@ Tactic Notation "rel_load_l" := ...@@ -440,7 +440,7 @@ Tactic Notation "rel_load_l" :=
|iAssumptionCore || fail 3 "rel_load_l: cannot find ? ↦ᵢ ?" |iAssumptionCore || fail 3 "rel_load_l: cannot find ? ↦ᵢ ?"
| (* new goal *)]. | (* new goal *)].
Lemma tac_rel_store_l `{heapIG Σ, !cfgSG Σ} nam nam_cl Δ1 Δ2 E1 E2 p i1 N P l e' v' K' Γ e t τ : Lemma tac_rel_store_l `{logrelG Σ} nam nam_cl Δ1 Δ2 E1 E2 p i1 N P l e' v' K' Γ e t τ :
nclose N E1 nclose N E1
envs_lookup i1 Δ1 = Some (p, inv N P) envs_lookup i1 Δ1 = Some (p, inv N P)
E2 = E1 N E2 = E1 N
...@@ -493,7 +493,7 @@ Tactic Notation "rel_store_l" "under" constr(N) "as" constr(nam) constr(nam_cl) ...@@ -493,7 +493,7 @@ Tactic Notation "rel_store_l" "under" constr(N) "as" constr(nam) constr(nam_cl)
|(* new goal *)]. |(* new goal *)].
Lemma tac_rel_store_l_simp `{heapIG Σ, !cfgSG Σ} Δ1 Δ2 i1 E1 l v e' v' K' Γ e t τ : Lemma tac_rel_store_l_simp `{logrelG Σ} Δ1 Δ2 i1 E1 l v e' v' K' Γ e t τ :
e = fill K' (Store (Loc l) e') e = fill K' (Store (Loc l) e')
to_val e' = Some v' to_val e' = Some v'
envs_lookup i1 Δ1 = Some (false, l ↦ᵢ v)%I envs_lookup i1 Δ1 = Some (false, l ↦ᵢ v)%I
...@@ -520,7 +520,7 @@ Tactic Notation "rel_store_l" := ...@@ -520,7 +520,7 @@ Tactic Notation "rel_store_l" :=
|env_cbv; reflexivity || fail "rel_store_l: this should not happen" |env_cbv; reflexivity || fail "rel_store_l: this should not happen"
| (* new goal *)]. | (* new goal *)].
Lemma tac_rel_cas_l `{heapIG Σ, !cfgSG Σ} nam nam_cl Δ1 Δ2 E1 E2 p i1 N P l e1 e2 v1 v2 K' Γ e t τ : Lemma tac_rel_cas_l `{logrelG Σ} nam nam_cl Δ1 Δ2 E1 E2 p i1 N P l e1 e2 v1 v2 K' Γ e t τ :
nclose N E1 nclose N E1
envs_lookup i1 Δ1 = Some (p, inv N P) envs_lookup i1 Δ1 = Some (p, inv N P)
E2 = E1 N E2 = E1 N
...@@ -584,7 +584,7 @@ Tactic Notation "rel_cas_l" "under" constr(N) "as" constr(nam) constr(nam_cl) := ...@@ -584,7 +584,7 @@ Tactic Notation "rel_cas_l" "under" constr(N) "as" constr(nam) constr(nam_cl) :=
(********************************) (********************************)
Lemma tac_rel_fork_r `{heapIG Σ, !cfgSG Σ} Δ1 E1 E2 t' K' Γ e t τ : Lemma tac_rel_fork_r `{logrelG Σ} Δ1 E1 E2 t' K' Γ e t τ :
nclose specN E1 nclose specN E1
t = fill K' (Fork t') t = fill K' (Fork t')
Closed t' Closed t'
...@@ -604,7 +604,7 @@ Tactic Notation "rel_fork_r" "as" ident(i) constr(H) := ...@@ -604,7 +604,7 @@ Tactic Notation "rel_fork_r" "as" ident(i) constr(H) :=
|solve_closed |solve_closed
|simpl; iIntros (i) H (* new goal *)]. |simpl; iIntros (i) H (* new goal *)].
Lemma tac_rel_store_r `{heapIG Σ, !cfgSG Σ} Δ1 Δ2 E1 E2 i1 l t' v' K' Γ e t τ v : Lemma tac_rel_store_r `{logrelG Σ} Δ1 Δ2 E1 E2 i1 l t' v' K' Γ e t τ v :
nclose specN E1 nclose specN E1
t = fill K' (Store (Loc l) t') t = fill K' (Store (Loc l) t')
to_val t' = Some v' to_val t' = Some v'
...@@ -632,7 +632,7 @@ Tactic Notation "rel_store_r" := ...@@ -632,7 +632,7 @@ Tactic Notation "rel_store_r" :=
|env_cbv; reflexivity || fail "rel_store_r: this should not happen" |env_cbv; reflexivity || fail "rel_store_r: this should not happen"
|(* new goal *)]. |(* new goal *)].
Lemma tac_rel_alloc_r `{heapIG Σ, !cfgSG Σ} Δ1 E1 E2 t' v' K' Γ e t τ : Lemma tac_rel_alloc_r `{logrelG Σ} Δ1 E1 E2 t' v' K' Γ e t τ :
nclose specN E1 nclose specN E1
t = fill K' (Alloc t') t = fill K' (Alloc t')
to_val t' = Some v' to_val t' = Some v'
...@@ -657,7 +657,7 @@ Tactic Notation "rel_alloc_r" := ...@@ -657,7 +657,7 @@ Tactic Notation "rel_alloc_r" :=
let H := iFresh "H" in let H := iFresh "H" in
rel_alloc_r as l H. rel_alloc_r as l H.
Lemma tac_rel_load_r `{heapIG Σ, !cfgSG Σ} Δ1 Δ2 E1 E2 i1 l K' Γ e t τ v : Lemma tac_rel_load_r `{logrelG Σ} Δ1 Δ2 E1 E2 i1 l K' Γ e t τ v :
nclose specN E1 nclose specN E1
t = fill K' (Load (Loc l)) t = fill K' (Load (Loc l))
envs_lookup i1 Δ1 = Some (false, l ↦ₛ v)%I envs_lookup i1 Δ1 = Some (false, l ↦ₛ v)%I
...@@ -684,7 +684,7 @@ Tactic Notation "rel_load_r" := ...@@ -684,7 +684,7 @@ Tactic Notation "rel_load_r" :=
|env_cbv; reflexivity || fail "rel_load_r: this should not happen" |env_cbv; reflexivity || fail "rel_load_r: this should not happen"
|simpl (* new goal *)]. |simpl (* new goal *)].
Lemma tac_rel_cas_fail_r `{heapIG Σ, !cfgSG Σ} Δ1 Δ2 E1 E2 i1 l K' Γ e t e1 e2 v1 v2 τ v : Lemma tac_rel_cas_fail_r `{logrelG Σ} Δ1 Δ2 E1 E2 i1 l K' Γ e t e1 e2 v1 v2 τ v :
nclose specN E1 nclose specN E1
t = fill K' (CAS (Loc l) e1 e2) t = fill K' (CAS (Loc l) e1 e2)
to_val e1 = Some v1 to_val e1 = Some v1
...@@ -718,7 +718,7 @@ Tactic Notation "rel_cas_fail_r" := ...@@ -718,7 +718,7 @@ Tactic Notation "rel_cas_fail_r" :=
|(* new goal *)]. |(* new goal *)].
Lemma tac_rel_cas_suc_r `{heapIG Σ, !cfgSG Σ} Δ1 Δ2 E1 E2 i1 l K' Γ e t e1 e2 v1 v2 τ v : Lemma tac_rel_cas_suc_r `{logrelG Σ} Δ1 Δ2 E1 E2 i1 l K' Γ e t e1 e2 v1 v2 τ v :
nclose specN E1 nclose specN E1
t = fill K' (CAS (Loc l) e1 e2) t = fill K' (CAS (Loc l) e1 e2)
to_val e1 = Some v1 to_val e1 = Some v1
...@@ -752,7 +752,7 @@ Tactic Notation "rel_cas_suc_r" := ...@@ -752,7 +752,7 @@ Tactic Notation "rel_cas_suc_r" :=
|(* new goal *)]. |(* new goal *)].
Lemma tac_rel_rec_r `{heapIG Σ, !cfgSG Σ} Δ E1 E2 Γ e K' f x ef e' efbody v eres t τ : Lemma tac_rel_rec_r `{logrelG Σ} Δ E1 E2 Γ e K' f x ef e' efbody v eres t τ :
nclose specN E1 nclose specN E1
e = fill K' (App ef e') e = fill K' (App ef e')
ef = Rec f x efbody ef = Rec f x efbody
...@@ -788,7 +788,7 @@ Tactic Notation "rel_rec_r" := ...@@ -788,7 +788,7 @@ Tactic Notation "rel_rec_r" :=
Tactic Notation "rel_seq_r" := rel_rec_r. Tactic Notation "rel_seq_r" := rel_rec_r.
Tactic Notation "rel_let_r" := rel_rec_r. Tactic Notation "rel_let_r" := rel_rec_r.
Lemma tac_rel_fst_r `{heapIG Σ, !cfgSG Σ} Δ E1 E2 Γ e K' e1 e2 v1 v2 t τ : Lemma tac_rel_fst_r `{logrelG Σ} Δ E1 E2 Γ e K' e1 e2 v1 v2 t τ :
nclose specN E1 nclose specN E1
e = fill K' (Fst (Pair e1 e2)) e = fill K' (Fst (Pair e1 e2))
to_val e1 = Some v1 to_val e1 = Some v1
...@@ -813,7 +813,7 @@ Tactic Notation "rel_fst_r" := ...@@ -813,7 +813,7 @@ Tactic Notation "rel_fst_r" :=
|solve_to_val (* to_val e2 = Some .. *) |solve_to_val (* to_val e2 = Some .. *)
|simpl (* new goal *)]. |simpl (* new goal *)].
Lemma tac_rel_snd_r `{heapIG Σ, !cfgSG Σ} Δ E1 E2 Γ e K' e1 e2 v1 v2 t τ : Lemma tac_rel_snd_r `{logrelG Σ} Δ E1 E2 Γ e K' e1 e2 v1 v2 t τ :
nclose specN E1 nclose specN E1
e = fill K' (Snd (Pair e1 e2)) e = fill K' (Snd (Pair e1 e2))
to_val e1 = Some v1 to_val e1 = Some v1
...@@ -838,7 +838,7 @@ Tactic Notation "rel_snd_r" := ...@@ -838,7 +838,7 @@ Tactic Notation "rel_snd_r" :=
|solve_to_val (* to_val e2 = Some .. *) |solve_to_val (* to_val e2 = Some .. *)
|simpl (* new goal *)]. |simpl (* new goal *)].
Lemma tac_rel_tlam_r `{heapIG Σ, !cfgSG Σ} Δ E1 E2 Γ e K' e' t τ : Lemma tac_rel_tlam_r `{logrelG Σ} Δ E1 E2 Γ e K' e' t τ :
nclose specN E1 nclose specN E1
e = fill K' (TApp (TLam e')) e = fill K' (TApp (TLam e'))
Closed e' Closed e'
...@@ -858,7 +858,7 @@ Tactic Notation "rel_tlam_r" := ...@@ -858,7 +858,7 @@ Tactic Notation "rel_tlam_r" :=
|solve_closed