LogrelCC.examples.cl_example
From LogrelCC Require Import rules_unary cl_rules lang.
From iris.proofmode Require Import tactics.
Definition callcc_disrupt : expr :=
BinOp Add (Callcc (BinOp Add (Throw (#n 5) (Var 0)) (#n 4))) (#n 2).
Section proofs.
Context `{heapG Σ}.
Lemma wp_callcc_disrupt : WP callcc_disrupt {{x, ⌜x = #nv 7⌝}}%I.
Proof.
iIntros "".
iApply (wp_callcc [BinOpLCtx _ _]); eauto.
iNext; asimpl.
iApply (wp_throw [BinOpLCtx _ _; BinOpLCtx _ _]); eauto.
iNext; simpl.
iApply (wp_bin_op []); eauto.
iNext; simpl.
iApply wp_value; eauto.
Qed.
Lemma clwp_callcc_disrupt : CLWP callcc_disrupt {{x, ⌜x = #nv 7⌝}}%I.
Proof.
rewrite unfold_clwp.
iIntros (K Ψ) "HΨ /=".
iApply (wp_callcc (BinOpLCtx _ _ :: K)); eauto.
iNext; simpl; asimpl.
iApply (wp_throw (BinOpLCtx _ _ :: BinOpLCtx _ _ :: K)); eauto.
iNext; simpl.
iApply (wp_bin_op K); eauto.
iNext; simpl.
by iApply ("HΨ" $! (#nv _)).
Qed.
End proofs.
From iris.proofmode Require Import tactics.
Definition callcc_disrupt : expr :=
BinOp Add (Callcc (BinOp Add (Throw (#n 5) (Var 0)) (#n 4))) (#n 2).
Section proofs.
Context `{heapG Σ}.
Lemma wp_callcc_disrupt : WP callcc_disrupt {{x, ⌜x = #nv 7⌝}}%I.
Proof.
iIntros "".
iApply (wp_callcc [BinOpLCtx _ _]); eauto.
iNext; asimpl.
iApply (wp_throw [BinOpLCtx _ _; BinOpLCtx _ _]); eauto.
iNext; simpl.
iApply (wp_bin_op []); eauto.
iNext; simpl.
iApply wp_value; eauto.
Qed.
Lemma clwp_callcc_disrupt : CLWP callcc_disrupt {{x, ⌜x = #nv 7⌝}}%I.
Proof.
rewrite unfold_clwp.
iIntros (K Ψ) "HΨ /=".
iApply (wp_callcc (BinOpLCtx _ _ :: K)); eauto.
iNext; simpl; asimpl.
iApply (wp_throw (BinOpLCtx _ _ :: BinOpLCtx _ _ :: K)); eauto.
iNext; simpl.
iApply (wp_bin_op K); eauto.
iNext; simpl.
by iApply ("HΨ" $! (#nv _)).
Qed.
End proofs.