SessionTypes: switched to modular structure, to define several variants

This commit is contained in:
Adam Chlipala 2018-05-13 10:32:59 -04:00
parent 9f247b8375
commit 7fc57d795c

View file

@ -9,7 +9,11 @@ Set Implicit Arguments.
Set Asymmetric Patterns. Set Asymmetric Patterns.
(** * Defining the Type System *) (** * Two-Party Session Types *)
Module TwoParty.
(** ** Defining the type system *)
Inductive type := Inductive type :=
| TSend (ch : channel) (A : Set) (t : A -> type) | TSend (ch : channel) (A : Set) (t : A -> type)
@ -32,7 +36,7 @@ Inductive hasty : proc -> type -> Prop :=
hasty Done TDone. hasty Done TDone.
(** * Examples of Typed Processes *) (** * Examples of typed processes *)
(* Recall our first example from last chapter. *) (* Recall our first example from last chapter. *)
Definition addN (k : nat) (input output : channel) : proc := Definition addN (k : nat) (input output : channel) : proc :=
@ -53,7 +57,7 @@ Proof.
Qed. Qed.
(** * Complementing Types *) (** * Complementing types *)
Fixpoint complement (t : type) : type := Fixpoint complement (t : type) : type :=
match t with match t with
@ -233,3 +237,5 @@ Proof.
send_payment_info payment_success add_review); send_payment_info payment_success add_review);
hasty. hasty.
Qed. Qed.
End TwoParty.