Commit 189d129e authored by Dan Frumin's avatar Dan Frumin

Add pre_bin_op to the vcgen

parent 4827236a
......@@ -204,6 +204,7 @@ Inductive dcexpr : Type :=
| dCLoad : dcexpr dcexpr
| dCStore : dcexpr dcexpr dcexpr
| dCBinOp : bin_op dcexpr dcexpr dcexpr
| dCPreBinOp : bin_op dcexpr dcexpr dcexpr
| dCUnOp : un_op dcexpr dcexpr
| dCSeq : dcexpr dcexpr dcexpr
| dCPar : dcexpr dcexpr dcexpr
......@@ -216,6 +217,7 @@ Fixpoint dcexpr_interp (E: known_locs) (de: dcexpr) : expr :=
| dCLoad de1 => a_load (dcexpr_interp E de1)
| dCStore de1 de2 => a_store (dcexpr_interp E de1) (dcexpr_interp E de2)
| dCBinOp op de1 de2 => a_bin_op op (dcexpr_interp E de1) (dcexpr_interp E de2)
| dCPreBinOp op de1 de2 => a_pre_bin_op op (dcexpr_interp E de1) (dcexpr_interp E de2)
| dCUnOp op de => a_un_op op (dcexpr_interp E de)
| dCSeq de1 de2 => dcexpr_interp E de1 ; dcexpr_interp E de2
| dCPar de1 de2 => dcexpr_interp E de1 ||| dcexpr_interp E de2
......@@ -235,7 +237,7 @@ Fixpoint dcexpr_wf (E: known_locs) (de: dcexpr) : bool :=
match de with
| dCRet dv => dval_wf E dv
| dCAlloc de1 | dCLoad de1 | dCUnOp _ de1 => dcexpr_wf E de1
| dCStore de1 de2 | dCBinOp _ de1 de2 | dCSeq de1 de2 | dCPar de1 de2 =>
| dCStore de1 de2 | dCBinOp _ de1 de2 | dCPreBinOp _ de1 de2 | dCSeq de1 de2 | dCPar de1 de2 =>
dcexpr_wf E de1 && dcexpr_wf E de2
| dCUnknown _ => true
end.
......@@ -260,7 +262,7 @@ Qed.
Lemma dcexpr_wf_mono (E E': known_locs) (de: dcexpr) :
dcexpr_wf E de E `prefix_of` E' dcexpr_wf E' de.
Proof.
induction de; simplify_eq /=; try eauto; [ apply dval_wf_mono | | | |];
induction de; simplify_eq /=; try eauto; [ apply dval_wf_mono | | | | |];
naive_solver.
Qed.
......@@ -413,6 +415,12 @@ Global Instance into_dcexpr_binop E e1 e2 op de1 de2:
IntoDCexpr E (a_bin_op op e1 e2) (dCBinOp op de1 de2).
Proof. intros [-> ?] [-> ?]; split; simpl; auto. Qed.
Global Instance into_dcexpr_prebinop E e1 e2 op de1 de2:
IntoDCexpr E e1 de1
IntoDCexpr E e2 de2
IntoDCexpr E (a_pre_bin_op op e1 e2) (dCPreBinOp op de1 de2).
Proof. intros [-> ?] [-> ?]; split; simpl; auto. Qed.
Global Instance into_dcexpr_unop E e op de:
IntoDCexpr E e de
IntoDCexpr E (a_un_op op e) (dCUnOp op de).
......
......@@ -682,7 +682,7 @@ Section denv_spec.
Proof. Admitted.
Lemma denv_wf_delete_full E dv i m m':
denv_wf E m denv_delete_full i m = Some (m', dv) denv_wf E m'.
denv_wf E m denv_delete_full i m = Some (m', dv) denv_wf E m' dval_wf E dv.
Proof.
rewrite /denv_delete_full.
destruct (denv_delete_full_aux i m) as [[[m0 q0] dv0]|] eqn:Hdel; last naive_solver.
......
......@@ -62,4 +62,19 @@ Section test.
(*TODO: test function call with multiple arguments *)
Lemma test6 (l : loc) (z0 : Z) R:
l C #z0 -
AWP l += 1 @ R {{ v, v = #z0 l C[LLvl] #(z0+1) }}.
Proof.
iIntros "Hl". vcg_solver. eauto.
Qed.
Lemma test7 (l k : loc) (z0 z1 : Z) R:
l C #z0 -
k C #z1 -
AWP (l += 1) + (∗ᶜ♯k) @ R {{ v, v = #(z0+z1) l C[LLvl] #(z0+1) k C #z1 }}.
Proof.
iIntros "Hl Hk". vcg_solver. eauto with iFrame.
Qed.
End test.
......@@ -79,7 +79,7 @@ End vcg_continue.
Arguments vcg_wp_continuation {_ _ _ _}.
Declare Reduction vcg_cbv :=
cbv [ vcg_wp vcg_wp_bin_op vcg_wp_store vcg_wp_load vcg_wp_awp_continuation mapsto_wand_list].
cbv [ vcg_wp vcg_wp_bin_op vcg_wp_pre_bin_op vcg_wp_store vcg_wp_load vcg_wp_awp_continuation 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