Commit 4aece797 authored by Robbert Krebbers's avatar Robbert Krebbers

Split monotonicity and closedness fields of uPred.

parent 762b22c1
This diff is collapsed.
......@@ -18,7 +18,7 @@ Implicit Types m : iGst Λ Σ.
Notation wptp n := (Forall3 (λ e Φ r, uPred_holds (wp e Φ) n r)).
Lemma wptp_le Φs es rs n n' :
{n'} (big_op rs) wptp n es Φs rs n' n wptp n' es Φs rs.
Proof. induction 2; constructor; eauto using uPred_weaken. Qed.
Proof. induction 2; constructor; eauto using uPred_closed. Qed.
Lemma nsteps_wptp Φs k n tσ1 tσ2 rs1 :
nsteps step k tσ1 tσ2
1 < n wptp (k + n) (tσ1.1) Φs rs1
......@@ -51,7 +51,8 @@ Proof.
{ rewrite /option_list right_id_L.
apply Forall3_app, Forall3_cons; eauto using wptp_le.
rewrite wp_eq.
apply uPred_weaken with (k + n) r2; eauto using cmra_included_l. }
apply uPred_closed with (k + n);
first apply uPred_mono with r2; eauto using cmra_included_l. }
by rewrite -Permutation_middle /= big_op_app.
Qed.
Lemma wp_adequacy_steps P Φ k n e1 t2 σ1 σ2 r1 :
......
......@@ -19,11 +19,12 @@ Next Obligation.
apply HP; auto. by rewrite (dist_le _ _ _ _ Hr); last lia.
Qed.
Next Obligation.
intros Λ Σ E1 E2 P r1 r2 n1 n2 HP [r3 ?] Hn ? rf k Ef σ ?? Hws; setoid_subst.
destruct (HP (r3rf) k Ef σ) as (r'&?&Hws'); rewrite ?(assoc op); auto.
intros Λ Σ E1 E2 P n r1 r2 HP [r3 ?] rf k Ef σ ?? Hws; setoid_subst.
destruct (HP (r3 rf) k Ef σ) as (r'&?&Hws'); rewrite ?(assoc op); auto.
exists (r' r3); rewrite -assoc; split; last done.
apply uPred_weaken with k r'; eauto using cmra_included_l.
apply uPred_mono with r'; eauto using cmra_included_l.
Qed.
Next Obligation. naive_solver. Qed.
Definition pvs_aux : { x | x = @pvs_def }. by eexists. Qed.
Definition pvs := proj1_sig pvs_aux.
......@@ -62,7 +63,7 @@ Proof. apply ne_proper, _. Qed.
Lemma pvs_intro E P : P |={E}=> P.
Proof.
rewrite pvs_eq. split=> n r ? HP rf k Ef σ ???; exists r; split; last done.
apply uPred_weaken with n r; eauto.
apply uPred_closed with n; eauto.
Qed.
Lemma pvs_mono E1 E2 P Q : P Q (|={E1,E2}=> P) (|={E1,E2}=> Q).
Proof.
......@@ -75,7 +76,7 @@ Proof.
rewrite pvs_eq uPred.timelessP_spec=> HP.
uPred.unseal; split=>-[|n] r ? HP' rf k Ef σ ???; first lia.
exists r; split; last done.
apply HP, uPred_weaken with n r; eauto using cmra_validN_le.
apply HP, uPred_closed with n; eauto using cmra_validN_le.
Qed.
Lemma pvs_trans E1 E2 E3 P :
E2 E1 E3 (|={E1,E2}=> |={E2,E3}=> P) (|={E1,E3}=> P).
......@@ -96,7 +97,7 @@ Proof.
destruct (HP (r2 rf) k Ef σ) as (r'&?&?); eauto.
{ by rewrite assoc -(dist_le _ _ _ _ Hr); last lia. }
exists (r' r2); split; last by rewrite -assoc.
exists r', r2; split_and?; auto; apply uPred_weaken with n r2; auto.
exists r', r2; split_and?; auto. apply uPred_closed with n; auto.
Qed.
Lemma pvs_openI i P : ownI i P (|={{[i]},}=> P).
Proof.
......@@ -105,17 +106,17 @@ Proof.
destruct (wsat_open k Ef σ (r rf) i P) as (rP&?&?); auto.
{ rewrite lookup_wld_op_l ?Hinv; eauto; apply dist_le with (S n); eauto. }
exists (rP r); split; last by rewrite (left_id_L _ _) -assoc.
eapply uPred_weaken with (S k) rP; eauto using cmra_included_l.
eapply uPred_mono with rP; eauto using cmra_included_l.
Qed.
Lemma pvs_closeI i P : (ownI i P P) (|={,{[i]}}=> True).
Proof.
rewrite pvs_eq. uPred.unseal; split=> -[|n] r ? [? HP] rf [|k] Ef σ ? HE ?; try lia.
exists ; split; [done|].
rewrite left_id; apply wsat_close with P r.
- apply ownI_spec, uPred_weaken with (S n) r; auto.
- apply ownI_spec, uPred_closed with (S n); auto.
- set_solver +HE.
- by rewrite -(left_id_L () Ef).
- apply uPred_weaken with n r; auto.
- apply uPred_closed with n; auto.
Qed.
Lemma pvs_ownG_updateP E m (P : iGst Λ Σ Prop) :
m ~~>: P ownG m (|={E}=> m', P m' ownG m').
......@@ -131,7 +132,7 @@ Proof.
rewrite pvs_eq. intros ?; rewrite /ownI; uPred.unseal.
split=> -[|n] r ? HP rf [|k] Ef σ ???; try lia.
destruct (wsat_alloc k E Ef σ rf P r) as (i&?&?&?); auto.
{ apply uPred_weaken with n r; eauto. }
{ apply uPred_closed with n; eauto. }
exists (Res {[ i := to_agree (Next (iProp_unfold P)) ]} ).
split; [|done]. by exists i; split; rewrite /uPred_holds /=.
Qed.
......
......@@ -38,17 +38,19 @@ Next Obligation.
intros rf k Ef σ1 ?; rewrite -(dist_le _ _ _ _ Hr); naive_solver.
Qed.
Next Obligation.
intros Λ Σ E e Φ n1 n2 r1 r2; revert Φ E e n2 r1 r2.
induction n1 as [n1 IH] using lt_wf_ind; intros Φ E e n2 r1 r1'.
destruct 1 as [|n1 r1 e1 ? Hgo].
- constructor; eauto using uPred_weaken.
- intros [rf' Hr] ??; constructor; [done|intros rf k Ef σ1 ???].
intros Λ Σ E e Φ n r1 r2; revert Φ E e r1 r2.
induction n as [n IH] using lt_wf_ind; intros Φ E e r1 r1'.
destruct 1 as [|n r1 e1 ? Hgo].
- constructor; eauto using uPred_mono.
- intros [rf' Hr]; constructor; [done|intros rf k Ef σ1 ???].
destruct (Hgo (rf' rf) k Ef σ1) as [Hsafe Hstep];
rewrite ?assoc -?Hr; auto; constructor; [done|].
intros e2 σ2 ef ?; destruct (Hstep e2 σ2 ef) as (r2&r2'&?&?&?); auto.
exists r2, (r2' rf'); split_and?; eauto 10 using (IH k), cmra_included_l.
by rewrite -!assoc (assoc _ r2).
Qed.
Next Obligation. destruct 1; constructor; eauto using uPred_closed. Qed.
(* Perform sealing. *)
Definition wp_aux : { x | x = @wp_def }. by eexists. Qed.
Definition wp := proj1_sig wp_aux.
......@@ -194,7 +196,7 @@ Proof.
destruct (Hstep e2 σ2 ef) as (r2&r2'&?&?&?); auto.
exists (r2 rR), r2'; split_and?; auto.
- by rewrite -(assoc _ r2) (comm _ rR) !assoc -(assoc _ _ rR).
- apply IH; eauto using uPred_weaken.
- apply IH; eauto using uPred_closed.
Qed.
Lemma wp_frame_step_r E E1 E2 e Φ R :
to_val e = None E E1 E2 E1
......
......@@ -36,18 +36,19 @@ Next Obligation.
by rewrite (dist_le _ _ _ _ Hr1); last omega.
Qed.
Next Obligation.
intros wp E e1 Φ n1 n2 r1 ? Hwp [r2 ?] ?? rf k Ef σ1 ???; setoid_subst.
intros wp E e1 Φ n r1 ? Hwp [r2 ?] rf k Ef σ1 ???; setoid_subst.
destruct (Hwp (r2 rf) k Ef σ1) as [Hval Hstep]; rewrite ?assoc; auto.
split.
- intros v Hv. destruct (Hval v Hv) as [r3 [??]].
exists (r3 r2). rewrite -assoc. eauto using uPred_weaken, cmra_included_l.
exists (r3 r2). rewrite -assoc. eauto using uPred_mono, cmra_included_l.
- intros ??. destruct Hstep as [Hred Hpstep]; auto.
split; [done|]=> e2 σ2 ef ?.
edestruct Hpstep as (r3&r3'&?&?&?); eauto.
exists r3, (r3' r2); split_and?; auto.
+ by rewrite assoc -assoc.
+ destruct ef; simpl in *; eauto using uPred_weaken, cmra_included_l.
+ destruct ef; simpl in *; eauto using uPred_mono, cmra_included_l.
Qed.
Next Obligation. repeat intro; eauto. Qed.
Lemma wp_pre_contractive' n E e Φ1 Φ2 r
(wp1 wp2 : coPsetC -n> exprC Λ -n> (valC Λ -n> iProp) -n> iProp) :
......
......@@ -63,7 +63,7 @@ Proof.
destruct (Hwld i (iProp_fold (later_car (P' (S n))))) as (r'&?&?); auto.
{ by rewrite HP' -HPiso. }
assert ({S n} r') by (apply (big_opM_lookup_valid _ rs i); auto).
exists r'; split; [done|apply HPP', uPred_weaken with n r'; auto].
exists r'; split; [done|]. apply HPP', uPred_closed with n; auto.
Qed.
Lemma wsat_valid n E σ r : n 0 wsat n E σ r {n} r.
Proof.
......
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