Commit f7fa492f authored by Léon Gondelman's avatar Léon Gondelman

factor out the postcondtion in vcg_wp lemmas

parent 3c9f273a
......@@ -9,18 +9,12 @@ Section tests_vcg.
Context `{amonadG Σ}.
Lemma test0 (l1 l2 : loc) (e: expr) `{Closed [] e}:
l1 C #1 - l2 C #1 - awp e True (λ _, True) - awp (alloc 1; e ; ∗ᶜ l1) True (λ v, l1 C #1 l2 C #1).
(* Lemma test0 (l1 l2 : loc) (e: expr) `{Closed [] e}:
l1 ↦C #1 -∗ l2 ↦C #1 -∗ awp e True (λ _, True) -∗
awp (allocᶜ ♯1;ᶜ e ;ᶜ ∗ᶜ ♯l1) True (λ v, l1 ↦C #1 ∗ l2 ↦C #1).
Proof.
iIntros "Hl1 Hl2 Hawp". vcg_solver.
iIntros "Hl2 Hl1". iApply a_alloc_spec. awp_ret_value.
iIntros (k) "Hk".
vcg_continue.
iModIntro.
iIntros "Hl2 Hl1 Hk".
Abort.
iIntros "Hl2 Hl1". Abort. *)
Lemma test1 (l k : loc) (e: expr) `{Closed [] e}:
( Φ v, k C v - (k C #12 - Φ v) - awp e True Φ) -
......@@ -39,14 +33,12 @@ Section tests_vcg.
vcg_continue. eauto.
Qed.
Lemma test3 (k : loc) :
Lemma test2 (k : loc) :
k C #10 - awp (alloc 11 = ∗ᶜ♯k + 2) True (λ v, True).
Proof.
iIntros "Hk". vcg_solver.
iIntros "Hk".
iApply a_alloc_spec. iApply awp_ret. iApply wp_value.
iIntros (l) "Hl".
vcg_continue.
iIntros "Hk". iApply a_alloc_spec. awp_ret_value.
iIntros (l) "Hl". vcg_continue.
eauto 42 with iFrame.
Qed.
......
......@@ -28,22 +28,15 @@ Section vcg_continue.
FromKnownLocs (PenvItem l x q v :: Γls) E_old (l :: E_new) | 100.
Proof. done. Qed.
Lemma tac_exists_known_locs Γs_in Γs_out Γls Γp c ps v E_old E_new (Φ: known_locs denv dval iProp Σ):
MapstoListFromEnv Γs_in Γs_out Γls
FromKnownLocs Γls E_old E_new
ListOfMapsto Γls (E_old ++ E_new) ps
envs_entails (Envs Γp Γs_out c)
(denv_wf (E_old ++ E_new) ps Φ (E_old ++ E_new) ps (dValUnknown v))
envs_entails (Envs Γp Γs_in c)
( (E': known_locs) (m': denv) (dv: dval),
v = dval_interp E' dv E_old `prefix_of` E'
(denv_wf E' m')
dval_wf E' dv
denv_interp E' m'
Φ E' m' dv)%I.
envs_entails (Envs Γp Γs_in c) (vcg_wp_postcondition E_old Φ v).
Proof.
unfold vcg_wp_postcondition.
intros Hsplit. rewrite /ListOfMapsto environments.envs_entails_eq=> Hexhale.
unfold of_envs. simpl. intros HGls Hgoal.
rewrite mapsto_list_from_env.
......@@ -57,17 +50,17 @@ Section vcg_continue.
* by left.
* right. by apply Hsplit.
}
iExists (E_old++E_new), ps, (dValUnknown v). repeat iSplit; eauto using prefix_app_r.
iExists (E_old++E_new), (dValUnknown v), ps. repeat iSplit; eauto using prefix_app_r.
iFrame. by iApply HGls.
Qed.
End vcg_continue.
(* TODO: How to avoid computing mapsto_wand and dloc under vcg_wp_unknown ? *)
(* Arguments dloc_interp : simpl never. *)
(* Arguments vcg_wp_unknown : simpl never. *)
Declare Reduction vcg_cbv :=
cbv [ vcg_wp vcg_wp_bin_op vcg_wp_store vcg_wp_load vcg_wp_unknown mapsto_wand_list].
cbv [ vcg_wp vcg_wp_bin_op vcg_wp_store vcg_wp_load mapsto_wand_list].
Ltac vcg_compute :=
match goal with
......
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