Skip to content
Snippets Groups Projects
Commit 730a9f4a authored by David Swasey's avatar David Swasey
Browse files

Ownership is timeless.

parent 9ba9ef1b
No related branches found
No related tags found
No related merge requests found
...@@ -180,6 +180,32 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG). ...@@ -180,6 +180,32 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG).
End Invariants. End Invariants.
Section Timeless.
Definition timelessP P w n :=
forall w' k r (HSw : w w') (HLt : k < n) (Hp : P w' k r), P w' (S k) r.
Program Definition timeless P : Props :=
m[(fun w => mkUPred (fun n r => timelessP P w n) _)].
Next Obligation.
intros n1 n2 _ _ HLe _ HT w' k r HSw HLt Hp; eapply HT, Hp; [eassumption |].
omega.
Qed.
Next Obligation.
intros w1 w2 EQw k; simpl; intros _ HLt; destruct n as [| n]; [now inversion HLt |].
split; intros HT w' m r HSw HLt' Hp.
- symmetry in EQw; assert (HD := extend_dist _ _ _ _ EQw HSw); assert (HS := extend_sub _ _ _ _ EQw HSw).
apply (met_morph_nonexp _ _ P) in HD; apply HD, HT, HD, Hp; now (assumption || eauto with arith).
- assert (HD := extend_dist _ _ _ _ EQw HSw); assert (HS := extend_sub _ _ _ _ EQw HSw).
apply (met_morph_nonexp _ _ P) in HD; apply HD, HT, HD, Hp; now (assumption || eauto with arith).
Qed.
Next Obligation.
intros w1 w2 HSw n; simpl; intros _ HT w' m r HSw' HLt Hp.
eapply HT, Hp; [etransitivity |]; eassumption.
Qed.
End Timeless.
Section Ownership. Section Ownership.
(** Ownership **) (** Ownership **)
...@@ -196,13 +222,17 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG). ...@@ -196,13 +222,17 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG).
intros u1 u2 Hequ. intros w n r. split; intros [t Heqt]; exists t; [rewrite <-Hequ|rewrite Hequ]; assumption. intros u1 u2 Hequ. intros w n r. split; intros [t Heqt]; exists t; [rewrite <-Hequ|rewrite Hequ]; assumption.
Qed. Qed.
Lemma ownR_sc u t: Lemma ownR_timeless {u} :
ownR (u · t) == ownR u * ownR t. valid(timeless(ownR u)).
Proof. intros w n _ w' k r _ _; now auto. Qed.
Lemma ownR_sc u v:
ownR (u · v) == ownR u * ownR v.
Proof. Proof.
intros w n r; split; [intros Hut | intros [r1 [r2 [EQr [Hu Ht] ] ] ] ]. intros w n r; split; [intros Hut | intros [r1 [r2 [EQr [Hu Ht] ] ] ] ].
- destruct Hut as [s Heq]. rewrite-> assoc in Heq. - destruct Hut as [s Heq]. rewrite-> assoc in Heq.
exists (s · u) by auto_valid. exists (s · u) by auto_valid.
exists t by auto_valid. exists v by auto_valid.
split; [|split]. split; [|split].
+ rewrite <-Heq. reflexivity. + rewrite <-Heq. reflexivity.
+ exists s. reflexivity. + exists s. reflexivity.
...@@ -228,6 +258,9 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG). ...@@ -228,6 +258,9 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG).
rewrite EQr. reflexivity. rewrite EQr. reflexivity.
Qed. Qed.
Lemma ownS_timeless {σ} : valid(timeless(ownS σ)).
Proof. exact ownR_timeless. Qed.
(** Proper ghost state: ownership of logical **) (** Proper ghost state: ownership of logical **)
Program Definition ownL : RL.res -n> Props := Program Definition ownL : RL.res -n> Props :=
n[(fun r : RL.res => ownR (1, r))]. n[(fun r : RL.res => ownR (1, r))].
...@@ -236,6 +269,9 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG). ...@@ -236,6 +269,9 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG).
simpl in EQr. intros w m t. simpl. change ( (ex_unit state, r1) (ra_proj t) <-> (ex_unit state, r2) (ra_proj t)). rewrite EQr. reflexivity. simpl in EQr. intros w m t. simpl. change ( (ex_unit state, r1) (ra_proj t) <-> (ex_unit state, r2) (ra_proj t)). rewrite EQr. reflexivity.
Qed. Qed.
Lemma ownL_timeless {r : RL.res} : valid(timeless(ownL r)).
Proof. exact ownR_timeless. Qed.
(** Ghost state ownership **) (** Ghost state ownership **)
Lemma ownL_sc (r s : RL.res) : Lemma ownL_sc (r s : RL.res) :
ownL (r · s) == ownL r * ownL s. ownL (r · s) == ownL r * ownL s.
...@@ -249,30 +285,6 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG). ...@@ -249,30 +285,6 @@ Module IrisCore (RL : RA_T) (C : CORE_LANG).
End Ownership. End Ownership.
(** Timeless *)
Definition timelessP P w n :=
forall w' k r (HSw : w w') (HLt : k < n) (Hp : P w' k r), P w' (S k) r.
Program Definition timeless P : Props :=
m[(fun w => mkUPred (fun n r => timelessP P w n) _)].
Next Obligation.
intros n1 n2 _ _ HLe _ HT w' k r HSw HLt Hp; eapply HT, Hp; [eassumption |].
omega.
Qed.
Next Obligation.
intros w1 w2 EQw k; simpl; intros _ HLt; destruct n as [| n]; [now inversion HLt |].
split; intros HT w' m r HSw HLt' Hp.
- symmetry in EQw; assert (HD := extend_dist _ _ _ _ EQw HSw); assert (HS := extend_sub _ _ _ _ EQw HSw).
apply (met_morph_nonexp _ _ P) in HD; apply HD, HT, HD, Hp; now (assumption || eauto with arith).
- assert (HD := extend_dist _ _ _ _ EQw HSw); assert (HS := extend_sub _ _ _ _ EQw HSw).
apply (met_morph_nonexp _ _ P) in HD; apply HD, HT, HD, Hp; now (assumption || eauto with arith).
Qed.
Next Obligation.
intros w1 w2 HSw n; simpl; intros _ HT w' m r HSw' HLt Hp.
eapply HT, Hp; [etransitivity |]; eassumption.
Qed.
Section WorldSatisfaction. Section WorldSatisfaction.
(* First, we need to compose the resources of a finite map. This won't be pretty, for (* First, we need to compose the resources of a finite map. This won't be pretty, for
......
...@@ -11,11 +11,6 @@ Module Unsafety (RL : RA_T) (C : CORE_LANG). ...@@ -11,11 +11,6 @@ Module Unsafety (RL : RA_T) (C : CORE_LANG).
Local Open Scope bi_scope. Local Open Scope bi_scope.
Local Open Scope iris_scope. Local Open Scope iris_scope.
(* PDS: Move to iris_core.v *)
Lemma ownL_timeless {r : RL.res} :
valid(timeless(ownL r)).
Proof. intros w n _ w' k r' HSW HLE. auto. Qed.
(* PDS: Hoist, somewhere. *) (* PDS: Hoist, somewhere. *)
Program Definition restrictV (Q : expr -n> Props) : vPred := Program Definition restrictV (Q : expr -n> Props) : vPred :=
n[(fun v => Q (` v))]. n[(fun v => Q (` v))].
......
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