Commit d9b0b2c4 authored by Robbert Krebbers's avatar Robbert Krebbers

Many changes.

- Allow for binders in protocols.
- Model protocols in CPS style using the COFE solver.
- Change the channel methods so they do not mention sides.
- Lots of refactoring.
- Generalize the `list_sort` example.
- Move stuff to stdpp/Iris.
parent a0c63e6f
-Q theories osiris
-arg -w -arg -notation-overridden,-redundant-canonical-projection,-several-object-files
theories/utils/auth_excl.v
theories/proto/encodable.v
theories/proto/list.v
theories/proto/channel.v
theories/proto/involutive.v
theories/proto/side.v
theories/proto/proto_def.v
theories/proto/proto_specs.v
theories/proto/proto_enc.v
theories/proto/branching.v
theories/utils/encodable.v
theories/utils/list.v
theories/channel/channel.v
theories/channel/proto_model.v
theories/channel/proto_channel.v
theories/channel/branching.v
theories/examples/proofs_enc.v
theories/examples/branching_proofs.v
theories/examples/list_sort.v
From iris.heap_lang Require Import proofmode notation.
From osiris.proto Require Export proto_enc.
From osiris.channel Require Export proto_channel.
Definition TSB {PROP : bi} (a : action)
(prot1 prot2 : proto val PROP) : proto val PROP :=
......
This diff is collapsed.
This diff is collapsed.
From iris.heap_lang Require Import proofmode notation.
From osiris.proto Require Import branching.
From osiris.channel Require Import branching.
Definition branch_example b : expr :=
(let: "c" := new_chan #() in
......
This diff is collapsed.
From iris.heap_lang Require Import proofmode notation.
From osiris.proto Require Import proto_enc.
From osiris.channel Require Import proto_channel.
Definition seq_example : expr :=
(let: "c" := new_chan #() in
......
From iris.heap_lang Require Import proofmode notation.
Class Involutive {A} (R : relation A) (f : A A) :=
involutive x : R (f (f x)) x.
This diff is collapsed.
From iris.heap_lang Require Import proofmode notation.
From osiris.proto Require Export encodable proto_specs.
Section DualProtoEnc.
Context `{ValEncDec V} {PROP: bi} .
Definition TSR'
(a : action) (Φ : V PROP) (prot : V proto val PROP) : proto val PROP :=
TSR a
(λ v, if val_decode v is Some x then Φ x else False)%I
(λ v, if val_decode v is Some x then prot x else TEnd (* dummy *)).
Global Instance: Params (@TSR') 3.
Global Instance is_dual_tsr' a1 a2 Φ (st1 st2 : V proto val PROP) :
IsDualAction a1 a2
( x, IsDualProto (st1 x) (st2 x))
IsDualProto (TSR' a1 Φ st1) (TSR' a2 Φ st2).
Proof.
rewrite /IsDualAction /IsDualProto. intros <- Hst.
rewrite -(proto_force_eq (dual_proto _)).
constructor=> x. done. destruct (val_decode x)=> //.
apply is_dual_end.
Qed.
End DualProtoEnc.
Notation "<!> x @ P , prot" :=
(TSR' Send (λ x, P%I) (λ x, prot%proto))
(at level 200, x pattern, prot at level 200) : proto_scope.
Notation "<?> x @ P , prot" :=
(TSR' Receive (λ x, P%I) (λ x, prot%proto))
(at level 200, x pattern, prot at level 200) : proto_scope.
Notation "<!> x , prot" := (<!> x @ True, (prot x))%proto
(at level 200, x pattern, prot at level 200) : proto_scope.
Notation "<?> x , prot" := (<?> x @ True, (prot x))%proto
(at level 200, x pattern, prot at level 200) : proto_scope.
Notation "<!> @ Φ , prot" := (TSR' Send Φ prot)
(at level 200, prot at level 200) : proto_scope.
Notation "<?> @ Φ , prot" := (TSR' Receive Φ prot)
(at level 200, prot at level 200) : proto_scope.
Section proto_enc_specs.
Context `{!heapG Σ, !logrelG val Σ} `{ValEncDec A} (N : namespace).
Lemma send_st_spec prot γ c s (Φ : A iProp Σ) w :
{{{ Φ w c @ s : <!> @ Φ, prot {N,γ} }}}
send c #s (val_encode w)
{{{ RET #(); c @ s : prot w {N,γ} }}}.
Proof.
iIntros (Ψ) "[HΦ Hsend] HΨ".
iApply (send_st_spec with "[HΦ $Hsend]").
{ by rewrite val_encode_decode. }
iNext. rewrite val_encode_decode.
by iApply "HΨ".
Qed.
Lemma recv_st_spec prot γ c s (Φ : A iProp Σ) :
{{{ c @ s : <?> @ Φ, prot {N,γ} }}}
recv c #s
{{{ v, RET (val_encode v); c @ s : prot v {N,γ} Φ v }}}.
Proof.
iIntros (Ψ) "Hrecv HΨ".
iApply (recv_st_spec with "Hrecv").
iIntros "!>" (v) "[H HΦ]".
iAssert ( w, val_decode v = Some w Φ w)%I with "[HΦ]" as (w Hw) "HΦ".
{ destruct (val_decode v) as [x|]; last done.
iExists x. by iFrame. }
apply val_decode_encode in Hw as <-.
iApply ("HΨ" $!w). iFrame "HΦ".
by rewrite val_encode_decode.
Qed.
End proto_enc_specs.
This diff is collapsed.
From iris.heap_lang Require Import proofmode notation.
From osiris.proto Require Export involutive.
Inductive side := Left | Right.
Instance side_inhabited : Inhabited side := populate Left.
Definition dual_side (s : side) : side :=
match s with Left => Right | Right => Left end.
Instance dual_side_involutive : Involutive (=) dual_side.
Proof. by intros []. Qed.
\ No newline at end of file
From iris.heap_lang Require Export lang.
From iris.proofmode Require Import tactics.
From iris.algebra Require Import excl auth.
From iris.base_logic.lib Require Import auth.
From iris.base_logic.lib Require Import own.
Set Default Proof Using "Type".
Class auth_exclG (A : ofeT) (Σ : gFunctors) := AuthExclG {
......
From iris.heap_lang Require Export proofmode notation.
From iris.heap_lang Require Import assert.
From osiris Require Export encodable.
From osiris.utils Require Export encodable.
(** Immutable ML-style functional lists *)
Instance list_val_enc `{ValEnc A} : ValEnc (list A) :=
......@@ -148,6 +148,7 @@ Proof.
by wp_apply (lcons_spec with "[//]").
Qed.
(*
Lemma llist_member_spec `{EqDecision A} (xs : list A) (x : A) :
{{{ True }}}
llist_member (val_encode x) (val_encode xs)
......@@ -164,6 +165,7 @@ Proof.
- by rewrite bool_decide_true; last by right.
- by rewrite bool_decide_false ?elem_of_cons; last naive_solver.
Qed.
*)
Lemma lreplicate_spec i x :
{{{ True }}}
......
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