Skip to content
Snippets Groups Projects
Commit a16a3137 authored by Jacques-Henri Jourdan's avatar Jacques-Henri Jourdan
Browse files

Remove Closed assumptions by using the type context.

parent d1b86f64
No related branches found
No related tags found
No related merge requests found
...@@ -108,9 +108,7 @@ Section typing. ...@@ -108,9 +108,7 @@ Section typing.
( x, Forall2 (subtype (E0 ++ E x) L0) (tys2 x) (tys1 x)) ( x, Forall2 (subtype (E0 ++ E x) L0) (tys2 x) (tys1 x))
( x, subtype (E0 ++ E x) L0 (ty1 x) (ty2 x)) ( x, subtype (E0 ++ E x) L0 (ty1 x) (ty2 x))
subtype E0 L0 (fn E tys1 ty1) (fn E tys2 ty2). subtype E0 L0 (fn E tys1 ty1) (fn E tys2 ty2).
Proof. Proof. intros. by apply fn_subtype_full. Qed.
intros. apply fn_subtype_full; try done.
Qed.
(* This proper and the next can probably not be inferred, but oh well. *) (* This proper and the next can probably not be inferred, but oh well. *)
Global Instance fn_subtype_ty' {A n} E0 L0 E : Global Instance fn_subtype_ty' {A n} E0 L0 E :
......
...@@ -153,15 +153,15 @@ Section case. ...@@ -153,15 +153,15 @@ Section case.
Qed. Qed.
Lemma type_sum_assign {E L} (i : nat) tyl ty1 ty2 ty p1 p2 : Lemma type_sum_assign {E L} (i : nat) tyl ty1 ty2 ty p1 p2 :
Closed [] p1 Closed [] p2
tyl !! i = Some ty tyl !! i = Some ty
typed_write E L ty1 (sum tyl) ty2 typed_write E L ty1 (sum tyl) ty2
typed_instruction E L [p1 ty1; p2 ty] (p1 <-{i} p2) (λ _, [p1 ty2]%TC). typed_instruction E L [p1 ty1; p2 ty] (p1 <-{i} p2) (λ _, [p1 ty2]%TC).
Proof. Proof.
iIntros (?? Hty Hw ??) "#HEAP #LFT $ HE HL Hp". iIntros (Hty Hw ??) "#HEAP #LFT $ HE HL Hp".
rewrite tctx_interp_cons tctx_interp_singleton. rewrite tctx_interp_cons tctx_interp_singleton.
iDestruct "Hp" as "[Hp1 Hp2]". wp_bind p1. iApply (wp_hasty with "Hp1"). iDestruct "Hp" as "[Hp1 Hp2]". iDestruct (closed_hasty with "Hp1") as "%".
iIntros (v1 Hv1) "Hty1". iDestruct (closed_hasty with "Hp2") as "%". wp_bind p1.
iApply (wp_hasty with "Hp1"). iIntros (v1 Hv1) "Hty1".
iMod (Hw with "LFT HE HL Hty1") as (l vl) "(H & H↦ & Hw)"=>//=. iMod (Hw with "LFT HE HL Hty1") as (l vl) "(H & H↦ & Hw)"=>//=.
destruct vl as [|? vl]; iDestruct "H" as %[[= Hlen] ->]. destruct vl as [|? vl]; iDestruct "H" as %[[= Hlen] ->].
rewrite heap_mapsto_vec_cons. iDestruct "H↦" as "[H↦0 H↦vl]". rewrite heap_mapsto_vec_cons. iDestruct "H↦" as "[H↦0 H↦vl]".
...@@ -195,17 +195,17 @@ Section case. ...@@ -195,17 +195,17 @@ Section case.
Qed. Qed.
Lemma type_sum_memcpy {E L} (i : nat) tyl ty1 ty1' ty2 ty2' ty p1 p2 : Lemma type_sum_memcpy {E L} (i : nat) tyl ty1 ty1' ty2 ty2' ty p1 p2 :
Closed [] p1 Closed [] p2
tyl !! i = Some ty tyl !! i = Some ty
typed_write E L ty1 (sum tyl) ty1' typed_write E L ty1 (sum tyl) ty1'
typed_read E L ty2 ty ty2' typed_read E L ty2 ty ty2'
typed_instruction E L [p1 ty1; p2 ty2] typed_instruction E L [p1 ty1; p2 ty2]
(p1 <⋯{i} !{ty.(ty_size)}p2) (λ _, [p1 ty1'; p2 ty2']%TC). (p1 <⋯{i} !{ty.(ty_size)}p2) (λ _, [p1 ty1'; p2 ty2']%TC).
Proof. Proof.
iIntros (?? Hty Hw Hr ??) "#HEAP #LFT Htl [HE1 HE2] [HL1 HL2] Hp". iIntros (Hty Hw Hr ??) "#HEAP #LFT Htl [HE1 HE2] [HL1 HL2] Hp".
rewrite tctx_interp_cons tctx_interp_singleton. rewrite tctx_interp_cons tctx_interp_singleton.
iDestruct "Hp" as "[Hp1 Hp2]". wp_bind p1. iApply (wp_hasty with "Hp1"). iDestruct "Hp" as "[Hp1 Hp2]". iDestruct (closed_hasty with "Hp1") as "%".
iIntros (v1 Hv1) "Hty1". iDestruct (closed_hasty with "Hp2") as "%". wp_bind p1.
iApply (wp_hasty with "Hp1"). iIntros (v1 Hv1) "Hty1".
iMod (Hw with "LFT HE1 HL1 Hty1") as (l1 vl1) "(H & H↦ & Hw)"=>//=. iMod (Hw with "LFT HE1 HL1 Hty1") as (l1 vl1) "(H & H↦ & Hw)"=>//=.
destruct vl1 as [|? vl1]; iDestruct "H" as %[[= Hlen] ->]. destruct vl1 as [|? vl1]; iDestruct "H" as %[[= Hlen] ->].
rewrite heap_mapsto_vec_cons. iDestruct "H↦" as "[H↦0 H↦vl1]". wp_write. rewrite heap_mapsto_vec_cons. iDestruct "H↦" as "[H↦0 H↦vl1]". wp_write.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment