Commit 186f3def authored by Hai Dang's avatar Hai Dang

WIP: retag FnEntry

parent 237f63fc
......@@ -12,7 +12,7 @@ Definition ex2_down : function :=
let: "x" := new_place (& int) "i" in
retag_place "x" (RefPtr Immutable) int FnEntry ;;
let: "v" := Copy *{int} "x" in
Call #[ScFnPtr "f"] ["x"] ;;
Call #[ScFnPtr "f"] [Copy "x"] ;;
Free "x" ;; Free "i" ;;
"v"
.
......@@ -21,7 +21,7 @@ Definition ex2_down_opt : function :=
fun: ["i"],
let: "x" := new_place (& int) "i" in
retag_place "x" (RefPtr Immutable) int FnEntry ;;
Call #[ScFnPtr "f"] ["x"] ;;
Call #[ScFnPtr "f"] [Copy "x"] ;;
let: "v" := Copy *{int} "x" in
Free "x" ;; Free "i" ;;
"v"
......
......@@ -598,3 +598,25 @@ Proof.
+ rewrite res_tag_lookup_ne // right_id //.
- rewrite /= right_id //.
Qed.
(* res_cs update *)
Lemma res_cs_local_update r c Ts Ts'
(EqN: r.(rcm) !! c = None) :
(r res_cs c Ts, res_cs c Ts) ~l~> (r res_cs c Ts', res_cs c Ts').
Proof.
apply prod_local_update_2.
rewrite /= /to_cmUR 2!fmap_insert fmap_empty 2!insert_empty.
do 2 rewrite (cmra_comm (r).(rcm)) -insert_singleton_op //.
rewrite -(insert_insert r.(rcm) c (Excl Ts') (Excl Ts)).
eapply (singleton_local_update (<[c := _]> (r.(rcm)) : cmapUR)).
- by rewrite lookup_insert.
- by apply exclusive_local_update.
Qed.
Lemma res_cs_lookup (c: call_id) (Ts: tag_locs) :
(res_cs c Ts).(rcm) !! c = Some (Excl Ts).
Proof. by rewrite /= /to_cmUR fmap_insert lookup_insert. Qed.
Lemma res_cs_lookup_ne (c c': call_id) (Ts: tag_locs) (NEQ: c' c) :
(res_cs c Ts).(rcm) !! c' = None.
Proof. by rewrite /= /to_cmUR fmap_insert lookup_insert_ne. Qed.
......@@ -161,8 +161,8 @@ Proof.
f_equal. by apply (arel_eq _ _ _ Eq1). by apply IH.
Qed.
Lemma arel_mono (r1 r2 : resUR) (VAL: r2) :
r1 r2 s1 s2, arel r1 s1 s2 arel r2 s1 s2.
Lemma arel_mono_l (r1 r2 : resUR) (VAL: r2) :
r1.(rtm) r2.(rtm) s1 s2, arel r1 s1 s2 arel r2 s1 s2.
Proof.
intros Le s1 s2. rewrite /arel.
destruct s1 as [| |l1 t1|], s2 as [| |l2 t2|]; auto.
......@@ -170,7 +170,7 @@ Proof.
destruct t2 as [t2|]; [|done].
destruct PV as [h HL].
have HL1: Some (to_tgkR tkPub, h) r2.(rtm) !! t2.
{ rewrite -HL. by apply lookup_included, prod_included. }
{ rewrite -HL. by apply lookup_included. }
apply option_included in HL1 as [?|[th1 [[tk2 h2] [? [Eq1 INCL]]]]]; [done|].
simplify_eq. exists h2. rewrite Eq1 (_: tk2 to_tgkR tkPub) //.
apply tagKindR_incl_eq; [done|].
......@@ -189,6 +189,12 @@ Proof.
do 2 (split; [done|]). apply csum_included. naive_solver.
Qed.
Lemma arel_mono (r1 r2 : resUR) (VAL: r2) :
r1 r2 s1 s2, arel r1 s1 s2 arel r2 s1 s2.
Proof.
intros Le. apply arel_mono_l; by [apply VAL|apply prod_included].
Qed.
Lemma vrel_mono (r1 r2 : resUR) (VAL: r2) :
r1 r2 v1 v2, vrel r1 v1 v2 vrel r2 v1 v2.
Proof. intros Le v1 v2 VREL. by apply (Forall2_impl _ _ _ _ VREL), arel_mono. Qed.
......
This diff is collapsed.
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