Commit 6e625cb3 authored by Robbert Krebbers's avatar Robbert Krebbers

Less awkward syntax for call.

parent 816dd71e
......@@ -84,7 +84,7 @@ Definition a_load : val := λ: "x",
end
).
Notation "∗ᶜ e" :=
(a_load e)%E (at level 9, right associativity) : expr_scope.
(a_load e)%E (at level 20, right associativity) : expr_scope.
Notation "'skipᶜ'" := (a_ret #()).
......@@ -137,10 +137,10 @@ Notation "'whileVᶜ' ( cnd ) { e }" := (a_while (LamV <> cnd) (LamV <> e))
Definition a_call: val := λ: "f" "arg",
"a" ←ᶜ "arg" ; a_atomic (λ: <>, "f" "a").
Notation "'callᶜ' ( f , a )" :=
Notation "'callᶜ' f a" :=
(a_call f a)%E
(at level 10, f, a at level 99,
format "'callᶜ' ( f , a )") : expr_scope.
(at level 10, f, a at level 9,
format "'callᶜ' f a") : expr_scope.
Definition a_un_op (op : un_op) : val := λ: "x",
"v" ←ᶜ "x" ;; a_ret (UnOp op "v").
......@@ -509,7 +509,7 @@ Section proofs.
Lemma a_call_spec R Ψ Φ (f : val) ea :
AWP ea @ R {{ Ψ }} -
( a, Ψ a - U (R - AWP f a {{ v, R Φ v }})) -
AWP call (f, ea) @ R {{ Φ }}.
AWP call f ea @ R {{ Φ }}.
Proof.
iIntros "Ha Hfa".
awp_apply (a_wp_awp R with "Ha"); iIntros (va) "Ha". awp_lam. awp_pures.
......
......@@ -8,7 +8,7 @@ Definition factorial : val := λ: "n",
"r" mut 1;
"c" mut 0;
while (∗ᶜ (a_ret "c") < a_ret "n") {
call (incr, a_ret "c");
call incr (a_ret "c");
a_ret "r" = ∗ᶜ (a_ret "r") * ∗ᶜ (a_ret "c")
};
∗ᶜ(a_ret "r").
......
......@@ -8,7 +8,7 @@ Section tests_vcg.
Lemma test_invoke_1 (l: cloc) R :
l C #42 -
AWP call (c_id, ∗ᶜ ♯ₗl) @ R {{ v, v = #42 l C #42 }}%I.
AWP call c_id (∗ᶜ ♯ₗl) @ R {{ v, v = #42 l C #42 }}%I.
Proof.
iIntros "Hl". vcg. iIntros "Hl !> $".
awp_lam. vcg. iIntros "Hl". vcg_continue. eauto.
......@@ -20,14 +20,14 @@ Section tests_vcg.
(a_ret "v1") + (a_ret "v2").
Lemma test_invoke_2 R :
AWP call (plus_pair, 21 ||| 21) @ R {{ v, v = #42 }}%I.
AWP call plus_pair (21 ||| 21) @ R {{ v, v = #42 }}%I.
Proof.
iIntros. vcg. iIntros "!> $". awp_lam. vcg. by vcg_continue.
Qed.
Lemma test_invoke_3 (l : cloc) R :
l C #21 -
AWP call (plus_pair, (∗ᶜ ♯ₗl ||| ∗ᶜ ♯ₗl)) @ R
AWP call plus_pair (∗ᶜ ♯ₗl ||| ∗ᶜ ♯ₗl) @ R
{{ v, v = #42 l C #21 }}%I.
Proof.
iIntros. vcg. iIntros "Hl !> $". awp_lam. vcg.
......
......@@ -5,7 +5,7 @@ Definition inc : val := λ: "l",
a_ret "l" += 1 ; 1.
Definition par_inc : val := λ: "l",
call (inc, a_ret "l") + call (inc, a_ret "l").
call inc (a_ret "l") + call inc (a_ret "l").
Section par_inc.
Context `{amonadG Σ, !inG Σ (frac_authR natR)}.
......@@ -25,7 +25,7 @@ Section par_inc.
iApply (awp_insert_res _ _ par_inc_inv with "[Hγ Hl]").
{ iExists 0%nat. iFrame. }
iAssert ( (own γ (!{1 / 2} 0%nat) -
AWP call (inc, a_ret (cloc_to_val cl)) @ par_inc_inv R
AWP call inc (a_ret (cloc_to_val cl)) @ par_inc_inv R
{{ v, v = #1 own γ (!{1 / 2} 1%nat) }}))%I as "#H".
{ iIntros "!> Hγ'". vcg; iIntros "!> [HR $]". iDestruct "HR" as (n') "[Hl Hγ]".
iApply awp_fupd. iApply (inc_spec with "[$]"); iIntros "Hl".
......
......@@ -254,7 +254,7 @@ Fixpoint dcexpr_interp (E : known_locs) (de : dcexpr) : expr :=
| dCPar de1 de2 => dcexpr_interp E de1 ||| dcexpr_interp E de2
| dCWhile de1 de2 => while (dcexpr_interp E de1) { dcexpr_interp E de2 }
| dCWhileV de1 de2 => whileV (dcexpr_interp E de1) { dcexpr_interp E de2 }
| dCCall fv de => call (fv, dcexpr_interp E de)
| dCCall fv de => call fv (dcexpr_interp E de)
| dCUnknown e1 => e1
end.
......
......@@ -220,7 +220,7 @@ Instance into_dcexpr_whileV E E' E'' e1 e2 de1 de2 :
IntoDCExpr E E'' (whileV(e1) { e2 }) (dCWhileV de1 de2).
Proof. solve_into_dcexpr2. Qed.
Instance into_dcexpr_call e1 E E' f de1 :
IntoDCExpr E E' e1 de1 IntoDCExpr E E' (call (Val f, e1)) (dCCall f de1).
IntoDCExpr E E' e1 de1 IntoDCExpr E E' (call (Val f) e1) (dCCall f de1).
Proof. intros [-> ??]; by split. Qed.
Instance into_dcexpr_unknown E e : IntoDCExpr E E e (dCUnknown e) | 100.
Proof. done. Qed.
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