Commit 246061ef by Hai Dang

### deref/ref take results

parent 2f224774
 ... @@ -474,16 +474,18 @@ Proof. ... @@ -474,16 +474,18 @@ Proof. - by exists (Ki :: K'). - by exists (Ki :: K'). Qed. Qed. Lemma tstep_ref_inv l tg T e' σ σ' Lemma tstep_ref_inv (pl: result) e' σ σ' (STEP: ((& (Place l tg T))%E, σ) ~{fns}~> (e', σ')) : (STEP: ((& pl)%E, σ) ~{fns}~> (e', σ')) : e' = #[ScPtr l tg]%E ∧ σ' = σ ∧ is_Some (σ.(shp) !! l). ∃ l tg T, pl = PlaceR l tg T ∧ e' = #[ScPtr l tg]%E ∧ σ' = σ ∧ is_Some (σ.(shp) !! l). Proof. Proof. inv_tstep. symmetry in Eq. inv_tstep. symmetry in Eq. destruct (fill_ref_decompose _ _ _ Eq) destruct (fill_ref_decompose _ _ _ Eq) as [[]|[K' [? Eq']]]; subst. as [[]|[K' [? Eq']]]; subst. - clear Eq. simpl in HS. by inv_head_step. - clear Eq. simpl in HS. inv_head_step. have Eq1 := to_of_result pl. rewrite -H /to_result in Eq1. simplify_eq. naive_solver. - apply result_head_stuck, (fill_not_result _ K') in HS. - apply result_head_stuck, (fill_not_result _ K') in HS. by rewrite Eq' in HS. by rewrite Eq' to_of_result in HS. Qed. Qed. (** Deref *) (** Deref *) ... @@ -498,17 +500,19 @@ Proof. ... @@ -498,17 +500,19 @@ Proof. - by exists (Ki :: K'). - by exists (Ki :: K'). Qed. Qed. Lemma tstep_deref_inv l tg T e' σ σ' Lemma tstep_deref_inv (rf: result) T e' σ σ' (STEP: ((Deref #[ScPtr l tg] T)%E, σ) ~{fns}~> (e', σ')) : (STEP: ((Deref rf T)%E, σ) ~{fns}~> (e', σ')) : e' = Place l tg T ∧ σ' = σ ∧ ∃ l tg, rf = (ValR [ScPtr l tg])%R ∧ e' = Place l tg T ∧ σ' = σ ∧ (∀ (i: nat), (i < tsize T)%nat → l +ₗ i ∈ dom (gset loc) σ.(shp)). (∀ (i: nat), (i < tsize T)%nat → l +ₗ i ∈ dom (gset loc) σ.(shp)). Proof. Proof. inv_tstep. symmetry in Eq. inv_tstep. symmetry in Eq. destruct (fill_deref_decompose _ _ _ _ Eq) destruct (fill_deref_decompose _ _ _ _ Eq) as [[]|[K' [? Eq']]]; subst. as [[]|[K' [? Eq']]]; subst. - clear Eq. simpl in HS. by inv_head_step. - clear Eq. simpl in HS. inv_head_step. have Eq1 := to_of_result rf. rewrite -H0 /to_result in Eq1. simplify_eq. naive_solver. - apply result_head_stuck, (fill_not_result _ K') in HS. - apply result_head_stuck, (fill_not_result _ K') in HS. by rewrite Eq' in HS. by rewrite Eq' to_of_result in HS. Qed. Qed. (** Call *) (** Call *) ... @@ -728,17 +732,21 @@ Proof. ... @@ -728,17 +732,21 @@ Proof. - subst K. by exists (Ki :: K0). - subst K. by exists (Ki :: K0). Qed. Qed. Lemma tstep_copy_inv l tg T e' σ σ' Lemma tstep_copy_inv (pl: result) e' σ σ' (STEP: (Copy (Place l tg T), σ) ~{fns}~> (e', σ')) : (STEP: (Copy pl, σ) ~{fns}~> (e', σ')) : ∃ v α', e' = Val v ∧ read_mem l (tsize T) σ.(shp) = Some v ∧ ∃ l tg T v α', pl = PlaceR l tg T ∧ e' = Val v ∧ read_mem l (tsize T) σ.(shp) = Some v ∧ memory_read σ.(sst) σ.(scs) l tg (tsize T) = Some α' ∧ memory_read σ.(sst) σ.(scs) l tg (tsize T) = Some α' ∧ σ' = mkState σ.(shp) α' σ.(scs) σ.(snp) σ.(snc). σ' = mkState σ.(shp) α' σ.(scs) σ.(snp) σ.(snc). Proof. Proof. inv_tstep. symmetry in Eq. inv_tstep. symmetry in Eq. destruct (fill_copy_decompose _ _ _ Eq) as [[]|[K' [? Eq']]]; subst. destruct (fill_copy_decompose _ _ _ Eq) as [[]|[K' [? Eq']]]; subst. - clear Eq. simpl in HS. inv_head_step. naive_solver. - clear Eq. simpl in HS. inv_head_step. have Eq1 := to_of_result pl. rewrite -H0 /to_result in Eq1. simplify_eq. naive_solver. - exfalso. apply val_head_stuck in HS. destruct (fill_val K' e1') as [? Eq1']. - exfalso. apply val_head_stuck in HS. destruct (fill_val K' e1') as [? Eq1']. + rewrite /= Eq'. by eexists. + rewrite /= Eq' to_of_result. by eexists. + by rewrite Eq1' in HS. + by rewrite Eq1' in HS. Qed. Qed. ... @@ -776,9 +784,12 @@ Proof. ... @@ -776,9 +784,12 @@ Proof. - subst K. right. by exists r1, (Ki :: K'). - subst K. right. by exists r1, (Ki :: K'). Qed. Qed. Lemma tstep_write_inv l tg T v e' σ σ' Lemma tstep_write_inv (pl r: result) e' σ σ' (STEP: ((Place l tg T <- #v)%E, σ) ~{fns}~> (e', σ')) : (STEP: ((pl <- r)%E, σ) ~{fns}~> (e', σ')) : ∃ α', e' = (#[☠]%V) ∧ ∃ l tg T v α', pl = PlaceR l tg T ∧ r = ValR v ∧ e' = (#[☠]%V) ∧ memory_written σ.(sst) σ.(scs) l tg (tsize T) = Some α' ∧ memory_written σ.(sst) σ.(scs) l tg (tsize T) = Some α' ∧ (∀ (i: nat), (i < length v)%nat → l +ₗ i ∈ dom (gset loc) σ.(shp)) ∧ (∀ (i: nat), (i < length v)%nat → l +ₗ i ∈ dom (gset loc) σ.(shp)) ∧ (v <
 ... @@ -14,8 +14,10 @@ Lemma sim_body_copy_left_1 ... @@ -14,8 +14,10 @@ Lemma sim_body_copy_left_1 Proof. Proof. intros COND. pfold. intros NT r_f WSAT. intros COND. pfold. intros NT r_f WSAT. edestruct NT as [[]|[es1 [σs1 STEP1]]]; [constructor 1|done|]. edestruct NT as [[]|[es1 [σs1 STEP1]]]; [constructor 1|done|]. destruct (tstep_copy_inv _ _ _ _ _ _ _ STEP1) as (vs & α' & ? & Eqvs & READ & ?). destruct (tstep_copy_inv _ (PlaceR l (Tagged t) int) _ _ _ STEP1) subst es1 σs1. rewrite /= read_mem_equation_1 /= in Eqvs. as (l' & t' & T' & vs & α' & EqH & ? & Eqvs & READ & ?). symmetry in EqH. simplify_eq. rewrite /= read_mem_equation_1 /= in Eqvs. destruct (σs.(shp) !! l) as [s|] eqn:Eqs; [|done]. simpl in Eqvs. simplify_eq. destruct (σs.(shp) !! l) as [s|] eqn:Eqs; [|done]. simpl in Eqvs. simplify_eq. specialize (COND _ eq_refl). specialize (COND _ eq_refl). ... ...
 ... @@ -102,13 +102,14 @@ Proof. ... @@ -102,13 +102,14 @@ Proof. move=>Hwf xs Hxswf /=. sim_bind (subst_map _ e) (subst_map _ e). move=>Hwf xs Hxswf /=. sim_bind (subst_map _ e) (subst_map _ e). eapply sim_simple_post_mono, IHe; [|by auto..]. eapply sim_simple_post_mono, IHe; [|by auto..]. intros r' n' rs css' rt cst' (-> & -> & -> & Hrel). simpl. intros r' n' rs css' rt cst' (-> & -> & -> & Hrel). simpl. Fail eapply sim_simple_deref. have ?:= (rrel_eq _ _ _ Hrel). subst rt. admit. eapply sim_simple_deref. intros. by subst. - (* Ref *) - (* Ref *) move=>Hwf xs Hxswf /=. sim_bind (subst_map _ e) (subst_map _ e). move=>Hwf xs Hxswf /=. sim_bind (subst_map _ e) (subst_map _ e). eapply sim_simple_post_mono, IHe; [|by auto..]. eapply sim_simple_post_mono, IHe; [|by auto..]. intros r' n' rs css' rt cst' (-> & -> & -> & Hrel). simpl. intros r' n' rs css' rt cst' (-> & -> & -> & Hrel). simpl. Fail eapply sim_simple_ref. have ?:= (rrel_eq _ _ _ Hrel). subst rt. eapply sim_simple_ref. intros. subst. admit. admit. - (* Copy *) admit. - (* Copy *) admit. - (* Write *) admit. - (* Write *) admit. ... ...