A Domain Semantics for Higher-Order Recursive Processes
AA Domain Semantics for Higher-Order RecursiveProcesses
Ryan Kavanagh
Carnegie Mellon [email protected]
Abstract
The polarized SILL programming language [36, 49] uniformly integrates functional programmingand session-typed message-passing concurrency. It supports general recursion, asynchronous andsynchronous communication, and higher-order programs that communicate channels and processes.We give polarized SILL a domain-theoretic semantics—the first denotational semantics for a languagewith this combination of features. Session types in polarized SILL denote pairs of domains ofunidirectional communications. Processes denote continuous functions between these domains, andprocess composition is interpreted by a trace operator [28]. We illustrate our semantics by validatingexpected program equivalences.
Theory of computation Ñ Denotational semantics; Computingmethodologies Ñ Concurrent programming languages
Keywords and phrases
Session types, denotational semantics, recursion, higher-order processes.
Related Version
A full version of this paper is available at https://arxiv.org/abs/2002.01960 . The proofs-as-programs correspondence between linear logic and the session-typed π -calculusis the foundation of many programming languages for message-passing concurrency. It hasled to an arsenal of techniques for reasoning about processes [38, 39, 48]. Denotational se-mantics [6] and game semantics [16] have further enriched our understanding. However, givinga denotational semantics to session-typed languages with recursion has remained difficult.To illustrate the difficulty, consider a process that flips bits in a bit stream. A bit streamis a sequence of labels or sent over a channel. This communication protocol is specifiedby a recursive session type “ bits ”. The following recursive process, flip , uses a channel b (the input stream) to provide a channel f (the flipped stream), both satisfying the type bits : b : bits |- fix F . case b { 0 => f.1; f <- F <- b| 1 => f.0; f <- F <- b } :: f : bits It cases on the label received over b and sends the complementary label over f . Sub-sequent communication is handled by the tail call f <- F <- b . We use the concrete syntax f <- P <- b to spawn the process P that uses the channel b and provides the channel f .Operational semantics for session-typed processes generally satisfy a confluence propertythat implies that their input-output behaviour is deterministic. This suggests that flip denotes a function (cid:74) flip (cid:75) from bit streams on b to bit streams on f .This processes-as-functions interpretation raises many questions. The process providingthe bit stream on b could get stuck and only send a finite prefix of this bit stream. Howshould (cid:74) flip (cid:75) handle these finite prefixes? Computationally, (cid:74) flip (cid:75) should be monotone: Explicitly, bits “ ρβ. ‘ t : β, : β u , where ρα.A forms recursive types and ‘t l : A l u l P L forms internalchoice types. a r X i v : . [ c s . P L ] M a y A Domain Semantics for Higher-Order Recursive Processes a longer input prefix should result in no less output. It should also be continuous: (cid:74) flip (cid:75) should not be able to observe an entire infinitely-long bit stream before sending output.Bidirectional communication further complicates this interpretation. Indeed, sessiontypes specify communication protocols on channels that carry both input to and outputfrom processes. How do we decompose session-typed communications into the “inputs” and“outputs” for processes-as-functions in a principled way? Finally, what does it mean tocompose processes P and Q communicating over c ? How do we capture the feedback causedby feeding P ’s output on c into Q and vice-versa?Our thesis is that a domain-theoretic denotational semantics elucidates the structure ofhigher-order session-typed languages with recursion. Domains are well-studied mathematicalstructures and we leverage their rich theory to study these languages. A denotationalsemantics also induces a notion of semantic equivalence. It is automatically compositionalbecause denotational semantics are defined by recursion on the structure of programs. We give a domain semantics for polarized SILL [36, 49]. Polarized SILL integratesfunctional and message-passing concurrent programming. It supports recursive session typesand processes, and higher-order programs that communicate channels and processes. Com-munication is asynchronous, and synchronous communication is encoded using polarity shifts.Though denotational semantics [6, 16, 32] exist for session-typed languages in restrictedsettings (e.g., in the absence of recursion, functional constructs, or higher-order features),ours is the first denotational semantics for a full-featured session-typed language.For readers familiar with session types, we hope they can take away the high-level ideas oftheir semantic interpretation in the presence of (nonlinear) functions and arbitrary recursionand how it might be used to reason about process equivalence. A particular phenomenonnot usually addressed is that processes may fail to communicate along a given channel in thepresence of recursively defined types and processes. This phenomenon is easily addresseddomain-theoretically: because processes denote continuous (so monotone) functions, theyuniformly treat complete and incomplete communications.For readers familiar with denotational semantics, we hope they can take away the ideasbehind its application to bidirectional, session-typed communication in the presence ofrecursion. The key insights here, when compared to the denotational semantics of functionallanguages, are that (session) types denote pairs of domains of unidirectional communicationsinstead of domains of values, and that program (process) composition is given by a traceoperator instead of by function composition.We give an overview of polarized SILL and of our semantics in Sections 2 and 3. Thedetails of our semantics are given in Section 5. We revisit the bit-flipping process in Section 6.All typing rules and semantic clauses can be found in Appendices A and B, respectively.
The polarized SILL programming language cohesively integrates functional computation andmessage-passing concurrent computation. Its concurrent computation layer arises from aproofs-as-processes correspondence between intuitionistic linear logic and the session-typed π -calculus [15]. A session type A prescribes a protocol for communicating over a channel. Aprocess P provides a service A on a channel c and uses (is a client of) zero or more services A i on channels c i . The used services form a linear context ∆ “ c : A , . . . , c n : A n . The process P can use values from the functional layer. These are abstracted by a structural context Ψof functional variables. These data are captured by the judgment Ψ ; ∆ $ P :: c : A . It isinductively defined by the rules of Appendix A.2. . Kavanagh 3 Session types are polarized: they can be partitioned as positive or negative . Whenlooking at a judgment Ψ ; ∆ $ P :: c : A , we can imagine “positive information” as flowingleft-to-right and “negative information” as flowing right-to-left. For example, when A ispositive, communication on c is sent by P ; when A is negative, it is received by P . As P executes, the type of a channel b : B in ∆ , c : A evolves, sometimes becoming a positivesubphrase of B , sometimes a negative subphrase of B . It is this evolution that allows forbidirectional communication. We write B type ` s to mean B is positive and B type ´ s to mean B is negative. Most session types have a polar-dual session type, where the direction of thecommunication is reversed. For brevity, we consider only positive session types below. Thesemantics of negative session types follow by symmetry and are given in the appendices.The functional layer is the simply-typed λ -calculus with a fixed-point operator and acall-by-value evaluation semantics. A judgment Ψ , M : τ means the functional term M has functional type τ under the structural context Ψ of functional variables x i : τ i . Thisjudgment’s definition is standard and it is inductively defined by the rules of Appendix A.1.We use the judgment τ type f to mean that τ is a functional type. New is the base type t a : A Ð a i : A i u of quoted processes, where we abbreviate ordered lists using an overline.Quoted processes are introduced and eliminated by the rules:Ψ ; a i : A i $ P :: a : A Ψ , a Ð t P u Ð a i : t a : A Ð a i : A i u p I-{} q Ψ , M : t a : A Ð a i : A i u Ψ ; a i : A i $ a Ð t M u Ð a i :: a : A p E-{} q Functional values can be sent over channels of type τ ^ A . It specifies that the sent valuehas type τ and that subsequent communication has type A . The process _ Ð output a M ; P evaluates M to a value, sends it over the channel a , and continues as P . The process x Ð input a ; Q receives a value on a , binds it to the variable x , and continues as Q . Ψ , M : τ Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A p^ R q Ψ , x : τ ; ∆ , a : A $ Q :: c : C Ψ ; ∆ , a : τ ^ A $ x Ð input a ; Q :: c : C p^ L q The process b Ð a forwards all messages between channels a and b of the same type. Pro-cess composition a Ð P ; Q captures Milner’s “parallel composition plus hiding” operation [33,pp. 20f.]. It spawns processes P and Q that communicate over a private channel a .Ψ ; a : A $ b Ð a :: b : A p Fwd q Ψ ; ∆ $ P :: a : A Ψ ; a : A, ∆ $ Q :: c : C Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C p Cut q Processes can close channels of type . To do so, the process close a sends a “closemessage” over the channel a and terminates. The process wait a ; P blocks on a until itreceives the close message and then continues as P .Ψ ; ¨ $ close a :: a : p R q Ψ ; ∆ $ P :: c : C Ψ ; ∆ , a : $ wait a ; P :: c : C p L q Processes can communicate channels over channels. The protocol B b A prescribestransmitting a channel of type B followed by communication of type A . The process send a b ; P sends the channel b over the channel a and continues as P . The process b Ð recv a ; P receives a channel over a , binds it to the name b , and continues as P . Ψ ; ∆ $ P :: a : A Ψ ; ∆ , b : B $ send a b ; P :: a : B b A pb R ˚ q Ψ ; ∆ , a : A, b : B $ P :: c : C Ψ ; ∆ , a : B b A $ b Ð recv a ; P :: c : C pb L q Process communication is asynchronous. Synchronization is encoded using “polarityshifts” [36]. The positive protocol Ó A prescribes a synchronization (the shift) followed by A Domain Semantics for Higher-Order Recursive Processes communication satisfying the negative type A . The process send a shift ; P signals that it isready to receive on a by sending a “shift message” on a , and continues as P . The process shift Ð recv a ; Q blocks until it receives the shift message and continues as Q .Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ send a shift ; P :: a : Ó A pÓ R q Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : Ó A $ shift Ð recv a ; P :: c : C pÓ L q Processes can choose between services. An internal choice type ‘t l : A l u l P L prescribes achoice between session types t A l u l P L ( L finite). The process a.k ; P chooses to provide the ser-vice A k by sending the label k on a , and then continues as P . The process case a t l ñ P l u l P L blocks until it receives a label k on a and then continues as P k . Ψ ; ∆ $ P :: a : A k p k P L q Ψ ; ∆ $ a.k ; P :: a : ‘t l : A l u l P L p‘ R k q Ψ ; ∆ , a : A l $ P l :: c : C p@ l P L q Ψ ; ∆ , a : ‘t l : A l u l P L $ case a t l l ñ P l u i P I :: c : C p‘ L q Open session types are given by the judgment Ξ $ A type p s , where Ξ is a structural contextof polarized type variables α i type p i s and p, p i P t´ , `u . We abbreviate the judgment asΞ $ A type s when no ambiguity arises. It is inductively defined by the rules of Appendix A.3.The recursive type ρα.A prescribes an “unfold” message followed by communication oftype r ρα.A { α s A . The process send a unfold ; P sends an unfold message and continues as P .The process unfold Ð recv a ; P receives an unfold message and continues as P . Ψ ; ∆ $ P :: a : r ρα.A { α s A ¨ $ ρα.A type ` s Ψ ; ∆ $ send a unfold ; P :: a : ρα.A p ρ ` R q Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C ¨ $ ρα.A type ` s Ψ ; ∆ , a : ρα.A $ unfold Ð recv a ; P :: c : C p ρ ` L q The semantics of the functional layer is standard [17, 25, 40, 47]. A functional type τ denotesa Scott domain (an ω -algebraic bounded-complete pointed dcpo) (cid:74) τ (cid:75) . A structural contextΨ of functional variables x i : τ i is interpreted as the Ψ-indexed product (cid:74) Ψ (cid:75) “ ś x i P Ψ (cid:74) τ i (cid:75) . Afunctional term Ψ , M : τ denotes a continuous function (cid:74) Ψ , M : τ (cid:75) : (cid:74) Ψ (cid:75) Ñ (cid:74) τ (cid:75) in thecategory ω - aBC of Scott domains and continuous functions.We cannot interpret processes Ψ ; ∆ $ P :: c : A in the same way as functional terms,that is, as functions (cid:74) Ψ (cid:75) ˆ (cid:74) ∆ (cid:75) Ñ (cid:74) A (cid:75) . This is due to the fundamental difference between variables and channel names . A variable x : τ in the context Ψ stands for a value of type τ .A channel name in ∆ , c : A stands not for a value, but for a channel of typed bidirectionalcommunications. Informally and novelly, we interpret processes as continuous functions (cid:74) Ψ ; ∆ $ P :: c : A (cid:75) : (cid:74) Ψ (cid:75) Ñ r “ inputOn p ∆ , c : A q ” Ñ “ outputOn p ∆ , c : A q ” s (1)where we use the notation r¨ Ñ ¨s for function spaces.We use polarity to split a bidirectional communication into a pair of unidirectionalcommunications. Given a protocol B , its positive aspect prescribes the left-to-right com-munications, while its negative aspect prescribes the right-to-left communications. Theseaspects determine Scott domains (cid:74) B (cid:75) ´ and (cid:74) B (cid:75) ` that respectively contain the “negative”and “positive” portions of the bidirectional communications. Their bottom elements capturethe absence of communication, e.g., due to a stuck process. The informal interpretation (1)is then made precise as the continuous function (cid:74) Ψ ; ∆ $ P :: c : A (cid:75) : (cid:74) Ψ (cid:75) Ñ r (cid:74) ∆ (cid:75) ` ˆ (cid:74) c : A (cid:75) ´ Ñ (cid:74) ∆ (cid:75) ´ ˆ (cid:74) c : A (cid:75) ` s (2)in ω - aBC , where (cid:74) c : A , . . . , c n : A n (cid:75) p is the t c p , . . . , c pn u -indexed product ś c pi (cid:74) A i (cid:75) p . . Kavanagh 5 Operationally, the process composition Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C spawns twoprocesses Ψ ; ∆ $ P :: a : A and Ψ ; a : A, ∆ $ Q :: c : C communicating along the privatechannel a of type A . We follow prior work on the semantics of dataflow [29] and on thegeometry of interactions [1, 4], and capture this feedback using a least fixed point. Given anenvironment u P (cid:74) Ψ (cid:75) , and p δ ` , δ ` , c ´ q P (cid:74) ∆ , ∆ (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ , we define (cid:74) Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) u p δ ` , δ ` , c ´ q “ p δ ´ , δ ´ , c ` q (3)where δ ´ , δ ´ , a ´ , a ` , and c ` form the least solution to the equations p δ ´ , a ` q “ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , a ´ q , p δ ´ , a ´ , c ` q “ (cid:74) Ψ ; a : A, ∆ $ Q :: c : C (cid:75) u p δ ` , a ` , c ´ q . We can compute this least solution as the least upper bound p δ ´ , δ ´ , a ´ , a ` , c ` q of thefollowing inductively-defined ascending chain p δ ´ ,n , δ ´ ,n , a ´ n , a ` n , c ` n q n P N : p δ ´ , , a ` q “ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , K (cid:74) A (cid:75) ´ q , p δ ´ , , a ´ , c ` q “ (cid:74) Ψ ; a : A, ∆ $ Q :: c : C (cid:75) u p δ ` , K (cid:74) A (cid:75) ` , c ´ q , p δ ´ ,n ` , a ` n ` q “ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , a ´ n q , p δ ´ ,n ` , a ´ n ` , c ` n ` q “ (cid:74) Ψ ; a : A, ∆ $ Q :: c : C (cid:75) u p δ ` , a ` n , c ´ q . This chain captures the iterative nature of the feedback loop created by P and Q communic-ating on a : A .This fixed-point operation is an instance of a “trace operator” on the traced monoidalcategory ω - aBC [4, 18, 28]. A trace operator is a family of functions Tr XA,B : r A ˆ X Ñ B ˆ X s Ñ r A Ñ B s natural in A and B , dinatural in X , and satisfying a collection ofaxioms. It captures Milner’s “parallel composition plus hiding” operation and it is used byAbramsky et al. [3] to give semantics to concurrent computation. Trace operators have arich theory that we can leverage to reason about process composition.We build on standard domain-theoretic techniques to interpret session types and func-tional types. Open session types Ξ $ A type s denote locally continuous functors on acategory of domains. Let ω - aBC K ! be the subcategory of ω - aBC whose morphisms are strictfunctions. Let (cid:74) Ξ (cid:75) be the Ξ-indexed product ś α P Ξ ω - aBC K ! . The positive and negativeaspects (cid:74) Ξ $ A type s (cid:75) ´ and (cid:74) Ξ $ A type s (cid:75) ` are then locally continuous functors from (cid:74) Ξ (cid:75) to ω - aBC K ! . Recursive types are interpreted as solutions to domain equations.Our semantics does not use ω -algebraicity or bounded-completeness, but we mentionthis additional structure in case it is useful for future work. All occurrences of ω - aBC and ω - aBC K ! could respectively be replaced by DCPO K and DCPO K ! . Given a locally small category C , we write C p´ , ´q : C op ˆ C Ñ Set for the hom functor.If C has an internal hom, we write C r´ Ñ ´s : C op ˆ C Ñ C or just r´ Ñ ´s for it.We write p d : D q ˆ ¨ ¨ ¨ ˆ p d n : D n q for the product of the D i indexed by the d i .Given δ i P D i , we write p d : δ , . . . , d n : δ n q for an element of this product. Givenan indexed product ś i P I D i and a subset J Ď I , we write π IJ or π J for the projection ś i P I D i Ñ ś j P J D j .The category ω - aBC has a continuous least-fixed-point operator fix : r D Ñ D s Ñ D foreach object D . It also has a continuous fixed-point operator p¨q : : r A ˆ X Ñ X s Ñ r A Ñ X s given by f : p a q “ fix p λx.f p a, x qq . It satisfies the fixed-point identity of [10]: f : “ f ˝ x id , f : y . A Domain Semantics for Higher-Order Recursive Processes
The category ω - aBC is also equipped with a trace operator [4, 18, 28]. It fixes the X component of a morphism f : A ˆ X Ñ B ˆ X to produce a morphism Tr X p f q : A Ñ B . Itis given by Tr X p f q “ π B ˆ XB ˝ f ˝ x id A , p π B ˆ XX ˝ f q : y . It has the following Knaster-Tarski-styleformulation: Tr X p f qp a q “ π B p (cid:100) tp b, x q | f p a, x q Ď p b, x quq .The lifting functor p´q K : ω - aBC Ñ ω - aBC K ! is left-adjoint [5, p. 44] to the inclusion ω - aBC K ! ã Ñ ω - aBC . The domain D K is obtained by adjoining a new bottom elementto D . The unit up : id Ñ p´q K witnesses the inclusion of D in D K . We write r d s for up D p d q P D K and down for the counit. The morphism f K : D K Ñ E K is given by f K pKq “ K and f K pr d sq “ r f p d qs for d P D . Given a functor F , we abbreviate p´q K ˝ F as F K .To make a function f : ś i P I A i Ñ B strict in a component j P I , we use the continuousfunction strict j : r ś i P I A i Ñ B s Ñ r ś i P I A i Ñ B s :strict j p f q pp a i q i P I q “ K B if a j “ K A j f pp a i q i P I q otherwise . (4) We define the denotations of judgments by induction on their derivation. To illustrate oursemantics, we show that it validates expected equivalences. § Definition 1 (Semantic equivalence) . Processes
Ψ ; ∆ $ P :: c : A and Ψ ; ∆ $ Q :: c : A are equivalent, P ” Q , if (cid:74) Ψ ; ∆ $ P :: c : A (cid:75) “ (cid:74) Ψ ; ∆ $ Q :: c : A (cid:75) . Functional terms Ψ , M : τ and Ψ , N : τ are equivalent, M ” N , if (cid:74) Ψ , M : τ (cid:75) “ (cid:74) Ψ , N : τ (cid:75) . The functional layer is the simply-typed λ -calculus with a call-by-value semantics and afixed-point operator. Arrow types are formed by the rule ( T Ñ ). They are interpreted asstrict function spaces in ω - aBC K ! to enforce a call-by-value semantics: (cid:74) τ Ñ σ type f (cid:75) “ ω - aBC K ! r (cid:74) τ type f (cid:75) Ñ (cid:74) σ type f (cid:75) s . (5)The typing rules ( F-Var ), (
F-Fun ), (
F-App ), and (
F-Fix ) for the functional layer arestandard. The call-by-value semantics is as in [45]. We let u range over (cid:74) Ψ (cid:75) . The environment r u | x ÞÑ v s P (cid:74) Ψ , x : τ (cid:75) maps x to v and y to u p y q for all y P Ψ. The fixed-point operator(
F-Fix ) is interpreted using the fixed-point operator defined in Section 4. (cid:74) Ψ , x : τ , x : τ (cid:75) u “ π Ψ ,xx u (6) (cid:74) Ψ , λx : τ.M : τ Ñ σ (cid:75) u “ strict p λv P (cid:74) τ (cid:75) . (cid:74) Ψ , x : τ , M : σ (cid:75) r u | x ÞÑ v sq (7) (cid:74) Ψ , M N : σ (cid:75) u “ (cid:74) Ψ , M : τ Ñ σ (cid:75) u p (cid:74) Ψ , N : τ (cid:75) u q (8) (cid:74) Ψ , fix x.M : τ (cid:75) u “ (cid:74) Ψ , x : τ , M : τ (cid:75) : u (9) § Proposition 2.
For all Ψ , x : τ , M : τ , we have r fix x.M { x s M ” fix x.M . For simplicity, the only base types are those of quoted processes. They are formed by(
T{} ), and its interpretation is: (cid:74) t a : A Ð a i : A i u type f (cid:75) “ (cid:74) a i : A i $ a : A (cid:75) K (10)where we abbreviate ω - aBC r (cid:74) ∆ (cid:75) ` ˆ (cid:74) a : A (cid:75) ´ Ñ (cid:74) ∆ (cid:75) ´ ˆ (cid:74) a : A (cid:75) ` s as (cid:74) ∆ $ a : A (cid:75) . The dis-tinction between the two “bottom” elements in (cid:74) a i : A i $ a : A (cid:75) K is semantically meaningful. . Kavanagh 7 The genuine bottom element denotes the absence of a value of type t a : A Ð a i : A i u . Thelifted bottom element r λx. Ks corresponds to a stuck process that produces no output.The ( I-{} ) introduction rule quotes processes. Its denotation is: (cid:74) Ψ , a Ð t P u Ð a i : t a : A Ð a i : A i u (cid:75) “ up ˝ (cid:74) Ψ ; a i : A i $ P :: a : A (cid:75) . (11)Because the unit up is not strict, quoting respects the semantic distinction between quotedstuck processes r λx. Ks and the absence K of a value of type t a : A Ð a i : A i u .The ( E-{} ) elimination rule spawns quoted processes. Its denotation is: (cid:74)
Ψ ; a i : A i $ a Ð t M u Ð a i :: a : A (cid:75) “ down ˝ (cid:74) Ψ , M : t a : A Ð a i : A i u (cid:75) . (12)Two cases are possible when unquoting M . If (cid:74) Ψ , M : t c : A Ð a i : A i u (cid:75) u is K , then down pKq is the constant function λx. K . This represents the process that never producesoutput. If (cid:74) Ψ , M : t c : A Ð a i : A i u (cid:75) u “ r p s , then down pr p sq “ p is the denotation of somequoted process.Equations (11) and (12) satisfy the following η -like property: § Proposition 3.
For all
Ψ ; a i : A i $ P :: a : A , we have P ” a Ð t a Ð t P u Ð a i u Ð a i . A communication of type τ ^ A is a value v P (cid:74) τ (cid:75) followed by a communication satisfying A . We use lifting to account for the potential lack of a communication: the bottom elementrepresents the absence of communication. The value travels in the positive direction, so itonly appears in the positive aspect. (cid:74) Ξ $ τ ^ A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ (13) (cid:74) Ξ $ τ ^ A type s (cid:75) ` “ ` (cid:74) τ (cid:75) ˆ (cid:74) Ξ $ A type s (cid:75) ` ˘ K (14)The process _ Ð output a M ; P sends a functional value on a and continues as P . Tosend the term M on a , we evaluate it under the current environment u to get an element (cid:74) Ψ , M : τ (cid:75) u P (cid:74) τ (cid:75) . Divergence is represented by K (cid:74) τ (cid:75) ; the other elements represent values oftype τ . If (cid:74) Ψ , M : τ (cid:75) u represents a value, then we pair it with the output of the continuationprocess P on a ` . Otherwise, the process transmits nothing. This gives the clause: (cid:74) Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A (cid:75) u p δ ` , a ´ q“ K if (cid:74) Ψ , M : τ (cid:75) u “ Kp δ ´ , rp v, a ` qsq if (cid:74) Ψ , M : τ (cid:75) u “ v ‰ K where (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , a ´ q “ p δ ´ , a ` q . (15)The process x Ð input a ; P blocks until it receives a communication on the channel a . Ifa communication rp v, α ` qs arrives on a ` , then the process binds v to x in the environmentand continues as P with the remaining communication α ` on a ` . If it receives no message,then it should produce no output, i.e., it should produce K on all channels. This means thatits denotation should be strict in the a ` component. (cid:74) Ψ ; ∆ , a : τ ^ A $ x Ð input a ; P :: c : C (cid:75) u “ strict a ` ` λ ` δ ` , a ` : “` v, α ` ˘‰ , c ´ ˘ . (cid:74) Ψ , x : τ ; ∆ , a : A $ P :: c : C (cid:75) r u | x ÞÑ v sp δ ` , α ` , c ´ q ˘ (16)We abuse notation to pattern match on the component a ` . By strictness, we know that itwill be an element of the form rp v, α ` qs . A Domain Semantics for Higher-Order Recursive Processes
Equation (16) illustrates a general principle in our semantics. The bottom element K represents the absence of communication. When a process waits for input on a channel a ituses (it provides), its denotation is strict in a ` (resp., a ´ ).The η -property for value transmission is subtle because the functional term M mightdiverge. The equivalence a Ð P ; r M { x s Q ” a Ð p _ Ð output a M ; P q ; p x Ð input a ; Q q does not hold in general. If x does not appear free in Q , the substitution on the left has noeffect and a Ð P ; Q runs as usual. However, if M diverges, then the process on the right isstuck. Indeed, x Ð input a ; Q waits on a but _ Ð output a M ; P gets stuck evaluating M and sends nothing. The two processes in the equivalence have equal denotations whenever M converges. Process equivalence requires the processes to have equal denotations under allenvironments u . For the equivalence to hold, M must then converge under every environment u P (cid:74) Ψ (cid:75) . This justifies the statement of Proposition 4. Its proof uses the substitution property(Proposition 17) and the Knaster-Tarski-style formulation of the trace. § Proposition 4.
For all
Ψ ; ∆ $ P :: a : A , all Ψ , x : τ ; a : A, ∆ $ Q :: c : C , andall Ψ , M : τ , we have a Ð P ; r M { x s Q ” a Ð p _ Ð output a M ; P q ; p x Ð input a ; Q q whenever (cid:74) Ψ , M : τ (cid:75) u ‰ K for all u P (cid:74) Ψ (cid:75) . Forwarding denotes the function that copies data from a ` to b ` and from b ´ to a ´ : (cid:74) Ψ ; a : A $ b Ð a :: b : A (cid:75) u p a ` : α, b ´ : β q “ p a ´ : β, b ` : α q . (17)Process composition “connects” the common channel a of two communicating processes.As motivated in Section 3, we use the trace operator to fix a ’s positive and negative aspects: (cid:74) Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) u “ Tr a ´ ˆ a ` p (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u ˆ (cid:74) Ψ ; a : A, ∆ $ Q :: c : C (cid:75) u q . (18)Associativity of composition follows from the trace operator axioms: § Proposition 5.
For all
Ψ ; ∆ $ P :: c : C , all Ψ ; c : C , ∆ $ P :: c : C , and all Ψ ; c : C , ∆ $ P :: c : C , we have c Ð P ; p c Ð P ; P q ” c Ð p c Ð P ; P q ; P . Processes can close channels of type . The close message is the only communicationpossible on a channel of type . The positive aspect of ( C ) is the constant functor onto thetwo-element pointed domain t˚u K “ tK Ď ˚u . The element ˚ represents the close message,while K represents the absence of communication. All communication on a channel of type is positive, so the negative aspect is the constant functor onto the terminal object tKu . (cid:74) Ξ $ type s (cid:75) ´ “ λξ. tKu (19) (cid:74) Ξ $ type s (cid:75) ` “ λξ. t˚u K (20)In our asynchronous setting, close a does not wait for a client before sending the closemessage. We interpret ( R ) as the constant function that sends the close message ˚ on a ` : (cid:74) Ψ ; ¨ $ close a :: a : (cid:75) u p a ´ : Kq “ p a ` : ˚q . (21)The process wait a ; P blocks until it receives the close message, so its denotation is strictin the component a ` . All other communication is handled by P . We interpret ( L ) by: (cid:74) Ψ ; ∆ , a : $ wait a ; P :: c : C (cid:75) u “ strict a ` ` λ p δ ` , a ` , c ´ q . p δ ´ , K , c ` q ˘ q where (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) u p δ ` , c ´ q “ p δ ´ , c ` q . (22) . Kavanagh 9 § Proposition 6.
For all
Ψ ; ∆ $ P :: c : C , we have P ” a Ð close a ; p wait a ; P q . Processes can communicate channels. We cannot directly observe a channel, only thecommunications it carries. For this reason, we treat communications of type A b B as a pairof communications: one for the sent channel and one for the continuation channel. Thisis analogous to the denotation of A b B given by Atkey [6]. We account for the potentialabsence of communication by lifting. (cid:74) Ξ $ A b B type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ ˆ (cid:74) Ξ $ B type s (cid:75) ´ (23) (cid:74) Ξ $ A b B type s (cid:75) ` “ ` (cid:74) Ξ $ A type s (cid:75) ` ˆ (cid:74) Ξ $ B type s (cid:75) ` ˘ K (24)To send the channel b over a , the process send a b ; P relays the positive communicationfrom b ` to the (cid:74) B (cid:75) ` -component of (cid:74) a : B b A (cid:75) ` , and the negative communication on the (cid:74) B (cid:75) ´ -component of (cid:74) a : B b A (cid:75) ´ to b ´ . The continuation P handles all other communication. (cid:74) Ψ ; ∆ , b : B $ send a b ; P :: a : B b A (cid:75) u p δ ` , b ` , p a ´ B , a ´ A qq “ ` δ ´ , a ´ B , “` b ` , a ` A ˘‰˘ where (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , a ´ A q “ p δ ´ , a ` A q . (25)The client b Ð recv a ; Q blocks until it receives a channel on a . When it receives acommunication “ p a ` B , a ` A q ‰ on (cid:74) a : B b A (cid:75) ` , it unpacks it into the two positive channels (cid:74) a : A, b : B (cid:75) ` expected by Q . It then repacks the negative communication Q produces on (cid:74) a : A, b : B (cid:75) ´ and relays it over (cid:74) a : B b A (cid:75) ´ . (cid:74) Ψ ; ∆ , a : B b A $ b Ð recv a ; Q :: c : C (cid:75) u p δ ` , a ` , c ´ q“ strict a ` ` λ p δ ` , a ` : “ p a ` B , a ` A q ‰ , c ´ q . p δ ´ , p b ´ , a ´ q , c ` q ˘ where (cid:74) Ψ ; ∆ , a : A, b : B $ Q :: c : C (cid:75) u p δ ` , a ` A , a ` B , c ´ q “ p δ ´ , a ´ , b ´ , c ` q . (26) § Proposition 7.
For all
Ψ ; ∆ $ P :: a : A and Ψ ; a : A, ∆ , b : B $ Q :: c : C , we have a Ð P ; Q ” b Ð p send a b ; P q ; p b Ð recv a ; Q q . § Example 8.
The process below blocks until it receives a channel a of type over thechannel b , at which point the type of b becomes . Then, the process waits for the closemessages on a and b before closing c . The element rp˚ , ˚qs P (cid:74) b (cid:75) ` “ p (cid:74) (cid:75) ` ˆ (cid:74) (cid:75) ` q K corresponds to receiving the channel a , the close message on a , and the close message on b .The element rpK , Kqs corresponds to receiving a but no close messages, while the elements rp˚ , Kqs and rpK , ˚qs correspond to receiving a and one close message. The element K meansthat a is never received. We see that the process only closes c in the first case: (cid:74) ¨ ; b : b $ a Ð recv b ; wait a ; wait b ; close c :: c : (cid:75) Kp b ` : β, c ´ : Kq“ p b ´ : pK , Kq , c ` : ˚q if β “ rp˚ , ˚qsp b ´ : pK , Kq , c ` : Kq otherwise. Synchronization is encoded using “polarity shifts”. A communication of type Ó A is asynchronization message (the “shift” message) followed by a communication of type A .“Downshifting” A to Ó A introduces only positive communication (the “shift” message), so thenegative aspect of Ó A is the same as the negative aspect of A . We interpret (cid:74) Ó A (cid:75) ` by lifting (cid:74) A (cid:75) ` . The element K (cid:74) Ó A (cid:75) ` captures the absence of communication. The elements r a s for a P (cid:74) A (cid:75) ` capture a shift message followed by a communication satisfying A . (cid:74) Ξ $ Ó A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ (27) (cid:74) Ξ $ Ó A type s (cid:75) ` “ (cid:74) Ξ $ A type s (cid:75) `K (28)In our asynchronous setting, the shift message is always sent. This corresponds to liftingthe output of P on the a ` component. We interpret ( Ó R ) as: (cid:74) Ψ ; ∆ $ send a shift ; P :: a : Ó A (cid:75) u “ ` id ˆ ` a ` : up ˘˘ ˝ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u. (29)The client blocks until it receives the shift message on a ` . We lower (cid:74) A (cid:75) `K to (cid:74) A (cid:75) ` toextract the positive communication expected by P . (cid:74) Ψ ; ∆ , a : Ó A $ shift Ð recv a ; P :: c : C (cid:75) u “ strict a ` ` (cid:74) Ψ ; ∆ , a : A $ P :: c : C (cid:75) u ˝ ` id ˆ ` a ` : down ˘˘˘ (30) § Proposition 9.
For all
Ψ ; ∆ $ P :: a : A and Ψ ; a : A, ∆ $ Q :: c : C , we have a Ð P ; Q ” a Ð p send a shift ; P q ; p shift Ð recv a ; Q q . § Example 10.
Upshifts are the polar duals of downshifts. The following process waits forits client to synchronize with it before closing the channel. The protocol Ò has denotations (cid:74) Ò (cid:75) ´ “ (cid:74) (cid:75) ´K “ tKu K and (cid:74) Ò (cid:75) ` “ (cid:74) (cid:75) ` “ t˚u K . The element rKs P (cid:74) Ò (cid:75) ´ captures thesynchronizing shift message. The process closes a if and only if it receives the shift message: (cid:74) ¨ ; ¨ $ shift Ð recv a ; close a :: a : Ò (cid:75) Kp a ´ : α q “ p a ` : Kq if α “ Kp a ` : ˚q if α “ rKs . The internal choice type ‘t l : A l u l P L prescribes a choice between session types t A l u l P L ( L finite). A communication of type ‘t l : A l u l P L is a label k P L sent in the positive directionfollowed by a communication satisfying A k . Denotationally, this corresponds to tagging acommunication a k P (cid:74) A k (cid:75) ` with the label k . Tagged communications p k, a k q are the elementsof the disjoint union Ţ l P L (cid:74) A l (cid:75) ` . To account for the potential lack of communication, we liftthis disjoint union. This lifted disjoint union is isomorphic to the coalesced sum À l P L (cid:74) A l (cid:75) `K .Coalesced sums are coproducts in ω - aBC K ! , and we define the interpretation using a coalescedsum to make this structure evident. Explicitly, its elements are K and p k, r a k sq for k P L and a k P (cid:74) A k (cid:75) ` . The client does not know a priori which branch it will take: it must be ready tosend negative information for every possible branch. This justifies Equation (31). (cid:74) Ξ $ ‘t l : A l u l P L type s (cid:75) ´ “ ź l P L (cid:74) Ξ $ A l type s (cid:75) ´ (31) (cid:74) Ξ $ ‘t l : A l u l P L type s (cid:75) ` “ à l P L (cid:74) Ξ $ A l type s (cid:75) `K (32)To interpret ( ‘ R k ), we extract from a ´ the negative information a ´ k required by thecontinuation process P . Output on a ` is the label k followed by the output of P on a ` : (cid:74) Ψ ; ∆ $ a.k ; P :: a : ‘t l : A l u l P L (cid:75) u ` δ ` , ` a ´ l ˘ l P L ˘ “ ` δ ´ , ` k, “ a ` k ‰˘˘ where (cid:74) Ψ ; ∆ $ P :: a : A k (cid:75) u ` δ ` , a ´ k ˘ “ ` δ ´ , a ` k ˘ . (33)The client case a t l ñ P l u l P L blocks until it receives a communication p k, “ a ` k ‰ q on a ` ,and then it takes the branch P k . To transmit P k ’s output a ´ k on a ´ back to the provider, we . Kavanagh 11 place a ´ k in the k component of the product sent on a ´ . The other branches were not takenand produced no communication, so their respective components in a ´ are filled with K . (cid:74) Ψ ; ∆ , a : ‘t l : A l u l P L $ case a t l ñ P l u l P L :: c : C (cid:75) u “ strict a ` ` λ ` δ ` , a ` : ` k, “ a ` k ‰˘ , c ´ ˘ . ` δ ´ , a ´ : ` k : a ´ k , l ‰ k : K ˘ l P L , c ` ˘˘ where (cid:74) Ψ ; ∆ , a : A k $ P k :: c : C (cid:75) u p δ ` , a ` k , c ´ q “ p δ ´ , a ´ k , c ` q (34) § Proposition 11.
Let k P L . If Ψ ; ∆ $ P :: a : A k , and Ψ ; a : A l , ∆ $ Q l :: c : C for all l P L , then a Ð P ; Q k ” a Ð p a.k ; P q ; p case a t l ñ Q l u l P L q . § Example 12.
We build on Example 10. External choices & t l : A l u l P L are the polar dualsof internal choices. Let A “ & t j : Ò , k : Ò u . A provider of A receives a label and asynchronizing shift before closing the channel. The elements p l, rrKssq P (cid:74) A (cid:75) ´ correspondto receiving the label l over a followed by a shift, while the elements p l, rKsq correspond toreceiving l but no shift. The communication on a ` depends on the label l received: the closemessage is in the l component of the output on a ` . (cid:74) ¨ ; ¨ $ case a t l ñ shift Ð recv a ; close a u l Pt j , k u :: a : A (cid:75) Kp a ´ : α q“ $’’&’’% p a ` : p j : ˚ , k : Kqq if α “ p j , rrKssqp a ` : p j : K , k : ˚qq if α “ p k , rrKssqp a ` : p j : K , k : Kqq if α “ p l, rKsq for l P t j , k u or if α “ K The substitution property (Proposition 16) forces the denotation of the variable rule (
CVar ): (cid:74) Ξ , α type p s $ α type p s (cid:75) q “ π Ξ ,αα p q P t´ , `uq (35)We interpret recursive types by parametrized solutions of recursive domain equations.Every locally continuous functor G : ω - aBC K ! Ñ ω - aBC K ! has a canonical fixed point FIX p G q in ω - aBC K ! . Given a locally continuous functor F : (cid:74) Ξ (cid:75) ˆ ω - aBC K ! Ñ ω - aBC K ! , themapping D ÞÑ FIX p F p D, ´qq extends to a locally continuous functor F : : (cid:74) Ξ (cid:75) Ñ ω - aBC K ! [5,Proposition 5.2.7]. The fixed-point property F p D, F : D q – F : D is witnessed by a canonicalnatural isomorphism Fold : F ˝ x id (cid:74) Ξ (cid:75) , F : y ñ F : with inverse Unfold . The rule ( C ρ ) denotes: (cid:74) Ξ $ ρα.A type s (cid:75) p “ p (cid:74) Ξ , α type s $ A type s (cid:75) p q : p p P t´ , `uq (36)Let Fold p : (cid:74) Ξ , α type s $ A type s (cid:75) p ˝ x id (cid:74) Ξ (cid:75) , p (cid:74) Ξ , α type s $ A type s (cid:75) p q : y ñ (cid:74) Ξ $ ρα.A type s (cid:75) p be the canonical natural isomorphism and let Unfold p be its inverse. These isomorphismscapture the semantic folding and unfolding of recursive types. Indeed, by Proposition 16and Equations (35) and (36), the domain of Fold p is: (cid:74) Ξ , α type s $ A type s (cid:75) p ˝ A id (cid:74) Ξ (cid:75) , p (cid:74) Ξ $ ρα.A type s (cid:75) p q : E “ (cid:74) Ξ $ r ρα.A { α s A type s (cid:75) p . Processes unfold recursive types by transmitting unfold messages. Semantically, thisdenotes pre- and post-composition with
Fold p and Unfold p . We interpret ( ρ ` R ) and ( ρ ` L ) by: (cid:74) Ψ ; ∆ $ send a unfold ; P :: a : ρα.A (cid:75) u “ ` id ˆ ` a ` : Fold ` ˘˘ ˝ (cid:74) Ψ ; ∆ $ P :: a : r ρα.A { α s A (cid:75) u ˝ ` id ˆ ` a ´ : Unfold ´ ˘˘ , (37) (cid:74) Ψ ; ∆ , a : ρα.A $ unfold Ð recv a ; P :: c : C (cid:75) u “ ` id ˆ ` a ´ : Fold ´ ˘˘ ˝ (cid:74) Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C (cid:75) u ˝ ` id ˆ ` a ` : Unfold ` ˘˘ . (38) § Proposition 13. If Ψ ; ∆ $ P :: a : r ρα.A { α s A and Ψ ; a : r ρα.A { α s A, ∆ $ Q :: c : C ,then a Ð P ; Q ” a Ð p send a unfold ; P q ; p unfold Ð recv a ; Q q . Our semantics respects the exchange rule because we interpret structural contexts as in-dexed products. It also respects weakening (Propositions 14 and 15) and substitution(Propositions 16 and 17). These propositions follow by induction on the derivations. § Proposition 14 (Coherence of Session Types) . If Ξ $ A type q s , then (cid:74) Ξ , Θ $ A type q s (cid:75) “ (cid:74) Ξ $ A type q s (cid:75) p π Ξ , ΘΞ for all p P t´ , `u . § Proposition 15 (Coherence of Terms and Processes) . If Ψ , M : τ , then (cid:74) Φ , Ψ , M : τ (cid:75) “ (cid:74) Ψ , M : τ (cid:75) ˝ π Φ , ΨΨ . If Ψ ; ∆ $ P :: a : A , then (cid:74) Φ , Ψ ; ∆ $ P :: a : A (cid:75) “ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) ˝ π Φ , ΨΨ . § Proposition 16 (Semantic Substitution of Session Types) . Let Ξ “ α type p s , . . . , α n type p n s .For all p P t´ , `u and all choices of types Θ $ A i type p i s ( ď i ď n ), if Ξ $ B type q s , then (cid:74) Θ $ r ~A { ~α s B type q s (cid:75) p “ (cid:74) Ξ $ B type q s (cid:75) p ˝ x (cid:74) Θ $ A i type p i s (cid:75) p | ď i ď n y . § Proposition 17 (Semantic Substitution of Functional Terms) . Let Ψ “ x : τ , . . . , x n : τ n .For all choices of terms Φ , M i : τ i ( ď i ď n ), if Ψ , N : τ and Ψ ; ∆ $ P :: c : C , then (cid:74) Φ , r ~M { ~x s N : τ (cid:75) “ (cid:74) Ψ , N : τ (cid:75) ˝ x (cid:74) Φ , M i : τ i (cid:75) | ď i ď n y , (cid:74) Φ ; ∆ $ r ~M { ~x s P :: c : C (cid:75) “ (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) ˝ x (cid:74) Φ , M i : τ i (cid:75) | ď i ď n y . We illustrate our semantics by studying the recursive bit-flipping process from the introduction.We will show that flipping the bits in a stream twice is equivalent to forwarding it. The bitstream protocol is specified by the session type bits “ ρβ. ‘ t : β, : β u . It denotes thedomains (cid:74) bits (cid:75) ` “ FIX p X ÞÑ pp : X K q ‘ p : X K qqq and (cid:74) bits (cid:75) ´ “ tKu . Its unfolding is BITS “ ‘t : bits , : bits u . There are canonical isomorphisms Unfold ` : (cid:74) bits (cid:75) ` Ñ `` : (cid:74) bits (cid:75) `K ˘ ‘ ` : (cid:74) bits (cid:75) `K ˘˘ Unfold ´ : tKu Ñ tp : K , : Kqu with respective inverses
Fold ` and Fold ´ . Write :: α and :: α for Fold ` pp , r α sqq and Fold ` pp , r α sqq , respectively.We desugar the bit-flipping process. Write ˜ l for the complement of l P t , u . Desugaringthe quoted process gives a term ¨ , flip : t f : bits Ð b : bits u where flip is: fix F.f Ð (cid:32) send f unfold ; unfold Ð recv b ; case b t l ñ f. ˜ l ; f Ð t F u Ð b u l Pt , u ( Ð b. Its denotation is (cid:74) ¨ , flip : t a : bits Ð b : bits u (cid:75) K “ up p fix p Φ qq where the function Φ : (cid:74) b : bits $ a : bits (cid:75) Ñ (cid:74) b : bits $ a : bits (cid:75) is given by:Φ p r q “ strict b ` ¨˚˚˝ λ p b ` , Kq . K , :: a ` ˘ if b ` “ :: b ` ` K , :: a ` ˘ if b ` “ :: b ` where r p b ` l , Kq “ pK , a ` l q for l P L ˛‹‹‚ Consider the composition ¨ ; a : bits $ t Ð t flip u Ð a ; b Ð t flip u Ð t :: b : bits oftwo bit-flipping processes. By the Knaster-Tarski-style formulation of the trace operator, (cid:74) ¨ ; a : bits $ t Ð t flip u Ð a ; b Ð t flip u Ð t :: b : bits (cid:75) K “ fix p Φ q ˝ σ ˝ fix p Φ q where σ is . Kavanagh 13 the obvious relabelling. We want to show that the composition is equivalent to forwarding.By Equation (17), this means showing for all p a ` , Kq P (cid:74) a : bits (cid:75) ` ˆ (cid:74) b : bits (cid:75) ´ that: (cid:74) ¨ ; a : bits $ t Ð t flip u Ð a ; b Ð t flip u Ð t :: b : bits (cid:75) Kp a ` , Kq “ pK , a ` q . (39)Given an a P (cid:74) bits (cid:75) ` , let a be given by p fix p Φ q ˝ σ ˝ fix p Φ qq p a, Kq “ pK , a q . It is easyto check that K “ K , p :: α q “ :: α , and p :: α q “ :: α for all α P (cid:74) bits (cid:75) ` .To show Equation (39), we must show that a “ a for all a P (cid:74) bits (cid:75) ` . We use acoinduction principle by Pitts [37]. Given a relation R on (cid:74) bits (cid:75) `K , let ˆ R be the relation on (cid:74) BITS (cid:75) `K where a ˆ R b if and only if for all α P (cid:74) bits (cid:75) ` :if a “ rp , r α sqs , then b “ rp , r β sqs for some β P (cid:74) bits (cid:75) ` with r α s R r β s ;if a “ rp , r α sqs , then b “ rp , r β sqs for some β P (cid:74) bits (cid:75) ` with r α s R r β s .The relation R is a simulation if a R b implies Unfold `K p a q ˆ R Unfold `K p b q . By [37, The-orem 2.5], a Ď b in (cid:74) bits (cid:75) `K if and only if there exists a simulation R such that a R b .Let R “ tprKs , rKsq , pr :: α s , r :: α sq , pr :: α s , r :: α sq | α P (cid:74) bits (cid:75) ` u Ď (cid:74) bits (cid:75) `K ˆ (cid:74) bits (cid:75) `K .A case analysis shows that R is a simulation. To show that a Ď a for a P (cid:74) bits (cid:75) ` , it issufficient to show that r a s R r a s . If a “ K , then a “ K by strictness. If a “ :: α , then a “ :: α . If a “ :: α , then a “ :: α . In all cases, r a s R r a s by definition of R . It followsthat a Ď a . The relation R is clearly a simulation if and only if R op is a simulation, so a R op a and a Ď a . We conclude a “ a as desired. It follows that flipping a stream twiceis equivalent to forwarding (the identity process). Honda [27] and Takeuchi et al. [46] introduced session types to describe sessions of interaction.Caires and Pfenning [15] observed a proofs-as-programs correspondence between the session-typed π -calculus and intuitionistic linear logic, where the ( Cut ) rule captures processcommunication. Toninho et al. [49] built on this correspondence and introduced SILL’smonadic integration between functional and synchronous message-passing programming.They specified SILL’s operational behaviour using a substructural operational semantics(SSOS). Gay and Vasconcelos [21] introduced asynchronous communication for session-typed languages. They used an operational semantics and buffers to model asynchronicity.Pfenning and Griffith [36] observed that the polarity of a type determines the directionof communication along a channel. They observed that synchronous communication canbe encoded in an asynchronous setting using explicit shift operators. Polarized SILL’soperational behaviour is specified by a SSOS [49, 36]. In ongoing work, we seek to show thatour denotational semantics agrees with this SSOS. Concretely, we extend this SSOS to givepolarized SILL an operational notion of observation. Then, we seek to show that processesare denotationally equivalent if and only if they are observationally equivalent.Wadler [50] introduced “Classical Processes” (CP), a proofs-as-programs interpretationof classical linear logic that builds on the ideas of Caires and Pfenning [15]. CP supportsreplication but not recursion. Though CP does not natively support functional programming,Wadler gives a translation for GV, a linear functional language with pairs but no recursion,into CP. In contrast, polarized SILL uniformly integrates functional programming andmessage-passing concurrency. CP has a synchronous communication semantics and does nothave an explicit treatment of polarities. Polarized SILL has an asynchronous communicationsemantics, and synchronous communication is encoded using polarity shifts.
Atkey [6] gave a denotational semantics for CP, where types are interpreted as sets andprocesses are interpreted as relations over these. Because processes in CP are proof terms forclassical linear logic, the interpretation of processes is identical to the relational semanticsof proofs in classical linear logic [7]. Our jump from sets and relations to domains andcontinuous functions was motivated by two factors. First, domains provide a natural settingfor studying recursion. Second, we believe that monotonicity and continuity are essentialproperties for a semantics of processes with infinite data, and it is unclear how to capturethese properties in a relational setting. Atkey interpreted process composition as relationalcomposition. Our use of traces is more complex, but we believe that known trace identitiesmake it tractable. We believe that the extra complexity is justified by SILL’s more complexbehavioural phenomena.Our semantics generalizes Kahn’s stream-based semantics for deterministic networks [29].A deterministic network is graph whose nodes are deterministic processes, and whose edgesare unidirectional channels. Each channel carries values of a single fixed simple type,e.g., integers or booleans. Semantically, channels denote domains of sequences of values,and processes denote continuous functions from input channels to output channels. Oursemantics generalizes this to allow for bidirectional, session-typed communication channels.Satisfactorily generalizing Kahn-style semantics to handle non-determinism is difficult [13,31, 34, 35, 43, 44], partly due to the Keller [30] and Brock-Ackerman anomalies [11].Our process interpretations exist within a “wave”-style [2] geometry of interaction (GoI)construction [4, Definition 2.6]. Indeed, the objects of the GoI construction G p ω - aBC q arepairs p A ` , A ´ q of objects A ` and A ´ of ω - aBC . Morphisms f : p A ` , A ´ q Ñ p B ` , B ´ q of G p ω - aBC q are morphisms ˆ f : A ` ˆ B ´ Ñ A ´ ˆ B ` of ω - aBC . Given a morphism g : p B ` , B ´ q Ñ p C ` , C ´ q , the composition g ˝ f is defined by Tr B ´ ˆ B ` A ` ˆ C ´ ,A ´ ˆ C ` p ˆ g ˆ ˆ f q .Equation (18) is exactly the composition (cid:74) Ψ ; a : A, ∆ $ Q :: c : C (cid:75) u ˝ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u in G p ω - aBC q . Though the categorical setting is identical, our goals and approach aredifferent from prior work using the geometry of interaction. For example, Abramsky andJagadeesan [1] give a type-free interpretation of classical linear logic where all types denotethe same “universal domain” [1, p. 69]. Abramsky et al. [4] use GoI constructions to give analgebraic framework for Girard’s Geometry of Interactions [22, 23, 24]. We instead give asemantics that captures the computational aspects of a programming language with recursion.Castellan and Yoshida [16] gave a game semantics interpretation of the session π -calculuswith recursion. It is fully abstract relative to a barbed congruence notion of behaviouralequivalence. Session types denote event structures that encode games and that are endowedwith an ω -cpo structure. Open types denote continuous maps between these and recursivetypes denote least fixed points. Open processes are interpreted as continuous maps thatdescribe strategies. We conjecture that our semantics could be related via barbed congruence.Kokke et al. [32] introduced “hypersequent classical processes” (HCP). HCP is a revisedproofs-as-processes interpretation between classical linear logic and the π -calculus. Buildingon Atkey’s [6] semantics for CP, they gave HCP a denotational semantics using Brzozowskiderivatives [14]. Their semantics is fully abstract relative to their notions of bisimilarity andbarbed congruence. It is unclear how to extend their semantics to handle recursion. Acknowledgments
This work is funded in part by a Natural Sciences and Engineering Research Council ofCanada Postgraduate Scholarship. The author thanks anonymous referees, Robert Atkey,Stephen Brookes, and Frank Pfenning for their comments. . Kavanagh 15
References S. Abramsky and R. Jagadeesan. New foundations for the geometry of interaction.
Informationand Computation , 111(1):53–119, May 1994. doi:10.1006/inco.1994.1041 . Samson Abramsky. Retracing some paths in process algebra. In Ugo Montanari and VladimiroSassone, editors,
Concur ’96 : 7th International Conference on Concurrency Theory , number1119 in Lecture Notes in Computer Science. Springer-Verlag Berlin Heidelberg, 1996. doi:10.1007/3-540-61604-7 . Samson Abramsky, Simon J. Gay, and Rajagopal Nagarajan. Interaction categories and thefoundation of typed concurrent programming. In Manfred Broy, editor,
Deductive ProgramDesign , pages 35–113. Springer-Verlag Berlin Heidelberg, 1996. Samson Abramsky, Esfandiar Haghverdi, and Philip Scott. Geometry of interaction and linearcombinatory algebras.
Mathematical Structures in Computer Science , 12(5):625–665, October2002. doi:10.1017/s0960129502003730 . Samson Abramsky and Achim Jung. Domain theory. In S. Abramsky, Dov M. Gabbay, andT. S. E. Maibaum, editors,
Semantic Structures , volume 3, pages 1–168. Oxford UniversityPress Inc., New York, 1995. Robert Atkey. Observed communication semantics for classical processes. In HongseokYang, editor,
Programming Languages and Systems , number 10201 in Lecture Notes inComputer Science, pages 56–82, Berlin, 2017. Springer Berlin Heidelberg. doi:10.1007/978-3-662-54434-1 . Michael Barr. ˚ -Autonomous categories and linear logic. Mathematical Structures in ComputerScience , 1(2):159–178, 1991. doi:10.1017/s0960129500001274 . Michael Barr and Charles Wells.
Category Theory for Computing Science . Les PublicationsCRM, 3 edition, 1999. Nick Benton and Martin Hyland. Traced premonoidal categories.
RAIRO - TheoreticalInformatics and Applications , 37(4):273–299, 2003. doi:10.1051/ita:2003020 . Stephen L. Bloom and Zoltán Ésik. Fixed-point operations on ccc’s. Part i.
TheoreticalComputer Science , 155(1):1–38, 1996. doi:10.1016/0304-3975(95)00010-0 . J. Dean Brock and William B. Ackerman. Scenarios: A model of non-determinate computation.In Josep Díaz and Isidro Ramos, editors,
Formalization of Programming Concepts , number107 in Lecture Notes in Computer Science, pages 252–259. Springer-Verlag Berlin Heidelberg,1981. doi:10.1007/3-540-10699-5_102 . Stephen D. Brookes, Andrew William Roscoe, and Glynn Winskel, editors.
Seminar onConcurrency , number 197 in Lecture Notes in Computer Science. Springer-Verlag BerlinHeidelberg. doi:10.1007/3-540-15670-4 . Manfred Broy. Nondeterministic data flow programs: How to avoid the merge anomaly.
Scienceof Computer Programming , 10(1):65–85, 1988. doi:10.1016/0167-6423(88)90016-0 . Janusz A. Brzozowski. Derivatives of regular expressions.
Journal of the ACM , 11(4):481–494,1964. doi:10.1145/321239.321249 . Luís Caires and Frank Pfenning. Session types as intuitionistic linear propositions. In PaulGastin and François Laroussinie, editors,
CONCUR 2010 — Concurrency Theory , number6269 in Lecture Notes in Computer Science, pages 222–236. Springer-Verlag Berlin Heidelberg,2010. doi:10.1007/978-3-642-15375-4_16 . Simon Castellan and Nobuko Yoshida. Two sides of the same coin: Session types and gamesemantics: A synchronous side and an asynchronous side.
Proc. ACM Program. Lang. ,3(POPL):27:1–27:29, January 2019. doi:10.1145/3290340 . Roy L. Crole.
Categories for Types . Cambridge University Press, Cambridge, United Kingdom,1993. Virgil Emil Căzănescu and Gheorghe Ştefănescu. Towards a new algebraic foundation offlowchart scheme theory.
Fundamenta Informaticae , 13(2):171–210, June 1990. Pavel Etingof, Shlomo Gelaki, Dmitri Nikshych, and Victor Ostrik.
Tensor Categories . Number2015 in Mathematical Surveys and Monographs. American Mathematical Society, 2015. Marcelo P. Fiore.
Axiomatic Domain Theory in Categories of Partial Maps . PhD thesis, TheUniversity of Edinburgh Department of Computer Science, October 1994. Simon J. Gay and Vasco T. Vasconcelos. Linear type theory for asynchronous session types.
Journal of Functional Programming , 20(1):19–50, 2009. doi:10.1017/s0956796809990268 . Jean-Yves Girard. Geometry of interation 1: Iterpretation of system F. In R. Ferro, C. Benotto,S. Valentini, and A. Zanardo, editors,
Logic Colloquium ’88 , number 127 in Series in Logic andFoundations of Mathematics, pages 221–260, Amsterdam, The Netherlands, 1989. Associationfor Symbolic Logic, Elsevier Science Publishers, B.V. Jean-Yves Girard. Geometry of interaction 2: Deadlock-free algorithms. In Per Martin-Löfand Grigori Mints, editors,
COLOG-88 , number 417 in Lecture Notes in Computer Science,pages 76–93. Springer-Verlag Berlin Heidelberg, 1990. doi:10.1007/3-540-52335-9 . Jean-Yves Girard. Geometry of interaction III: Accommodating the additives. In Jean-YvesGirard, Yves Lafont, and Laurent Regnier, editors,
Advances in Linear Logic , number 222in London Mathematical Society Lecture Note Series, pages 329–389. Cambridge UniversityPress, Cambridge, United Kingdom, 1995. doi:10.1017/CBO9780511629150.017 . Carl A. Gunter.
Semantics of Programming Languages . The MIT Press, Cambridge, Mas-sachusetts, 1992. Masahito Hasegawa.
Recursion from Cyclic Sharing , chapter 7, pages 83–101. Distinguished Dis-sertations. Springer-Verlag London Limited, June 1999. doi:10.1007/978-1-4471-0865-8_7 . Kohei Honda. Types for dyadic interaction. In Eike Best, editor,
CONCUR’93 , number 715in Lecture Notes in Computer Science, pages 509–523, Berlin, 1993. Springer-Verlag BerlinHeidelberg. doi:10.1007/3-540-57208-2_35 . André Joyal, Ross Street, and Dominic Verity. Traced monoidal categories.
MathematicalProceedings of the Cambridge Philosophical Society , 119(3):447–468, April 1996. doi:10.1017/s0305004100074338 . Gilles Kahn. The semantics of a simple language for parallel programming. In
InformationProcessing 74 , pages 471–475. North-Holland Publishing Company, 1974. Robert M. Keller. Denotational models for parallel programs with indeterminate operators.Technical Report UUCS-77-103, School of Computing, University of Utah, 1977. Robert M. Keller and Prakash Panangaden. Semantics of networks containing indeterminateoperators. In Brookes et al. [12], pages 479–596. doi:10.1007/3-540-15670-4_23 . Wen Kokke, Fabrizio Montesi, and Marco Peressotti. Better late than never: A fully-abstractsemantics for classical processes.
Proc. ACM Program. Lang. , 3(POPL):24:1–24:29, January2019. doi:10.1145/3290337 . Robin Milner.
A Calculus of Communicating Systems . Number 92 in Lecture Notes inComputer Science. Springer-Verlag Berlin Heidelberg, 1980. doi:10.1007/3-540-10235-3 . Prakash Panangaden. Abstract interpretation and indeterminacy. In Brookes et al. [12], pages495–511. doi:10.1007/3-540-15670-4_24 . Prakash Panangaden and Vasant Shanbhogue. The expressive power of indeterminate dataflowprimitives.
Information and Computation , 98(1):99–131, 1992. doi:10.1016/0890-5401(92)90043-F . Frank Pfenning and Dennis Griffith. Polarized substructural session types. In Andrew Pitts,editor,
Foundations of Software Science and Computation Structures , number 9034 in LectureNotes in Computer Science, pages 3–32, Berlin Heidelberg, 2015. Springer-Verlag GmbH BerlinHeidelberg. doi:10.1007/978-3-662-46678-0_1 . Andrew M Pitts. A co-induction principle for recursively defined domains.
TheoreticalComputer Science , 124(2):195–219, February 1994. doi:10.1016/0304-3975(94)90014-0 . Jorge A. Pérez, Luís Caires, Frank Pfenning, and Bernardo Toninho. Linear logical relationsfor session-based concurrency. In Helmut Seidl, editor,
Programming Languages and Systems ,number 7211 in Lecture Notes in Computer Science, pages 539–558, Heidelberg, 2012. Springer-Verlag Berlin Heidelberg. doi:10.1007/978-3-642-28869-2_27 . . Kavanagh 17 Jorge A. Pérez, Luís Caires, Frank Pfenning, and Bernardo Toninho. Linear logical relationsand observational equivalences for session-based concurrency.
Information and Computation ,239:254–302, 2014. doi:10.1016/j.ic.2014.08.001 . John C. Reynolds.
Theories of Programming Languages . Cambridge University Press, NewYork, New York, 2009. Horst Schubert.
Categories . Springer-Verlag Berlin Heidelberg, 1972. doi:10.1007/978-3-642-65364-3 . Alex Simpson and Gordon Plotkin. Complete axioms for categorical fixed-point operators. In , pages 30–41. IEEE ComputerSociety Technical Committee on Mathematical Foundations of Computing, IEEE ComputerSociety, 2000. doi:10.1109/LICS.2000.855753 . Eugene W. Stark. Concurrent transition system semantics of process networks. In
POPL’87:14th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages , pages 199–210. ACM SIGPLAN, Association for Computing Machinery, 1987. doi:10.1145/41625.41643 . Eugene W. Stark. A simple generalization of Kahn’s principle to indeterminate dataflownetworks. Workshops in Computing, pages 157–174. Springer-Verlag Berlin Heidelberg, 1990. doi:10.1007/978-1-4471-3860-0_10 . Joseph E. Stoy.
Denotational Semantics: The Scott-Strachey Approach to ProgrammingLanguage Theory . MIT Press Series in Computer Science. The MIT Press, Cambridge,Massachusetts, 1977. Kaku Takeuchi, Kohei Honda, and Makoto Kubo. An interaction-based language and itstyping system. In Costas Halatsis, Dimitrios Maritsas, George Philokyprou, and SergiosTheodoridis, editors,
PARLE’94 , number 10201 in Lecture Notes in Computer Science, pages398–413, Berlin, 1994. Springer-Verlag Berlin Heidelberg. doi:10.1007/3-540-58184-7_118 . R. D. Tennent. Denotational semantics. In S. Abramsky, Dov M. Gabbay, and T. S. E.Maibaum, editors,
Semantic Structures , volume 3, pages 169–322. Oxford University PressInc., New York, 1995. Bernardo Toninho.
A Logical Foundation for Session-based Concurrent Computation . PhDthesis, Universidade Nova de Lisboa, 2015. Bernardo Toninho, Luis Caires, and Frank Pfenning. Higher-order processes, functions, andsessions: A monadic integration. In Matthias Felleisen and Philippa Gardner, editors,
Program-ming Languages and Systems , number 7792 in Lecture Notes in Computer Science, pages 350–369, Berlin, Heidelberg, 2013. Springer Berlin Heidelberg. doi:10.1007/978-3-642-37036-6_20 . Philip Wadler. Propositions as sessions.
Journal of Functional Programming , 24(2-3):384–418,2014. doi:10.1017/s095679681400001x . A Rules for Polarized SILL
For ease of reference, we collect all of the rules for polarized SILL in this appendix.
A.1 Rules for Term Formation
Ψ ; a i : A i $ P :: a : A Ψ , a Ð t P u Ð a i : t a : A Ð a i : A i u p I-{} q Ψ , x : τ , x : τ p F-Var q Ψ , x : τ , M : τ Ψ , fix x.M : τ p F-Fix q Ψ , x : τ , M : σ Ψ , λx : τ.M : τ Ñ σ p F-Fun q Ψ , M : τ Ñ σ Ψ , N : τ Ψ , M N : σ p F-App q A.2 Rules for Process Formation
Ψ ; a : A $ b Ð a :: b : A p Fwd q Ψ ; ∆ $ P :: a : A Ψ ; a : A, ∆ $ Q :: c : C Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C p Cut q Ψ ; ¨ $ close a :: a : p R q Ψ ; ∆ $ P :: c : C Ψ ; ∆ , a : $ wait a ; P :: c : C p L q Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ send a shift ; P :: a : Ó A pÓ R q Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : Ó A $ shift Ð recv a ; P :: c : C pÓ L q Ψ ; ∆ $ P :: a :Ψ ; ∆ $ shift Ð recv a ; P :: a : Ò A pÒ R q Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : Ò A $ send a shift ; P :: c : C pÒ L q Ψ ; ∆ $ P :: a : A k p k P L q Ψ ; ∆ $ a.k ; P :: a : ‘t l : A l u l P L p‘ R k q Ψ ; ∆ , a : A l $ P l :: c : C p@ l P L q Ψ ; ∆ , a : ‘t l : A l u l P L $ case a t l l ñ P l u i P I :: c : C p‘ L q Ψ ; ∆ $ P l :: a : A l p@ l P L q Ψ ; ∆ $ case a t l ñ P l u l P L :: a : & t l : A l u l P L p & R q Ψ ; ∆ , a : A k $ P :: c : C p k P L q Ψ ; ∆ , a : & t l : A l u l P L $ a.k ; P :: c : C p & L k q Ψ ; ∆ $ P :: a : A Ψ ; ∆ , b : B $ send a b ; P :: a : B b A pb R ˚ q Ψ ; ∆ , a : A, b : B $ P :: c : C Ψ ; ∆ , a : B b A $ b Ð recv a ; P :: c : C pb L q Ψ ; ∆ , b : B $ P :: a : A Ψ ; ∆ $ b Ð recv a ; P :: a : B (cid:40) A p (cid:40) R q Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , b : B, a : B (cid:40) A $ send a b ; P :: c : C p (cid:40) L q Ψ , M : τ Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A p^ R q Ψ , x : τ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : τ ^ A $ x Ð input a ; P :: c : C p^ L q Ψ , x : τ ; ∆ $ P :: a : A Ψ ; ∆ $ x Ð input a ; P :: a : τ Ą A pĄ R q Ψ , M : τ Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : τ Ą A $ _ Ð output a M ; P :: c : C pĄ L q Ψ ; ∆ $ P :: a : r ρα.A { α s A ¨ $ ρα.A type ` s Ψ ; ∆ $ send a unfold ; P :: a : ρα.A p ρ ` R q Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C ¨ $ ρα.A type ` s Ψ ; ∆ , a : ρα.A $ unfold Ð recv a ; P :: c : C p ρ ` L q Ψ ; ∆ $ P :: a : r ρα.A { α s A ¨ $ ρα.A type ´ s Ψ ; ∆ $ unfold Ð recv a ; P :: a : ρα.A p ρ ´ R q Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C ¨ $ ρα.A type ´ s Ψ ; ∆ , a : ρα.A $ send a unfold ; P :: c : C p ρ ´ L q Ψ , M : t a : A Ð a i : A i u Ψ ; a i : A i $ a Ð t M u Ð a i :: a : A p E-{} q A.3 Rules for Type Formation Ξ $ type ` s p C q Ξ , α type p s $ α type p s p CVar q Ξ , α type p s $ A type p s Ξ $ ρα.A type p s p C ρ q Ξ $ A type ´ s Ξ $ Ó A type ` s p C Óq Ξ $ A type ` s Ξ $ Ò A type ´ s p C Òq Ξ $ A l type ` s p@ l P L q Ξ $ ‘t l : A l u l P L type ` s p C ‘q Ξ $ A l type ´ s p@ l P L q Ξ $ & t l : A l u l P L type ´ s p C & q Ξ $ A type ` s Ξ $ B type ` s Ξ $ A b B type ` s p C bq Ξ $ A type ` s Ξ $ B type ´ s Ξ $ A (cid:40) B type ´ s p C (cid:40) q τ type f Ξ $ A type ` s Ξ $ τ ^ A type ` s p C ^q τ type f Ξ $ A type ´ s Ξ $ τ Ą A type ´ s p C Ąq¨ $ A i type s p ď i ď n qt a : A Ð a : A , . . . , a n : A n u type f p T{} q τ type f σ type f τ Ñ σ type f p T Ñq . Kavanagh 19 B Summary of Interpretations
For ease of reference, we give all of the semantic clauses (including omitted clauses).
B.1 Clauses for Term Formation (Appendix A.1)
Rule (I-{}).
Equation (11): (cid:74) Ψ , a Ð t P u Ð a i : t a : A Ð a i : A i u (cid:75) “ up ˝ (cid:74) Ψ ; a i : A i $ P :: a : A (cid:75) Rule (F-Var).
Equation (6): (cid:74) Ψ , x : τ , x : τ (cid:75) u “ π Ψ ,xx u Rule (F-Fix).
Equation (9): (cid:74) Ψ , fix x.M : τ (cid:75) u “ (cid:74) Ψ , x : τ , M : τ (cid:75) : u Rule (F-Fun).
Equation (7): (cid:74) Ψ , λx : τ.M : τ Ñ σ (cid:75) u “ strict p λv P (cid:74) τ (cid:75) . (cid:74) Ψ , x : τ , M : σ (cid:75) r u | x ÞÑ v sq Rule (F-App).
Equation (8): (cid:74) Ψ , M N : σ (cid:75) u “ (cid:74) Ψ , M : τ Ñ σ (cid:75) u p (cid:74) Ψ , N : τ (cid:75) u q B.2 Clauses for Process Formation (Appendix A.2)
Rule (Fwd).
Equation (17): (cid:74)
Ψ ; a : A $ b Ð a :: b : A (cid:75) u p a ` : α, b ´ : β q “ p a ´ : β, b ` : α q Rule (Cut).
Equation (18): (cid:74)
Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) u “ Tr a ´ ˆ a ` p (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u ˆ (cid:74) Ψ ; a : A, ∆ $ Q :: c : C (cid:75) u q Rule ( R ). Equation (21): (cid:74)
Ψ ; ¨ $ close a :: a : (cid:75) u p a ´ : Kq “ p a ` : ˚q Rule ( L ). Equation (22): (cid:74)
Ψ ; ∆ , a : $ wait a ; P :: c : C (cid:75) u “ strict a ` ` λ p δ ` , a ` , c ´ q . p δ ´ , K , c ` q ˘ where (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) u p δ ` , c ´ q “ p δ ´ , c ` q Rule ( Ó R ). Equation (29): (cid:74)
Ψ ; ∆ $ send a shift ; P :: a : Ó A (cid:75) u “ ` id ˆ ` a ` : up ˘˘ ˝ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u Rule ( Ó L ). Equation (30): (cid:74)
Ψ ; ∆ , a : Ó A $ shift Ð recv a ; P :: c : C (cid:75) u “ strict a ` ` (cid:74) Ψ ; ∆ , a : A $ P :: c : C (cid:75) u ˝ ` id ˆ ` a ` : down ˘˘˘ Rule ( Ò R ). Omitted. (cid:74)
Ψ ; ∆ $ shift Ð recv a ; P :: a : Ò A (cid:75) u “ strict a ´ ` (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u ˝ ` id ˆ ` a ´ : down ˘˘˘ (40) Rule ( Ò L ). Omitted. (cid:74)
Ψ ; ∆ , a : Ò A $ send a shift ; P :: c : C (cid:75) u “ ` id ˆ ` a ´ : up ˘˘ ˝ (cid:74) Ψ ; ∆ , a : A $ P :: c : C (cid:75) u (41) Rule ( ‘ R k ). Equation (33): (cid:74)
Ψ ; ∆ $ a.k ; P :: a : ‘t l : A l u l P L (cid:75) u ` δ ` , ` a ´ l ˘ l P L ˘ “ ` δ ´ , ` k, “ a ` k ‰˘˘ where (cid:74) Ψ ; ∆ $ P :: a : A k (cid:75) u ` δ ` , a ´ k ˘ “ ` δ ´ , a ` k ˘ Rule ( ‘ L ). Equation (34): (cid:74)
Ψ ; ∆ , a : ‘t l : A l u l P L $ case a t l ñ P l u l P L :: c : C (cid:75) u “ strict a ` ` λ ` δ ` , a ` : ` k, “ a ` k ‰˘ , c ´ ˘ . ` δ ´ , a ´ : ` k : a ´ k , l ‰ k : K ˘ l P L , c ` ˘˘ where (cid:74) Ψ ; ∆ , a : A k $ P k :: c : C (cid:75) u p δ ` , a ` k , c ´ q “ p δ ´ , a ´ k , c ` q Rule ( & R ). Omitted. (cid:74)
Ψ ; ∆ $ case a t l ñ P l u l P L :: a : & t l : A l u l P L (cid:75) u “ strict a ´ ` λ ` δ ` , a ´ : ` k, “ a ´ k ‰˘˘ . ` δ ´ , a ` : ` k : a ` k , l ‰ k : K ˘ l P L ˘˘ where (cid:74) Ψ ; ∆ $ P k :: a : A k (cid:75) u p δ ` , a ´ k q “ p δ ´ , a ` k q (42) Rule ( & L k ). Omitted. (cid:74)
Ψ ; ∆ , a : & t l : A l u l P L $ a.k ; P :: c : C (cid:75) u ` δ ` , ` a ` l ˘ l P L , c ´ ˘ “ ` δ ´ , ` k, “ a ´ k ‰˘ , c ` ˘ where (cid:74) Ψ ; ∆ , a : A k $ P :: c : C (cid:75) u ` δ ` , a ` k , c ´ ˘ “ ` δ ´ , a ´ k , c ` ˘ (43) Rule ( b R ˚ ). Equation (25): (cid:74)
Ψ ; ∆ , b : B $ send a b ; P :: a : B b A (cid:75) u p δ ` , b ` , p a ´ B , a ´ A qq “ ` δ ´ , a ´ B , “` b ` , a ` A ˘‰˘ where (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , a ´ A q “ p δ ´ , a ` A q Rule ( b L ). Equation (26): (cid:74)
Ψ ; ∆ , a : B b A $ b Ð recv a ; Q :: c : C (cid:75) u p δ ` , a ` , c ´ q“ strict a ` ` λ p δ ` , a ` : “ p a ` B , a ` A q ‰ , c ´ q . p δ ´ , p b ´ , a ´ q , c ` q ˘ where (cid:74) Ψ ; ∆ , a : A, b : B $ Q :: c : C (cid:75) u p δ ` , a ` A , a ` B , c ´ q “ p δ ´ , a ´ , b ´ , c ` q Rule ( (cid:40) R ). Omitted. (cid:74)
Ψ ; ∆ $ b Ð recv a ; P :: a : B (cid:40) A (cid:75) u p δ ` , a ´ q“ strict a ´ ` λ p δ ` , a ´ : “ p a ` B , a ´ A q ‰ q . p δ ` , p b ´ , a ` qq ˘ where (cid:74) Ψ ; ∆ , b : B $ P :: a : A (cid:75) u p δ ` , a ` B , a ´ A q “ p δ ´ , b ´ , a ` q (44) Rule ( (cid:40) L ). Omitted. (cid:74)
Ψ ; ∆ , b : B, a : B (cid:40) A $ send a b ; P :: c : C (cid:75) u p δ ` , b ` , p a ´ B , a ` A q , c ´ q“ ` δ ´ , a ´ B , “` b ` , a ´ A ˘‰ , c ` ˘ where (cid:74) Ψ ; ∆ , a : A $ P :: c : C (cid:75) u p δ ` , a ` A , c ´ q “ p δ ´ , a ´ A , c ` q (45) . Kavanagh 21 Rule ( ^ R ). Equation (15): (cid:74)
Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A (cid:75) u p δ ` , a ´ q“ K if (cid:74) Ψ , M : τ (cid:75) u “ Kp δ ´ , rp v, a ` qsq if (cid:74) Ψ , M : τ (cid:75) u “ v ‰ K where (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , a ´ q “ p δ ´ , a ` q Rule ( ^ L ). Equation (16): (cid:74)
Ψ ; ∆ , a : τ ^ A $ x Ð input a ; P :: c : C (cid:75) u “ strict a ` ` λ ` δ ` , a ` : “` v, α ` ˘‰ , c ´ ˘ . (cid:74) Ψ , x : τ ; ∆ , a : A $ P :: c : C (cid:75) r u | x ÞÑ v sp δ ` , α ` , c ´ q ˘ Rule ( Ą R ). Omitted. (cid:74)
Ψ ; ∆ $ x Ð input a ; P :: a : τ Ą A (cid:75) u “ strict a ´ ` λ ` δ ` , a ´ : “` v, α ´ ˘‰˘ . (cid:74) Ψ , x : τ ; ∆ $ P :: a : A (cid:75) r u | x ÞÑ v sp δ ` , α ´ q ˘ (46) Rule ( Ą L ). Omitted. (cid:74)
Ψ ; ∆ , a : τ Ą A $ _ Ð output a M ; P :: c : C (cid:75) u p δ ` , a ` , c ´ q“ K if (cid:74) Ψ , M : τ (cid:75) u “ Kp δ ´ , rp v, a ´ qs , c ` q if (cid:74) Ψ , M : τ (cid:75) u “ v ‰ K where (cid:74) Ψ ; ∆ , a : A $ P :: c : C (cid:75) u p δ ` , a ` , c ´ q “ p δ ´ , a ´ , c ` q (47) Rule ( ρ ` R ). Equation (37): (cid:74)
Ψ ; ∆ $ send a unfold ; P :: a : ρα.A (cid:75) u “ ` id ˆ ` a ` : Fold ˘˘ ˝ (cid:74) Ψ ; ∆ $ P :: a : r ρα.A { α s A (cid:75) u ˝ ` id ˆ ` a ´ : Unfold ˘˘ Rule ( ρ ` L ). Equation (38): (cid:74)
Ψ ; ∆ , a : ρα.A $ unfold Ð recv a ; P :: c : C (cid:75) u “ ` id ˆ ` a ´ : Fold ˘˘ ˝ (cid:74) Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C (cid:75) u ˝ ` id ˆ ` a ` : Unfold ˘˘ Rule ( ρ ´ R ). Omitted. (cid:74)
Ψ ; ∆ $ unfold Ð recv a ; P :: a : ρα.A (cid:75) u “ ` id ˆ ` a ` : Fold ˘˘ ˝ (cid:74) Ψ ; ∆ $ P :: a : r ρα.A { α s A (cid:75) u ˝ ` id ˆ ` a ´ : Unfold ˘˘ (48) Rule ( ρ ´ L ). Omitted. (cid:74)
Ψ ; ∆ , a : ρα.A $ send a unfold ; P :: c : C (cid:75) u “ ` id ˆ ` a ´ : Fold ˘˘ ˝ (cid:74) Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C (cid:75) u ˝ ` id ˆ ` a ` : Unfold ˘˘ (49) Rule (E-{})
Equation (12): (cid:74)
Ψ ; a i : A i $ a Ð t M u Ð a i :: a : A (cid:75) “ down ˝ (cid:74) Ψ , M : t a : A Ð a i : A i u (cid:75) B.3 Clauses for Type Formation (Appendix A.3)
Rule (C ). Equations (19) and (20): (cid:74) Ξ $ type s (cid:75) ´ “ λξ. tKu (cid:74) Ξ $ type s (cid:75) ` “ λξ. t˚u K Rule (CVar).
Equation (35): (cid:74) Ξ , α type p s $ α type p s (cid:75) q “ π Ξ ,αα p q P t´ , `uq Rule (C ρ ). Equation (36): (cid:74) Ξ $ ρα.A type s (cid:75) p “ p (cid:74) Ξ , α type s $ A type s (cid:75) p q : p p P t´ , `uq Rule (C Ó ). Equations (27) and (28): (cid:74) Ξ $ Ó A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ (cid:74) Ξ $ Ó A type s (cid:75) ` “ (cid:74) Ξ $ A type s (cid:75) `K Rule (C Ò ). Omitted. (cid:74) Ξ $ Ò A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´K (50) (cid:74) Ξ $ Ò A type s (cid:75) ` “ (cid:74) Ξ $ A type s (cid:75) ` (51) Rule (C ‘ ). Equations (31) and (32): (cid:74) Ξ $ ‘t l : A l u l P L type s (cid:75) ´ “ ź l P L (cid:74) Ξ $ A l type s (cid:75) ´ (cid:74) Ξ $ ‘t l : A l u l P L type s (cid:75) ` “ à l P L (cid:74) Ξ $ A l type s (cid:75) `K Rule (C & ). Omitted. (cid:74) Ξ $ & t l : A l u l P L type s (cid:75) ´ “ à l P L (cid:74) Ξ $ A l type s (cid:75) ´K (52) (cid:74) Ξ $ & t l : A l u l P L type s (cid:75) ` “ ź l P L (cid:74) Ξ $ A l type s (cid:75) ` (53) Rule (C b ). Equations (23) and (24): (cid:74) Ξ $ A b B type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ ˆ (cid:74) Ξ $ B type s (cid:75) ´ (cid:74) Ξ $ A b B type s (cid:75) ` “ ` (cid:74) Ξ $ A type s (cid:75) ` ˆ (cid:74) Ξ $ B type s (cid:75) ` ˘ K Rule (C (cid:40) ). Omitted. (cid:74) Ξ $ A (cid:40) B type s (cid:75) ´ “ ` (cid:74) Ξ $ A type s (cid:75) ` ˆ (cid:74) Ξ $ B type s (cid:75) ´ ˘ K (54) (cid:74) Ξ $ A (cid:40) B type s (cid:75) ` “ (cid:74) Ξ $ A type s (cid:75) ´ ˆ (cid:74) Ξ $ B type s (cid:75) ` (55) Rule (C ^ ). Equations (13) and (14): (cid:74) Ξ $ τ ^ A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ (cid:74) Ξ $ τ ^ A type s (cid:75) ` “ ` (cid:74) τ (cid:75) ˆ (cid:74) Ξ $ A type s (cid:75) ` ˘ K . Kavanagh 23 Rule (C Ą ). Omitted. (cid:74) Ξ $ τ Ą A type s (cid:75) ´ “ ` (cid:74) τ (cid:75) ˆ (cid:74) Ξ $ A type s (cid:75) ´ ˘ K (56) (cid:74) Ξ $ τ Ą A type s (cid:75) ` “ (cid:74) Ξ $ A type s (cid:75) ` (57) Rule (T{}).
Equation (10): (cid:74) t a : A Ð a i : A i u type f (cid:75) “ (cid:74) a i : A i $ a : A (cid:75) K Rule (T Ñ ). Equation (5): (cid:74) τ Ñ σ type f (cid:75) “ r (cid:74) τ type f (cid:75) K ! ÝÑ (cid:74) σ type f (cid:75) s C Properties of Trace and Parametrized Fixed-Point Operators
Traces were first discovered Căzănescu and Ştefănescu [18, § 4.3] and then independentlyrediscovered by Joyal et al. [28] in the setting of balanced monoidal categories. In this section,we define traces in the setting of symmetric monoidal categories. We related traces to thecontinuous parametrized fixed-point operator p¨q : given in Section 4. We then prove variousidentities that are useful for computing semantic equivalences. § Definition 18. A monoidal category is a sextuple p M , b , I, λ, ρ, α q satisfying the pentagonaxiom [19, diagram (2.2)] and the triangle axiom [19, diagram (2.10)], where M is a category b : M ˆ M Ñ M is a tensor product on M I is the unit of the tensor λ : I ˆ A ñ A is a natural isomorphism witnessing that I is the left unit ρ : A b I ñ A is a natural isomorphism witnessing that I is the right unit α : p A b B q b C ñ A b p B b C q is a natural isomorphism witnessing the associativity ofthe tensor b .A monoidal category is symmetric if it is additionally equipped by a natural isomorphism σ : A b B Ñ B b A satisfying various other axioms given on [8, p. 404]. § Example 19.
The category ω - aBC is a traced symmetric monoidal category. Its tensorproduct is given by the Cartesian product ˆ and the terminal object J is the unit. § Definition 20 ([9, Definition 2.4]) . A trace on a symmetric monoidal category p M , b , I, λ, ρ,α, σ q is a family of functions Tr UA,B : M p A b U, B b U q Ñ M p A, B q satisfying the following conditions: Naturality in A (left tightening): if f : A b U Ñ B b U and g : A Ñ A , then Tr UA,B p f ˝ p g b id U qq “ Tr UA ,B p f q ˝ g : A Ñ B. Naturality in B (right tightening): if f : A b U Ñ B b U and g : B Ñ B , then Tr UA,B pp g b id U q ˝ f q “ g ˝ Tr UA,B p f q : A Ñ B. Dinaturality (sliding): if f : A b U Ñ B b V and g : V Ñ U , then Tr UA,B pp id B b g q ˝ f q “ Tr VA,B p f ˝ p id A b g qq : A Ñ B. Action (vanishing): if f : A Ñ B , then Tr IA,B ` ρ ´ ˝ f ˝ ρ ˘ “ f : A Ñ B, and if f : A b p U b V q Ñ B b p U b V q , then Tr U b VA,B p f q “ Tr UA,B ´ Tr VA b U,B b U ` α ´ ˝ f ˝ α ˘¯ . Superposing: if f : A b U Ñ B b U , then Tr UC b A,C b B ` α ´ ˝ p id C b f q ˝ α ˘ “ id C b Tr UA,B p f q : C b A Ñ C b B. Yanking: for all U , Tr UU,U p σ U,U q “ id U : U Ñ U. § Example 21.
The following defines a trace on the category ω - aBC [4, § 5.6]: Tr XA,B p f q “ π B ˆ XB ˝ f ˝ A id A , ` π B ˆ XX ˝ f ˘ : E . This trace is defined in terms of the parametrized fixed-point operator of Section 4.Formally, a parametrized fixed-point operator is: § Definition 22 ([42, Definitions 2.2 and 2.4]) . A parametrized fixed-point operator on acategory M is a family of morphisms p¨q : : M p X ˆ A Ñ A q ñ M p X Ñ A q satisfying: Naturality: for any g : X Ñ Y and f : Y ˆ A Ñ A , f : ˝ g “ p f ˝ p g ˆ id A qq : : X Ñ A. The parametrized fixed-point property: for any f : X ˆ A Ñ A , f ˝ x id X , f : y “ f : : X Ñ A. It is a
Conway operator if it additionally satisfies: Parameterized dinaturality: for any f : X ˆ B Ñ A and g : X ˆ A Ñ B , f ˝ x id X , p g ˝ x π X , f yq : y “ p f ˝ x π , g yq : : X Ñ A. The diagonal property: for any f : X ˆ A ˆ A Ñ A , p f ˝ p id X ˆ ∆ qq : “ ` f : ˘ : : X Ñ A, where ∆ : A Ñ A ˆ A is the diagonal map. § Example 23.
Recall that ω - aBC is equipped with a continuous least-fixed-point operator fix : r D Ñ D s Ñ D for each object D . The operator p¨q : : r X ˆ A Ñ A s Ñ r X Ñ A s fromSection 4 given by f : p x q “ fix p λa.f p x, a qq is a Conway operator.Our goal is to relate this Conway operator to the trace operator on ω - aBC . To do so, wewill use explicit definitions of fix and p¨q : . Recall that given a continuous g : X Ñ X , we cancompute fix p g q in two ways: . Kavanagh 25 using the Kleene fixed-point theorem, with fix p g q “ Ů Ò n P N g n pK X q ;using a variant of the Knaster-Tarski theorem, with fix p g q “ (cid:100) t x P X | g p x q Ď x u .Given a continuous g : X ˆ A Ñ A , we can then compute g : in two ways:using the Kleene fixed-point theorem, with g : p x q “ Ů Ò n P N p λa P A.g p x, a qq n pK A q ;using a variant of the Knaster-Tarski theorem, with g : p x q “ (cid:100) t a P A | g p x, a q Ď a u .Hasegawa [26, Theorem 7.1] and Hyland independently discovered [9, p. 281] that acartesian category has a trace if and only if it has a Conway operator. The following is aspecial case of the proof of the Hasegawa-Hyland theorem. § Proposition 24.
For all f : A ˆ X Ñ B ˆ X , we have f ˝x id A , p π B ˆ XX ˝ f q : y “ p f ˝ π B ˆ X ˆ AA ˆ X q : .Consequently, Tr X p f q “ π B ˆ XB ˝ p f ˝ π B ˆ X ˆ AA ˆ X q : . As a consequence of Proposition 24, we can compute the trace Tr X p f q of a morphism f : A ˆ X Ñ B ˆ X in two ways:using the Kleene fixed-point theorem, with Tr X p f qp a q “ π B ˆ XB ˜ğ Ò n P N p λ p b, x q .f p a, x qq n pK B , K X q ¸ ;using a variant of the Knaster-Tarski theorem, with Tr X p f qp a q “ π B ˆ XB ´ (cid:108) tp b, x q P B ˆ X | f p a, x q Ď p b, x qu ¯ . (58)Lemma 25 further relates the Conway operator and the trace on ω - aBC . § Lemma 25.
Let f : A ˆ X Ñ B ˆ X be continuous and let a P A be arbitrary. Take P “ tp b, x q P B ˆ X | f p a, x q Ď p b, x qu . Then (cid:100) P “ ` f ˝ π B ˆ A ˆ XA ˆ X ˘ : p a q and (cid:100) P P P . Proof.
Let p ˆ b, ˆ x q “ ` f ˝ π B ˆ A ˆ XA ˆ X ˘ : p a q . We begin by showing that p ˆ b, ˆ x q P P . By theparametrized fixed-point property (Definition 22), f p a, ˆ x q “ ` f ˝ π B ˆ A ˆ XA ˆ X ˘ p ˆ b, a, ˆ x q“ ` f ˝ π B ˆ A ˆ XA ˆ X ˘ : p a q“ p ˆ b, ˆ x q . So p ˆ b, ˆ x q P P . Next, we show that p ˆ b, ˆ x q “ (cid:100) P . But this is immediate by the Knaster-Tarskiformulation of ` f ˝ π B ˆ A ˆ XA ˆ X ˘ : . Indeed, p ˆ b, ˆ x q “ ` f ˝ π B ˆ A ˆ XA ˆ X ˘ : p a q“ (cid:108) (cid:32) p b, x q P B ˆ X | ` f ˝ π B ˆ A ˆ XA ˆ X ˘ p b, a, x q Ď p b, x q ( “ (cid:108) tp b, x q P B ˆ X | f p a, x q Ď p b, x qu“ (cid:108) P. đ Proposition 26 allows us to drop section-retraction pairs from fixed expressions. We call amorphism s : Y Ñ X a section if there exists a morphism r : X Ñ Y with r ˝ s “ id Y . In thiscase, we call r the retract . We frequently encounter the section-retraction pair p up , down q when computing semantic equivalences. § Proposition 26.
Let s : Y Ñ X be a section with retract r : X Ñ Y in a traced category.For all f : A b Y Ñ B b Y , we have Tr XA,B pp id B b s q ˝ f ˝ p id A b r qq “ Tr YA,B p f q . Proof.
The result follows by associativity of composition, the sliding axiom, and the factthat r ˝ s “ id Y : Tr XA,B pp id B b s q ˝ f ˝ p id A b r qq“ Tr XA,B pp id B b s q ˝ p f ˝ p id A b r qqq“ Tr YA,B pp f ˝ p id A b r qq ˝ p id A b s qq“ Tr YA,B p f ˝ p id A b p r ˝ s qqq“ Tr YA,B p f ˝ p id A b id Y qq“ Tr YA,B p f q . đ Proposition 27 gives an associativity property for traces. § Proposition 27.
Consider the following morphisms in a traced monoidal category wherethe associator and symmetry natural isomorphisms are the identity: f : A b X Ñ B b Y f : A b Y b X Ñ B b X b Y f : A b Y Ñ B b X . Then Tr X b Y b X b Y A b A b A ,B b B b B p f b f b f q“ Tr X b Y A b A b A ,B b B b B ´ f b Tr X b Y A b A ,B b B p f b f q ¯ “ Tr X b Y A b A b A ,B b B b B ´ Tr X b Y A b A ,B b B p f b f q b f ¯ . Proof. Tr X b Y A b A b A ,B b B b B ´ f b Tr X b Y A b A ,B b B p f b f q ¯ “ Tr X b Y A b A b A ,B b B b B ´ p f b id B b B q ˝ ´ id A b X b Tr X b Y A b A ,B b B p f b f q ¯¯ by superposing: “ Tr X b Y A b A b A ,B b B b B ´ p f b id B b B q ˝ Tr X b Y A b A b A ,B b B b B p id A b X b f b f q ¯ by right tightening: “ Tr X b Y A b A b A ,B b B b B ´ Tr X b Y A b A b A ,B b B b B p f b f b f q ¯ by action: “ Tr X b Y b X b Y A b A b A ,B b B b B p f b f b f q by assumption on the symmetry isomorphism: “ Tr X b Y b X b Y A b A b A ,B b B b B p f b f b f q by the above argument in reverse: “ Tr X b Y A b A b A ,B b B b B ´ Tr X b Y A b A ,B b B p f b f q b f ¯ . đ Proposition 28 lets us drop the strictness operator under certain circumstances. This isuseful when computing semantic equivalences because we often need to take the trace offunctions that are strict in the component we are fixing. . Kavanagh 27 § Proposition 28.
Let f : A ˆ X Ñ C ˆ Y and g : B ˆ Y Ñ D ˆ X . The equality Tr X ˆ Y p strict X p f q ˆ g q “ Tr X ˆ Y p f ˆ g q : A ˆ B Ñ C ˆ D holds whenever π D ˆ XX ˝ g is not strict or f “ strict X p f q . Proof. If f is strict in X , then the result immediate. Assume now that π D ˆ XX ˝ g is notstrict. We use the Knaster-Tarski formulation (58) of the trace operator. Let p a, b q P A ˆ B be arbitrary. We calculate that Tr X ˆ Y p strict X p f q ˆ g q p a, b q “ π C ˆ D ´ (cid:108) L ¯ Tr X ˆ Y p f ˆ g q p a, b q “ π C ˆ D ´ (cid:108) R ¯ where l “ strict X p f q ˆ g,L “ tp c, y, d, x q P C ˆ Y ˆ D ˆ X | l p a, x, b, y q Ď p c, y, d, x qu ,r “ f ˆ g,R “ tp c, y, d, x q P C ˆ Y ˆ D ˆ X | r p a, x, b, y q Ď p c, y, d, x qu . To show Tr X ˆ Y p strict X p f q ˆ g q p a, b q “ Tr X ˆ Y p f ˆ g q p a, b q , it is sufficient to show that (cid:100) L “ (cid:100) R .We begin by showing that (cid:100) L Ď (cid:100) R . To do so, we show that R Ď L . Let p c r , y r , d r , x r q P R be arbitrary. By definition of R , r p a, x r , b, y r q Ď p c r , y r , d r , x r q . We have l Ď r becausestrict X p f q Ď f and products are monotone. Then l p a, x r , b, y r q Ď r p a, x r , b, y r q Ď p c r , y r , d r , x r q , so p c r , y r , d r , x r q P L . We conclude R Ď L and (cid:100) L Ď (cid:100) R .We now show that (cid:100) R Ď (cid:100) L . To do so, we show that (cid:100) L P R . Let p c l , y l , d l , x l q “ (cid:100) L .We must show that r p a, x l , d, y l q Ď p c l , y l , d l , x l q . Because π D ˆ XX ˝ g is not strict, we know that x l ‰ K X . Indeed, by monotonicity we have K X Ĺ ` π D ˆ XX ˝ g ˘ pK B , K Y q Ď ` π D ˆ XX ˝ g ˘ p b, y l q “ x l Observe that whenever x ‰ K X , we have for all y that r p a, x, b, y q “ l p a, x, b, y q . So r p a, x l , d, x l q “ l p a, x l , d, x l q . By Lemma 25, (cid:100) L P L , so l p a, x l , b, y l q Ď p c l , y l , d l , x l q . Thesefacts imply r p a, x l , d, x l q “ l p a, x l , d, x l q Ď p c l , y l , d l , x l q , i.e., that (cid:100) L P R . We conclude that (cid:100) R Ď (cid:100) L .Because p a, b q was arbitrary in the domain, we conclude that the functions are equal. đ Proposition 29 tells us that the trace in ω - aBC interacts well with currying. § Proposition 29.
Let f : A ˆ B ˆ X Ñ C ˆ X . Let Λ f : A Ñ r B ˆ X Ñ C ˆ X s be givenby Currying. Then Tr XA ˆ B,C p f q “ λ p a, b q P A ˆ B. Tr XB,C p Λ f p a qq p b q . Proof.
We use the explicit definition of the trace and Conway operators. Let p a, b q P A ˆ B be arbitrary and write f a for Λ f p a q : Tr XA ˆ B,C p f qp a, b q“ ` π C ˝ f ˝ x id A ˆ B , p π X ˝ f q : y ˘ p a, b q“ π C ` f ` a, b, p π X ˝ f q : p a, b q ˘˘ “ π C p f p a, b, fix p λx P X.π X p f p a, b, x qqqqq“ π C p f a p b, fix p λx P X.π X p f a p b, x qqqqq“ π C ` f a ` b, p π X ˝ f a q : p b q ˘˘ “ ` π C ˝ f a ˝ x id B , p π X ˝ f a q : y ˘ p b q“ Tr XB,C p f a qp b q“ ´ λ p a, b q P A ˆ B. Tr XB,C p Λ f p a qq p b q ¯ p a, b q . Because p a, b q was arbitrary, we conclude that the two functions are equal. đ Lemma 30 will be used by the proof of Proposition 31. § Lemma 30.
Let X and Y be partial orders with bottom elements. Let s : X Ñ Y and r : Y Ñ X monotone morphisms. If p s, r q is a section-retraction pair, then r is strict. Proof.
We must show that r pK Y q “ K X . Observe that K Y Ď s pK X q . By monotonicity of r , r pK Y q Ď r p s pK X qq “ id X pK X q “ K X . đ Proposition 31 is useful when computing fixed points of quoted processes. § Proposition 31.
Let X and Y be dcpos. Let s : X Ñ Y and r : Y Ñ X be a continuoussection-retraction pair and let f : X Ñ X be continuous. Then fix p s ˝ f ˝ r q “ s p fix p f qq . Proof.
Let l “ s ˝ f ˝ r . We claim for all n ě l n “ s ˝ f n ˝ r . We proceed by inductionon n . The result is immediate for n “
1. Assuming the result for some n , we get: l n ` “ l ˝ l n “ p s ˝ f ˝ r q ˝ p s ˝ f n ˝ r q “ s ˝ f ˝ f n ˝ r “ s ˝ f n ` ˝ r. We then compute: fix p s ˝ f ˝ r q “ ğ Ò n “ l n pK Y q“ ğ Ò n “ l n pK Y q by the claim: “ ğ Ò n “ p s ˝ f n ˝ r qpK Y q by Lemma 30: “ ğ Ò n “ p s ˝ f n qpK X q . Kavanagh 29 by continuity: “ s ˜ ğ Ò n “ f n pK X q ¸ “ s p fix p f qq . đ Lemma 32 is useful when reasoning about stream transducers. § Lemma 32.
Consider continuous functions f : p c ` : A q ˆ p c ´ : Jq Ñ p c ´ : Jq ˆ p c ` : A q ,g : p c ` : A q ˆ p c ´ : Jq Ñ p c ´ : Jq ˆ p c ` : A q . Let ρ p c ` : a, c ´ : Kq “ p c ` : a, c ´ : Kq : p c ` : A q ˆ p c ´ : Jq Ñ p c ` : A q ˆ p c ´ : Jq σ p c ´ : K , c ` : a q “ p c ` : a, c ´ : Kq : p c ´ : Jq ˆ p c ` : A q Ñ p c ` : A q ˆ p c ´ : Jq τ p c ´ : K , c ` : a q “ p c ´ : K , c ` : a q : p c ´ : Jq ˆ p c ` : A q Ñ p c ´ : Jq ˆ p c ` : A q be relabelling isomorphisms. Then Tr c ´ ˆ c ` p f ˆ g q “ τ ˝ g ˝ σ ˝ f ˝ ρ . Proof.
Let p a, Kq P p c ` : A q ˆ p c ´ : Jq be arbitrary. Let F “ (cid:32) pK , a , K , a q P p c ´ : Jq ˆ p c ` : A q ˆ p c ´ : Jq ˆ p c ` : A q || p f ˆ g qp a, K , a , Kq Ď pK , a , K , a qu . By the Knaster-Tarski formulation of the trace ((58)): Tr c ´ ˆ c ` p f ˆ g qp a, Kq “ π c ´ ,c ` ´ (cid:108) F ¯ . To prove the proposition, it is sufficient to show that: π c ´ ,c ` ´ (cid:108) F ¯ “ p τ ˝ g ˝ σ ˝ f ˝ ρ qp a, Kq . We begin by showing p τ ˝ g ˝ σ ˝ f ˝ ρ qp a, Kq Ď π c ´ ,c ` p (cid:100) F q . Let pK , a , K , a q “ (cid:100) F .By Lemma 25, (cid:100) F P F , so p f ˆ g qp a, K , a , Kq Ď pK , a , K , a q , i.e., f p c ` : a, c ´ : Kq Ď p c ´ : K , c ` : a q (59) g p c ` : a , c ´ : Kq Ď p c ´ : K , c ` : a q . (60)We generate a sequence of inequalities using monotonicity. First, by definition of ρ : ρ p c ` : a, c ´ : Kq “ p c ` : a, c ´ : Kq applying f to both sides: p f ˝ ρ qp c ` : a, c ´ : Kq “ f p c ` : a, c ´ : Kq by transitivity with (59): p f ˝ ρ qp c ` : a, c ´ : Kq Ď p c ´ : K , c ` : a q applying σ to both sides and computing on the right: p σ ˝ f ˝ ρ qp c ` : a, c ´ : Kq Ď p c ´ : K , c ` : a q applying f to both sides: p g ˝ σ ˝ f ˝ ρ qp c ` : a, c ´ : Kq Ď g p c ´ : K , c ` : a q by transitivity with (60): p g ˝ σ ˝ f ˝ ρ qp c ` : a, c ´ : Kq Ď p c ´ : K , c ` : a q applying τ to both sides and computing on the right: p τ ˝ g ˝ σ ˝ f ˝ ρ qp c ` : a, c ´ : Kq Ď p c ´ : K , c ` : a q but p c ´ : K , c ` : a q “ π c ´ ,c ` p (cid:100) F q , so: p τ ˝ g ˝ σ ˝ f ˝ ρ qp c ` : a, c ´ : Kq Ď π c ´ ,c ` ´ (cid:108) F ¯ . Now we show that π c ´ ,c ` p (cid:100) F q Ď p τ ˝ g ˝ σ ˝ f ˝ ρ qp a, Kq . Let a , a P A be such that f p c ` : a, c ´ : Kq “ p c ´ : K , c ` : a q ,g p c ` : a , c ´ : Kq “ p c ´ : K , c ` : a q . Then p τ ˝ g ˝ σ ˝ f ˝ ρ qp c ` : a, c ´ : Kq “ p c ´ : K , c ` : a q . But the above two equations implythat p f ˆ g qp c ` : a, c ´ : K , c ` : a , c ´ : Kq “ p c ´ : K , c ` : a , c ´ : K , c ` : a q , so p c ´ : K , c ` : a , c ´ : K , c ` : a q P F . It follows that π c ´ ,c ` ´ (cid:108) F ¯ Ď p c ´ : K , c ` : a q “ p τ ˝ g ˝ σ ˝ f ˝ ρ qp c ` : a, c ´ : Kq . đ D Semantic Results for Terms and Processes
We show various supporting results for terms and processes. To simplify the proofs of theseresults, we adopt the following slogan:The sound categorical interpretation of notion the of term formation amounts torequiring that certain naturality conditions hold in the categorical model. [17, p. 165]:To make this explicit, assume that judgments Ψ , M : τ are interpreted as morphisms (cid:74) Ψ (cid:75) Ñ (cid:74) τ (cid:75) in some category C . Consider a term-forming rule Ψ ; ∆ $ P :: c : C ¨ ¨ ¨ Ψ ; ∆ n $ P n :: c n : C n Ψ , M : τ ¨ ¨ ¨ Ψ , M m : τ m J ¨ ¨ ¨ J l Ψ , F J ,..., J l p P , . . . , P n , M , . . . , M m q : τ Assume its interpretation is given by (cid:74)
Ψ ; ∆ $ F J ,..., J l p P , . . . , P n , M , . . . , M m q :: c : C (cid:75) “ (cid:74) F J ,..., J l (cid:75) (cid:74) Ψ (cid:75) p (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) , . . . , (cid:74) Ψ ; ∆ n $ P n :: c n : C n (cid:75) , (cid:74) Ψ , M : τ (cid:75) , . . . , (cid:74) Ψ , M m : τ m (cid:75) q , (61)where (cid:74) F J ,..., J l (cid:75) is a family of morphisms (cid:74) F J ,..., J l (cid:75) (cid:74) Ψ (cid:75) : ˜ n ź i “ C p (cid:74) Ψ (cid:75) , (cid:74) ∆ i $ c i : C i (cid:75) q ¸ ˆ ˜ m ź i “ C p (cid:74) Ψ (cid:75) , (cid:74) τ i (cid:75) q ¸ Ñ C p (cid:74) Ψ (cid:75) , (cid:74) τ (cid:75) q . (62)We say that Equation (61) is natural in its environment if the family (62) is natural in (cid:74) Ψ (cid:75) . In this case, we call (cid:74) F J ,..., J l (cid:75) a natural interpretation of the rule. The definition forprocess-forming rules is analogous. . Kavanagh 31 § Proposition 33. If Ψ , M : τ , then the interpretation (cid:74) Ψ , M : τ (cid:75) is natural in itsenvironment. If Ψ ; ∆ $ P :: a : A , then the interpretation (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) is natural inits environment. Proof.
By case analysis on the last rule in the derivation of Ψ , M : τ and Ψ ; ∆ $ P :: a : A .We explain notation and styles of arguments in the first case in which they are used. Becausemany of the cases are similar, we adopt a concise style in subsequent cases. Case (I-{}).
Ψ ; a i : A i $ P :: a : A Ψ , a Ð t P u Ð a i : t a : A Ð a i : A i u p I-{} q Recall Equation (11): (cid:74) Ψ , a Ð t P u Ð a i : t a : A Ð a i : A i u (cid:75) “ up ˝ (cid:74) Ψ ; a i : A i $ P :: a : A (cid:75) . The corresponding natural interpretation is: ω - aBC p´ , up q : ω - aBC p´ , (cid:74) a Ð t P u Ð a i $ a : A (cid:75) q ñ ω - aBC ` ´ , (cid:74) t a : A Ð a i : A i u (cid:75) ˘ where the component at (cid:74) Ψ (cid:75) is given by ω - aBC p (cid:74) Ψ (cid:75) , up q p p q “ up ˝ p. Case (F-Var). Ψ , x : τ , x : τ p F-Var q Recall Equation (6): (cid:74) Ψ , x : τ , x : τ (cid:75) u “ π Ψ ,xx u. The corresponding natural interpretation is: ` λ K .λu P (cid:74) Ψ , x : τ (cid:75) .π Ψ ,xx u ˘ (cid:74) Ψ (cid:75) : tKu ñ ω - aBC p (cid:74) Ψ , x : τ (cid:75) , (cid:74) τ (cid:75) q Case (F-Fix). Ψ , x : τ , M : τ Ψ , fix x.M : τ p F-Fix q Recall Equation (9): (cid:74) Ψ , fix x.M : τ (cid:75) u “ (cid:74) Ψ , x : τ , M : τ (cid:75) : u. This is equivalent to (cid:74) Ψ , fix x.M : τ (cid:75) u “ fix p λv P (cid:74) τ (cid:75) . (cid:74) Ψ , x : τ , M : τ (cid:75) r u | x ÞÑ v sq , which is itself equivalent to (cid:74) Ψ , fix x.M : τ (cid:75) u “ fix p Λ p (cid:74) Ψ , x : τ , M : τ (cid:75) qq , whereΛ : ω - aBC p´ ˆ (cid:74) x : τ (cid:75) , (cid:74) τ (cid:75) q ñ ω - aBC p´ , ω - aBC p (cid:74) τ (cid:75) , (cid:74) τ (cid:75) qq is the currying natural isomorphism given by the adjunction for the exponential. Thecorresponding natural interpretation for ( F-Fix ) is then: ω - aBC p´ , fix q ˝ Λ : ω - aBC p´ ˆ (cid:74) x : τ (cid:75) , (cid:74) τ (cid:75) q ñ ω - aBC p´ , (cid:74) τ (cid:75) q . Case (F-Fun). Ψ , x : τ , M : σ Ψ , λx : τ.M : τ Ñ σ p F-Fun q Recall Equation (7): (cid:74) Ψ , λx : τ.M : τ Ñ σ (cid:75) u “ strict p λv P (cid:74) τ (cid:75) . (cid:74) Ψ , x : τ , M : σ (cid:75) r u | x ÞÑ v sq . This is equivalent to (cid:74) Ψ , λx : τ.M : τ Ñ σ (cid:75) u “ strict p Λ p (cid:74) Ψ , x : τ , M : σ (cid:75) qq . The corresponding natural interpretation is: ω - aBC p´ , strict q ˝ Λ : ω - aBC p´ ˆ (cid:74) x : τ (cid:75) , (cid:74) σ (cid:75) q ñ ω - aBC p´ , (cid:74) σ (cid:75) q . Case (F-App). Ψ , M : τ Ñ σ Ψ , N : τ Ψ , M N : σ p F-App q Recall Equation (8): (cid:74) Ψ , M N : σ (cid:75) u “ (cid:74) Ψ , M : τ Ñ σ (cid:75) u p (cid:74) Ψ , N : τ (cid:75) u q . We must show that this is the image p η (cid:74) Ψ (cid:75) p (cid:74) Ψ , M : τ Ñ σ (cid:75) , (cid:74) Ψ , N : τ (cid:75) qq u of somenatural transformation η : ω - aBC p´ , (cid:74) τ Ñ σ (cid:75) q ˆ ω - aBC p´ , (cid:74) τ (cid:75) q ñ ω - aBC p´ , (cid:74) σ (cid:75) q . There exists a canonical natural isomorphism α : ω - aBC p´ , (cid:74) τ Ñ σ (cid:75) q ˆ ω - aBC p´ , (cid:74) τ (cid:75) q ñ ω - aBC p´ , (cid:74) τ Ñ σ (cid:75) ˆ (cid:74) τ (cid:75) q whose D -component is α D p m, n qp u q “ p mu, nu q . The counit ev of the exponentialadjunction is a natural transformation whose (cid:74) τ (cid:75) , (cid:74) σ (cid:75) component is ev (cid:74) τ (cid:75) , (cid:74) σ (cid:75) : (cid:74) τ Ñ σ (cid:75) ˆ (cid:74) τ (cid:75) Ñ (cid:74) σ (cid:75) . sending p f, v q to f p v q . This morphism induces a natural transformation ω - aBC ` ´ , ev (cid:74) τ (cid:75) , (cid:74) σ (cid:75) ˘ : ω - aBC p´ , (cid:74) τ Ñ σ (cid:75) ˆ (cid:74) τ (cid:75) q ñ ω - aBC p´ , (cid:74) σ (cid:75) q . The corresponding natural interpretation for (
F-App ) is then η “ ω - aBC ` ´ , ev (cid:74) τ (cid:75) , (cid:74) σ (cid:75) ˘ ˝ α . Case (Fwd).
Ψ ; a : A $ b Ð a :: b : A p Fwd q Recall Equation (17): (cid:74)
Ψ ; a : A $ b Ð a :: b : A (cid:75) u p a ` , b ´ q “ p b ´ , a ` q Let f “ λ p a ` , b ´ q . p b ´ , a ` q . The corresponding natural interpretation is p λ K .λu P (cid:74) Ψ (cid:75) .f q (cid:74) Ψ (cid:75) : tKu ñ ω - aBC p (cid:74) Ψ (cid:75) , (cid:74) a : A $ b : A (cid:75) q . This family is natural is because it is a constant family. . Kavanagh 33
Case (Cut).
Ψ ; ∆ $ P :: a : A Ψ ; a : A, ∆ $ Q :: c : C Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C p Cut q Recall Equation (18): (cid:74)
Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) u “ Tr a ´ ˆ a ` p (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u ˆ (cid:74) Ψ ; a : A, ∆ $ Q :: c : C (cid:75) u q . We must show that there is a corresponding natural interpretation η : ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) q ˆ ω - aBC p´ , (cid:74) a : A, ∆ $ c : C (cid:75) q ññ ω - aBC p´ , (cid:74) ∆ , ∆ $ c : C (cid:75) q . There exists a natural isomorphism α : ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) q ˆ ω - aBC p´ , (cid:74) a : A, ∆ $ c : C (cid:75) q ññ ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) ˆ (cid:74) a : A, ∆ $ c : C (cid:75) q whose D -component is α D p p, q qp u q “ p pu, qu q . There exists an injection ψ : (cid:74) ∆ $ a : A (cid:75) ˆ (cid:74) a : A, ∆ $ c : C (cid:75) ÑÑ ω - aBC ` (cid:74) ∆ , ∆ , a : A (cid:75) ` ˆ (cid:74) a : A, c : C (cid:75) ´ , (cid:74) ∆ , ∆ , a : A (cid:75) ´ ˆ (cid:74) a : A, c : C (cid:75) ` ˘ where ψ p p, q q “ p ˆ q . The trace operator defines a morphism Tr a ´ ˆ a ` : ω - aBC ` (cid:74) ∆ , ∆ , a : A (cid:75) ` ˆ (cid:74) a : A, c : C (cid:75) ´ , (cid:74) ∆ , ∆ , a : A (cid:75) ´ ˆ (cid:74) a : A, c : C (cid:75) ` ˘ Ñ (cid:74) ∆ , ∆ $ c : C (cid:75) . By the Yoneda lemma, the morphism Tr a ´ ˆ a ` ˝ ψ uniquely determines a natural trans-formation ω - aBC ´ ´ , Tr a ´ ˆ a ` ˝ ψ ¯ : ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) ˆ (cid:74) a : A, ∆ $ c : C (cid:75) q ññ ω - aBC p´ , (cid:74) ∆ , ∆ $ c : C (cid:75) q given by post-composition. The corresponding natural interpretation is then: η “ ω - aBC ´ ´ , Tr b ´ ˆ b ` ˝ ψ ¯ ˝ α. Indeed, for all u P (cid:74) Ψ (cid:75) , η (cid:74) Ψ (cid:75) p (cid:74) Ψ ; ∆ $ P :: b : B (cid:75) , (cid:74) Ψ ; b : B, ∆ $ Q :: c : C (cid:75) q u “ ´ Tr b ´ ˆ b ` ˝ ψ ¯ p (cid:74) Ψ ; ∆ $ P :: b : B (cid:75) u, (cid:74) Ψ ; b : B, ∆ $ Q :: c : C (cid:75) u q“ Tr b ´ ˆ b ` p (cid:74) Ψ ; ∆ $ P :: b : B (cid:75) u ˆ (cid:74) Ψ ; b : B, ∆ $ Q :: c : C (cid:75) u q . Case ( R ). Ψ ; ¨ $ close a :: a : p R q Recall Equation (21): (cid:74)
Ψ ; ¨ $ close a :: a : (cid:75) u p a ´ : Kq “ p a ` : ˚q Let f “ λ p a ´ : Kq . p a ` : ˚q . The corresponding natural interpretation is p λ K .λu P (cid:74) Ψ (cid:75) .f q (cid:74) Ψ (cid:75) : tKu ñ ω - aBC p (cid:74) Ψ (cid:75) , (cid:74) ¨ $ a : (cid:75) q . This family is natural is because it is a constant family.
Case ( L ). Ψ ; ∆ $ P :: c : C Ψ ; ∆ , a : $ wait a ; P :: c : C p L q Recall Equation (22): (cid:74)
Ψ ; ∆ , a : $ wait a ; P :: c : C (cid:75) u “ strict a ` ` λ p δ ` , a ` , c ´ q . p δ ´ , K , c ` q ˘ q where p δ ´ , c ` q “ (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) u p δ ` , c ´ q . We must show that there exists a natural interpretation η : ω - aBC p´ , (cid:74) ∆ $ c : C (cid:75) q ñ ω - aBC p´ , (cid:74) ∆ , a : $ c : C (cid:75) q . By the Yoneda lemma, these natural transformations are in natural bijection withmorphisms f : (cid:74) ∆ $ c : C (cid:75) Ñ (cid:74) ∆ , a : $ c : C (cid:75) , where each such f uniquely determines the natural transformation ˆ f “ ω - aBC p´ , f q whose component at D isˆ f D p g : D Ñ (cid:74) ∆ $ c : C (cid:75) q “ f ˝ g. In particular, the natural interpretation is induced by the morphism f p p q “ strict c ` ` λ p δ ` , c ` , a ´ q . p δ ´ , K , a ` q ˘ where p δ ´ , a ` q “ p p δ ` , a ´ q . Case ( Ó R ). Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ send a shift ; P :: a : Ó A pÓ R q Recall Equation (29): (cid:74)
Ψ ; ∆ $ send a shift ; P :: a : Ó A (cid:75) u “ ` id ˆ ` a ` : up ˘˘ ˝ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u. Let f p p q “ ` id ˆ ` a ` : up ˘˘ ˝ p : (cid:74) ∆ $ a : A (cid:75) Ñ (cid:74) ∆ $ a : Ó A (cid:75) . The natural interpretation is then ω - aBC p´ , f q : ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) q ñ ω - aBC p´ , (cid:74) ∆ $ a : Ó A (cid:75) q . . Kavanagh 35 Indeed, given a u P (cid:74) Ψ (cid:75) , we get ω - aBC p (cid:74) Ψ (cid:75) , f q p (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) q p u q“ p f ˝ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) q p u q“ f p (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u q“ ` id ˆ ` a ` : up ˘˘ ˝ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u. Case ( Ó L ). Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : Ó A $ shift Ð recv a ; P :: c : C pÓ L q Recall Equation (30): (cid:74)
Ψ ; ∆ , a : Ó A $ shift Ð recv a ; P :: c : C (cid:75) u “ strict a ` ` (cid:74) Ψ ; ∆ , a : A $ P :: c : C (cid:75) u ˝ ` id ˆ ` a ` : down ˘˘˘ . Let f p p q “ p ˝ ` id ˆ ` a ` : down ˘˘ : (cid:74) ∆ , a : A $ c : C (cid:75) Ñ (cid:74) ∆ , a : Ó A $ c : C (cid:75) . The natural interpretation is then ω - aBC p´ , f q : ω - aBC p´ , (cid:74) ∆ , a : A $ c : C (cid:75) q ñ ω - aBC p´ , (cid:74) ∆ , a : Ó A $ c : C (cid:75) q . Case ( Ò R ). Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ shift Ð recv a ; P :: a : Ò A pÒ R q Analogous to case ( Ó L ). Case ( Ò L ). Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : Ò A $ send a shift ; P :: c : C pÒ L q Analogous to case ( Ó R ). Case ( ‘ R k ). Ψ ; ∆ $ P :: a : A k p k P L q Ψ ; ∆ $ a.k ; P :: a : ‘t l : A l u l P L p‘ R k q Recall Equation (33): (cid:74)
Ψ ; ∆ $ a.k ; P :: a : ‘t l : A l u l P L (cid:75) u ` δ ` , ` a ´ l ˘ l P L ˘ “ ` δ ´ , ` k, “ a ` k ‰˘˘ where (cid:74) Ψ ; ∆ $ P :: a : A k (cid:75) u ` δ ` , a ´ k ˘ “ ` δ ´ , a ` k ˘ . Let f : (cid:74) ∆ $ a : A k (cid:75) Ñ (cid:74) ∆ $ a : ‘t l : A l u l P L (cid:75) be given by f p p q ` δ ` , ` a ´ l ˘ l P L ˘ “ ` δ ´ , ` k, “ a ` k ‰˘˘ where p ` δ ` , a ´ k ˘ “ ` δ ´ , a ` k ˘ . The natural interpretation is then ω - aBC p´ , f q : ω - aBC p´ , (cid:74) ∆ $ a : A k (cid:75) q ñ ω - aBC p´ , (cid:74) ∆ $ a : ‘t l : A l u l P L (cid:75) q . Case ( ‘ L ). Ψ ; ∆ , a : A l $ P l :: c : C p@ l P L q Ψ ; ∆ , a : ‘t l : A l u l P L $ case a t l l ñ P l u i P I :: c : C p‘ L q Recall Equation (34): (cid:74)
Ψ ; ∆ , a : ‘t l : A l u l P L $ case a t l ñ P l u l P L :: c : C (cid:75) u “ strict a ` ` λ ` δ ` , a ` : ` k, “ a ` k ‰˘ , c ´ ˘ . ` δ ´ , a ´ : ` k : a ´ k , l ‰ k : K ˘ l P L , c ` ˘˘ where p δ ´ , a ´ k , c ` q “ (cid:74) Ψ ; ∆ , a : A k $ P k :: c : C (cid:75) u p δ ` , a ` k , c ´ q . We must find a corresponding natural interpretation η : ˜ź l P L ω - aBC p´ , (cid:74) ∆ , a : A l $ c : C (cid:75) q ¸ ñ ω - aBC p´ , (cid:74) ∆ , a : ‘t l : A l u l P L $ c : C (cid:75) q . There exists a canonical natural isomorphism α : ˜ź l P L ω - aBC p´ , (cid:74) ∆ , a : A l $ c : C (cid:75) q ¸ ñ ω - aBC ˜ ´ , ź l P L (cid:74) ∆ , a : A l $ c : C (cid:75) ¸ whose D -component is α D pp p l q l P L q p u q “ pp p l p u qq l P L , so it is sufficient to show that thereexists a natural transformation β : ω - aBC ˜ ´ , ź l P L (cid:74) ∆ , a : A l $ c : C (cid:75) ¸ ñ ω - aBC p´ , (cid:74) ∆ , a : ‘t l : A l u l P L $ c : C (cid:75) q such that η “ β ˝ α . Consider the β induced by f : ź l P L (cid:74) ∆ , a : A l $ c : C (cid:75) Ñ (cid:74) ∆ , a : ‘t l : A l u l P L $ c : C (cid:75) f pp p l q l P L q “ strict a ` ` λ ` δ ` , a ` : ` k, “ a ` k ‰˘ , c ´ ˘ . ` δ ´ , a ´ : ` k : a ´ k , l ‰ k : K ˘ l P L , c ` ˘˘ where p δ ´ , a ´ k , c ` q “ p k p δ ` , a ` k , c ´ q . Recall that we abuse notation to pattern match on the component a ` . By strictness,we know that it will be an element of the form ` k, “ a ` k ‰˘ . We then get that η “ ω - aBC p´ , f q ˝ α is the desired natural interpretation. Case ( & R ). Ψ ; ∆ $ P l :: a : A l p@ l P L q Ψ ; ∆ $ case a t l ñ P l u l P L :: a : & t l : A l u l P L p & R q Analogous to case ( ‘ L ). Case ( & L k ). Ψ ; ∆ , a : A k $ P :: c : C p k P L q Ψ ; ∆ , a : & t l : A l u l P L $ a.k ; P :: c : C p & L k q Analogous to case ( ‘ R k ). Case ( b R ˚ ). Ψ ; ∆ $ P :: a : A Ψ ; ∆ , b : B $ send a b ; P :: a : B b A pb R ˚ q . Kavanagh 37 Recall Equation (25): (cid:74)
Ψ ; ∆ , b : B $ send a b ; P :: a : B b A (cid:75) u p δ ` , b ` , p a ´ B , a ´ A qq“ ` δ ´ , a ´ B , “` b ` , a ` A ˘‰˘ where (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , a ´ A q “ p δ ´ , a ` A q . Let f : (cid:74) ∆ $ a : A (cid:75) Ñ (cid:74) ∆ , b : B $ a : B b A (cid:75) be given by f p p qp δ ` , b ` , p a ´ B , a ´ A qq “ ` δ ´ , a ´ B , “` b ` , a ` A ˘‰˘ where p p δ ` , a ´ A q “ p δ ´ , a ` A q . The corresponding natural interpretation is then ω - aBC p´ , f q : ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) q ñ ω - aBC p´ , (cid:74) ∆ , b : B $ a : B b A (cid:75) q . Case ( b L ). Ψ ; ∆ , a : A, b : B $ P :: c : C Ψ ; ∆ , a : B b A $ b Ð recv a ; P :: c : C pb L q Recall Equation (26): (cid:74)
Ψ ; ∆ , a : B b A $ b Ð recv a ; Q :: c : C (cid:75) u p δ ` , a ` , c ´ q“ strict a ` ` λ p δ ` , a ` : “ p a ` B , a ` A q ‰ , c ´ q . p δ ´ , p b ´ , a ´ q , c ` q ˘ where (cid:74) Ψ ; ∆ , a : A, b : B $ Q :: c : C (cid:75) u p δ ` , a ` A , a ` B , c ´ q “ p δ ´ , a ´ , b ´ , c ` q . Let f : (cid:74) ∆ , a : A, b : B $ c : C (cid:75) Ñ (cid:74) ∆; a : B b A $ c : C (cid:75) be given by f p p q “ strict a ` ` λ p δ ` , a ` : “ p a ` B , a ` A q ‰ , c ´ q . p δ ´ , p b ´ , a ´ q , c ` q ˘ where p p δ ` , a ` A , a ` B , c ´ q “ p δ ´ , a ´ , b ´ , c ` q . The corresponding natural interpretation isthen ω - aBC p´ , f q : ω - aBC p´ , (cid:74) ∆ , a : A, b : B $ c : C (cid:75) q ñ ω - aBC p´ , (cid:74) ∆; a : B b A $ c : C (cid:75) q . Case ( (cid:40) R ). Ψ ; ∆ , b : B $ P :: a : A Ψ ; ∆ $ b Ð recv a ; P :: a : B (cid:40) A p (cid:40) R q Analogous to case ( b L ). Case ( (cid:40) L ). Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , b : B, a : B (cid:40) A $ send a bb ; P :: c : C p (cid:40) L q Analogous to case ( b R ). Case ( ^ R ). Ψ , M : τ Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A p^ R q Recall Equation (15): (cid:74)
Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A (cid:75) u p δ ` , a ´ q“ K if (cid:74) Ψ , M : τ (cid:75) u “ Kp δ ´ , rp v, a ` qsq if (cid:74) Ψ , M : τ (cid:75) u “ v ‰ K where (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u p δ ` , a ´ q “ p δ ´ , a ` q . We must find a corresponding natural interpretation η : ω - aBC p´ , (cid:74) τ (cid:75) q ˆ ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) q ñ ω - aBC p´ , (cid:74) ∆ $ a : τ ^ A (cid:75) q . Let α : ω - aBC p´ , (cid:74) τ (cid:75) q ˆ ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) q ñ ω - aBC p´ , (cid:74) τ (cid:75) ˆ (cid:74) ∆ $ a : A (cid:75) q be the canonical natural isomorphism whose D -component is α D p m, p qp u q “ p mu, pu q .Let f : (cid:74) τ (cid:75) ˆ (cid:74) ∆ $ a : A (cid:75) Ñ (cid:74) ∆ $ a : τ ^ A (cid:75) be the morphism given by f p v, p qp δ ` , a ´ q “ K if v “ Kp δ ´ , rp v, a ` qsq if v ‰ K where p p δ ` , a ´ q “ p δ ´ , a ` q . We claim that the corresponding natural interpretation isgiven by η “ ω - aBC p´ , f q ˝ α : ω - aBC p´ , (cid:74) τ (cid:75) q ˆ ω - aBC p´ , (cid:74) ∆ $ a : A (cid:75) q ññ ω - aBC p´ , (cid:74) ∆ $ a : τ ^ A (cid:75) q . Indeed, given a u P (cid:74) Ψ (cid:75) , we get η (cid:74) Ψ (cid:75) p (cid:74) Ψ , M : τ (cid:75) , (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) q p u q“ f p (cid:74) Ψ , M : τ (cid:75) u, (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u q“ (cid:74) Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A (cid:75) u. Case ( ^ L ). Ψ , x : τ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : τ ^ A $ x Ð input a ; P :: c : C p^ L q Recall Equation (16): (cid:74)
Ψ ; ∆ , a : τ ^ A $ x Ð input a ; P :: c : C (cid:75) u “ strict a ` ` λ ` δ ` , a ` : “` v, α ` ˘‰ , c ´ ˘ . (cid:74) Ψ , x : τ ; ∆ , a : A $ P :: c : C (cid:75) r u | x ÞÑ v sp δ ` , α ` , c ´ q ˘ We must find a corresponding natural interpretation η : ω - aBC p´ ˆ p x : (cid:74) τ (cid:75) q , (cid:74) ∆ , a : A $ c : C (cid:75) q ñ ω - aBC p´ , (cid:74) ∆ , a : τ ^ A $ c : C (cid:75) q . LetΛ : ω - aBC p´ ˆ p x : (cid:74) τ (cid:75) q , (cid:74) ∆ , a : A $ c : C (cid:75) q ññ ω - aBC p´ Ñ rp x : (cid:74) τ (cid:75) q , (cid:74) ∆ , a : A $ c : C (cid:75) qs be the natural isomorphism given by the adjunction for the exponential in ω - aBC . Let f : ω - aBC pp x : (cid:74) τ (cid:75) q , (cid:74) ∆ , a : A $ c : C (cid:75) q Ñ (cid:74) ∆ , a : τ ^ A $ c : C (cid:75) f p p q “ strict a ` ` λ ` δ ` , a ` : “` v, α ` ˘‰ , c ´ ˘ .pv p δ ` , α ` , c ´ q ˘ . . Kavanagh 39 We claim that the corresponding natural interpretation is η “ ω - aBC p´ , f q ˝ Λ. To seethat this is so, set p “ (cid:74) Ψ , x : τ ; ∆ , a : A $ P :: c : C (cid:75) and note that:Λ (cid:74) Ψ (cid:75) p p q “ λu P (cid:74) Ψ (cid:75) .λv P (cid:74) τ (cid:75) .p r u | x ÞÑ v s . Let u P (cid:74) Ψ (cid:75) be arbitrary and observe that: p ω - aBC p´ , f q ˝ Λ q (cid:74) Ψ (cid:75) p (cid:74) Ψ , x : τ ; ∆ , a : A $ P :: c : C (cid:75) q p u q“ f p λv P (cid:74) τ (cid:75) .p r u | x ÞÑ v sq“ strict a ` ` λ ` δ ` , a ` : “` v, α ` ˘‰ , c ´ ˘ . p λw P (cid:74) τ (cid:75) .p r u | x ÞÑ w sq v p δ ` , α ` , c ´ q ˘ “ strict a ` ` λ ` δ ` , a ` : “` v, α ` ˘‰ , c ´ ˘ .p r u | x ÞÑ v sp δ ` , α ` , c ´ q ˘ “ (cid:74) Ψ ; ∆ , a : τ ^ A $ x Ð input a ; P :: c : C (cid:75) u. Case ( Ą R ). Ψ , x : τ ; ∆ $ P :: a : A Ψ ; ∆ $ x Ð input a ; P :: a : τ Ą A pĄ R q Analogous to case ( ^ L ). Case ( Ą L ). Ψ , M : τ Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : τ Ą A $ _ Ð output a M ; P :: c : C pĄ L q Analogous to case ( ^ R ). Case ( ρ ` R ). Ψ ; ∆ $ P :: a : r ρα.A { α s A ´ $ ρα.A type ` s Ψ ; ∆ $ send a unfold ; P :: a : ρα.A p ρ ` R q Recall Equation (37): (cid:74)
Ψ ; ∆ $ send a unfold ; P :: a : ρα.A (cid:75) u “ ` id ˆ ` a ` : Fold ˘˘ ˝ (cid:74) Ψ ; ∆ $ P :: a : r ρα.A { α s A (cid:75) u ˝ ` id ˆ ` a ´ : Unfold ˘˘ Let f : (cid:74) Ψ ; ∆ $ P :: a : r ρα.A { α s A (cid:75) Ñ (cid:74) Ψ ; ∆ $ send a unfold ; P :: a : ρα.A (cid:75) be givenby f p p q “ ` id ˆ ` a ` : Fold ˘˘ ˝ p ˝ ` id ˆ ` a ´ : Unfold ˘˘ . This is well-defined by semantic substitution of session types (Proposition 16) and thedefinitions of
Fold and
Unfold . The corresponding natural interpretation is then ω - aBC p´ , f q : ω - aBC p´ , (cid:74) Ψ ; ∆ $ P :: a : r ρα.A { α s A (cid:75) q ññ ω - aBC p´ , (cid:74) Ψ ; ∆ $ send a unfold ; P :: a : ρα.A (cid:75) q . Case ( ρ ` L ). Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C ´ $ ρα.A type ` s Ψ ; ∆ , a : ρα.A $ unfold Ð recv a ; P :: c : C p ρ ` L q Analogous to case ( ρ ` R ). Case ( ρ ´ R ). Ψ ; ∆ $ P :: a : r ρα.A { α s A ´ $ ρα.A type ´ s Ψ ; ∆ $ unfold Ð recv a ; P :: a : ρα.A p ρ ´ R q Analogous to case ( ρ ` R ). Case ( ρ ´ L ). Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C ´ $ ρα.A type ´ s Ψ ; ∆ , a : ρα.A $ send a unfold ; P :: c : C p ρ ´ L q Analogous to case ( ρ ` R ). Case (E-{}). Ψ , M : t a : A Ð a i : A i u Ψ ; a i : A i $ a Ð t M u Ð a i :: a : A p E-{} q Recall Equation (12): (cid:74)
Ψ ; a i : A i $ a Ð t M u Ð a i :: a : A (cid:75) u “ down ` (cid:74) Ψ , M : t a : A Ð a i : A i u (cid:75) u ˘ We must find a corresponding natural interpretation η : ω - aBC ` ´ , (cid:74) t a : A Ð a i : A i u (cid:75) ˘ ñ ω - aBC ` ´ , (cid:74) a i : A i , ∆ $ a : A (cid:75) ˘ . It is η “ ω - aBC p´ , down q . đ D.1 Semantic Weakening
We show that weakening is semantically well-behaved, i.e., that the semantic clauses arecoherent [47, p. 218]. § Proposition 15 (Coherence of Terms and Processes) . If Ψ , M : τ , then (cid:74) Φ , Ψ , M : τ (cid:75) “ (cid:74) Ψ , M : τ (cid:75) ˝ π Φ , ΨΨ . If Ψ ; ∆ $ P :: a : A , then (cid:74) Φ , Ψ ; ∆ $ P :: a : A (cid:75) “ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) ˝ π Φ , ΨΨ . Proof.
By induction on the derivation of Ψ , M : τ and Ψ ; ∆ $ P :: a : A .Except where stated otherwise, each of rule cases uses the same proof outline. We refer toit below as the “standard proof”. We give this proof for a generic rule for forming functionalterms. The proof for rules forming processes is analogous. Consider the rule Ψ ; ∆ $ P :: c : C ¨ ¨ ¨ Ψ ; ∆ n $ P n :: c n : C n Ψ , M : τ ¨ ¨ ¨ Ψ , M m : τ m J ¨ ¨ ¨ J l Ψ , F J ,..., J l p P , . . . , P n , M , . . . , M m q : τ Assume its interpretation is given by (cid:74) Ψ , F J ,..., J l p P , . . . , P n , M , . . . , M m q : τ (cid:75) “ (cid:74) F J ,..., J l (cid:75) (cid:74) Ψ (cid:75) p (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) , . . . , (cid:74) Ψ ; ∆ n $ P n :: c n : C n (cid:75) , (cid:74) Ψ , M : τ (cid:75) , . . . , (cid:74) Ψ , M m : τ m (cid:75) q (63)where (cid:74) F J ,..., J l (cid:75) is a natural interpretation (cid:74) F J ,..., J l (cid:75) : ˜ n ź i “ ω - aBC p´ , (cid:74) ∆ i $ c i : C i (cid:75) q ¸ ˆ ˜ m ź i “ ω - aBC p´ , (cid:74) τ i (cid:75) q ¸ ñ ω - aBC p´ , (cid:74) τ (cid:75) q . . Kavanagh 41 Given any other functional context Φ disjoint from Ψ, we would like to show that (cid:74) Φ , Ψ , F J ,..., J l p P , . . . , P n , M , . . . , M m q : τ (cid:75) “ (cid:74) Ψ , F J ,..., J l p P , . . . , P n , M , . . . , M m q : τ (cid:75) ˝ π Φ , ΨΨ . By the induction hypothesis, we know that for 1 ď i ď n and 1 ď j ď m , (cid:74) Φ , Ψ ; ∆ i $ P i :: c i : C i (cid:75) “ (cid:74) Ψ ; ∆ i $ P i :: c i : C i (cid:75) ˝ π Φ , ΨΨ (cid:74) Φ , Ψ , M j : τ j (cid:75) “ (cid:74) Ψ , M j : τ j (cid:75) ˝ π Φ , ΨΨ . Using these facts we get: (cid:74) Φ , Ψ , F J ,..., J l p P , . . . , P n , M , . . . , M m q : τ (cid:75) “ (cid:74) F J ,..., J l (cid:75) (cid:74) Φ (cid:75) p (cid:74) Φ , Ψ ; ∆ $ P :: c : C (cid:75) , . . . , (cid:74) Φ , Ψ ; ∆ n $ P n :: c n : C n (cid:75) , (cid:74) Φ , Ψ , M : τ (cid:75) , . . . , (cid:74) Φ , Ψ , M m : τ m (cid:75) q which by the induction hypothesis, “ (cid:74) F J ,..., J l (cid:75) (cid:74) Φ (cid:75) ´ (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) ˝ π Φ , ΨΨ , . . . , (cid:74) Ψ ; ∆ n $ P n :: c n : C n (cid:75) ˝ π Φ , ΨΨ , (cid:74) Ψ , M : τ (cid:75) ˝ π Φ , ΨΨ , . . . , (cid:74) Ψ , M m : τ m (cid:75) ˝ π Φ , ΨΨ ¯ which by naturality of (cid:74) F J ,..., J l (cid:75) , “ (cid:74) F J ,..., J l (cid:75) (cid:74) Ψ (cid:75) p (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) , . . . , (cid:74) Ψ ; ∆ n $ P n :: c n : C n (cid:75) , (cid:74) Ψ , M : τ (cid:75) , . . . , (cid:74) Ψ , M m : τ m (cid:75) q ˝ π Φ , ΨΨ “ (cid:74) Ψ , F J ,..., J l p P , . . . , P n , M , . . . , M m q : τ (cid:75) ˝ π Φ , ΨΨ . This is what we wanted to show.
Case (I-{}).
By the standard proof and Proposition 33.
Case (F-Var). Ψ , x : τ , x : τ p F-Var q Recall Equation (6): (cid:74) Ψ , x : τ , x : τ (cid:75) u “ π Ψ ,xx u. We use identities of products and projections to compute: (cid:74) Φ , Ψ , x : τ , x : τ (cid:75) “ π Φ , Ψ ,xx “ π Ψ ,xx ˝ π Φ , Ψ ,x Ψ ,x “ (cid:74) Ψ , x : τ , x : τ (cid:75) ˝ π Φ , Ψ ,x Ψ ,x . Case (F-Fix). Ψ , x : τ , M : τ Ψ , fix x.M : τ p F-Fix q Recall Equation (9): (cid:74) Ψ , fix x.M : τ (cid:75) u “ (cid:74) Ψ , x : τ , M : τ (cid:75) : u The result follows from a tweak of the standard proof and Proposition 33. Let η : ω - aBC p´ ˆ (cid:74) x : τ (cid:75) , (cid:74) τ (cid:75) q ñ ω - aBC p´ , (cid:74) τ (cid:75) q be the natural interpretation given by Pro-position 33. Then (cid:74) Φ , Ψ , fix x.M : τ (cid:75) “ η (cid:74) Φ (cid:75) p (cid:74) Φ , Ψ , x : τ , M : τ (cid:75) q which by the induction hypothesis: “ η (cid:74) Φ (cid:75) ´ (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ π Φ , Ψ ,x Ψ ,x ¯ which by an identity of projections: “ η (cid:74) Φ (cid:75) ´ (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ ´ π Φ , ΨΨ ˆ ` x : id (cid:74) τ (cid:75) ˘¯¯ which by naturality: “ η (cid:74) Ψ (cid:75) p (cid:74) Ψ , x : τ , M : τ (cid:75) q ˝ π Φ , ΨΨ “ (cid:74) Ψ , fix x.M : τ (cid:75) ˝ π Φ , ΨΨ . Case (F-Fun). Ψ , x : τ , M : σ Ψ , λx : τ.M : τ Ñ σ p F-Fun q This case is analogous to the case (
F-Fix ). Case (F-App).
By the standard proof and Proposition 33.
Case (Fwd).
By the standard proof and Proposition 33.
Case (Cut).
By the standard proof and Proposition 33.
Case ( R ). By the standard proof and Proposition 33.
Case ( L ). By the standard proof and Proposition 33.
Case ( Ó R ). By the standard proof and Proposition 33.
Case ( Ó L ). By the standard proof and Proposition 33.
Case ( Ò R ). By the standard proof and Proposition 33.
Case ( Ò L ). By the standard proof and Proposition 33.
Case ( ‘ R k ). By the standard proof and Proposition 33.
Case ( ‘ L ). By the standard proof and Proposition 33.
Case ( & R ). By the standard proof and Proposition 33.
Case ( & L k ). By the standard proof and Proposition 33.
Case ( b R ˚ ). By the standard proof and Proposition 33.
Case ( b L ). By the standard proof and Proposition 33.
Case ( (cid:40) R ). By the standard proof and Proposition 33.
Case ( (cid:40) L ). By the standard proof and Proposition 33.
Case ( ^ R ). By the standard proof and Proposition 33.
Case ( ^ L ). Ψ , x : τ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : τ ^ A $ x Ð input a ; P :: c : C p^ L q This case is analogous to the case (
F-Fix ). Case ( Ą R ). Ψ , x : τ ; ∆ $ P :: a : A Ψ ; ∆ $ x Ð input a ; P :: a : τ Ą A pĄ R q This case is analogous to the case (
F-Fix ). . Kavanagh 43 Case ( Ą L ). By the standard proof and Proposition 33.
Case ( ρ ` R ). By the standard proof and Proposition 33.
Case ( ρ ` L ). By the standard proof and Proposition 33.
Case ( ρ ´ R ). By the standard proof and Proposition 33.
Case ( ρ ´ L ). By the standard proof and Proposition 33.
Case (E-{}).
By the standard proof and Proposition 33. đ D.2 Semantic Substitution
Our goal in this section is to show that substitution is given by composition.
Contextmorphisms give us a semantic account of substitutions. The judgment σ : f Φ (cid:32) Ψ means thesubstitution σ is a morphism of functional variable contexts from Φ to Ψ. It is inductivelydefined by the rules ¨ : f Φ (cid:32) ¨ p S-T-Empty q σ : f Φ (cid:32) Ψ Φ , M : τσ, M : f Φ (cid:32) Ψ , x : τ p S-T-F q Consider a morphism σ “ N , . . . , N n with n ě σ : f Φ (cid:32) x : τ , . . . , x n : τ n .Given a functional term x : τ , . . . , x n : τ n , M : τ or a process x : τ , . . . , x n : τ n ;∆ $ P :: c : C , we write σM and σP for the results of the simultaneous substitutions r N , . . . , N n { x , . . . , x n s M and r N , . . . , N n { x , . . . , x n s P , respectively.The judgments Ψ , M : τ and Ψ ; ∆ $ P :: a : A satisfy the following syntacticsubstitution property: § Proposition 34 (Syntactic Substitution of Terms) . Let σ : f Φ (cid:32) Ψ be arbitrary.(1) If Ψ , N : τ , then Φ , σN : τ .(2) If Ψ ; ∆ $ P :: c : C , then Φ ; ∆ $ σP :: c : C . Proof.
By induction on the derivation of Ψ , M : τ and Ψ ; ∆ $ P :: a : A . đ A context morphism σ : f Φ (cid:32) Ψ is interpreted as a continuous morphism (cid:74) σ : f Φ (cid:32) Ψ (cid:75) : (cid:74) Φ (cid:75) Ñ (cid:74) Ψ (cid:75) . It is recursively defined on the derivation of σ : f Φ (cid:32) Ψ. The interpretations of(
S-T-Empty ) and (
S-T-F ) are respectively (cid:74) ¨ : f Φ (cid:32) ¨ (cid:75) “ J (cid:74) Φ (cid:75) (64) (cid:74) σ, M : f Φ (cid:32) Ψ , x : τ (cid:75) “ x (cid:74) σ : f Φ (cid:32) Ψ (cid:75) , x : (cid:74) Φ , M : τ (cid:75) y (65)where J (cid:74) Φ (cid:75) is the unique morphism from (cid:74) Φ (cid:75) to the terminal object J of ω - aBC . § Lemma 35 (Weakening of Context Morphisms) . Let σ : f Φ (cid:32) Ψ be arbitrary and Γ , Φ acontext. Then σ : f Γ , Φ (cid:32) Ψ and (cid:74) σ : f Γ , Φ (cid:32) Ψ (cid:75) “ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) ˝ π Γ , ΦΦ . Proof.
By induction on the derivation of σ : f Φ (cid:32) Ψ. Case (S-T-Empty).
Then σ : f Γ , Φ (cid:32) ¨ by ( S-T-Empty ). By terminality, (cid:74) σ : f Γ , Φ (cid:32) ¨ (cid:75) “ J (cid:74) Γ , Φ (cid:75) “ J (cid:74) Φ (cid:75) ˝ π Γ , ΦΦ “ (cid:74) σ : f Φ (cid:32) ¨ (cid:75) ˝ π Γ , ΦΦ . Case (S-T-F). σ : f Φ (cid:32) Ψ Φ , M : τσ, M : f Φ (cid:32) Ψ , x : τ p S-T-F q By the induction hypothesis, σ : f Γ , Φ (cid:32) Ψ and (cid:74) σ : f Γ , Φ (cid:32) Ψ (cid:75) “ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) ˝ π Γ , ΦΦ . By weakening, Γ , Φ , M : τ , and by Proposition 15, (cid:74) Γ , Φ , M : τ (cid:75) “ (cid:74) Φ , M : τ (cid:75) ˝ π Γ , ΦΦ . So σ, M : f Γ , Φ (cid:32) Ψ , x : τ by ( S-T-F ). By Equation (65), (cid:74) σ, M : f Γ , Φ (cid:32) Ψ , x : τ (cid:75) “ x (cid:74) σ : f Γ , Φ (cid:32) Ψ (cid:75) , x : (cid:74) Γ , Φ , M : τ (cid:75) y“ x (cid:74) σ : f Φ (cid:32) Ψ (cid:75) ˝ π Γ , ΦΦ , x : (cid:74) Φ , M : τ (cid:75) ˝ π Γ , ΦΦ y“ x (cid:74) σ : f Φ (cid:32) Ψ (cid:75) , x : (cid:74) Φ , M : τ (cid:75) y ˝ π Γ , ΦΦ “ (cid:74) σ, M : f Φ (cid:32) Ψ , x : τ (cid:75) ˝ π Γ , ΦΦ . We conclude the result by induction. đ§ Proposition 36 (Semantic Substitution of Terms) . Let σ : f Φ (cid:32) Ψ be arbitrary.(1) If Ψ , N : τ , then (cid:74) Φ , σN : τ (cid:75) “ (cid:74) Ψ , N : τ (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) .(2) If Ψ ; ∆ $ P :: c : C , then (cid:74) Φ ; ∆ $ σP :: c : C (cid:75) “ (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) . Proof.
By induction on the derivation of Ψ , M : τ and Ψ ; ∆ $ P :: a : A .Except where stated otherwise, each of rule cases uses the same proof outline. We referto it below as the “standard proof”. We give this proof for a generic rule. Consider the rule Ψ ; ∆ $ P :: c : C ¨ ¨ ¨ Ψ ; ∆ n $ P n :: c n : C n Ψ , M : τ ¨ ¨ ¨ Ψ , M m : τ m J ¨ ¨ ¨ J l Ψ , F J ,..., J l p P , . . . , P n , M , . . . , M m q : τ Assume its interpretation is given by (cid:74)
Ψ ; ∆ $ F J ,..., J l p P , . . . , P n , M , . . . , M m q :: c : C (cid:75) “ (cid:74) F J ,..., J l (cid:75) (cid:74) Ψ (cid:75) p (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) , . . . , (cid:74) Ψ ; ∆ n $ P n :: c n : C n (cid:75) , (cid:74) Ψ , M : τ (cid:75) , . . . , (cid:74) Ψ , M m : τ m (cid:75) q (66)where (cid:74) F J ,..., J l (cid:75) is a natural interpretation (cid:74) F J ,..., J l (cid:75) : ˜ n ź i “ ω - aBC p´ , (cid:74) ∆ i $ c i : C i (cid:75) q ¸ ˆ ˜ m ź i “ ω - aBC p´ , (cid:74) τ i (cid:75) q ¸ ñ ω - aBC p´ , (cid:74) τ (cid:75) q . Given any context morphism σ : f Φ (cid:32) Ψ, we would like to show that (cid:74)
Φ ; ∆ $ σ p F J ,..., J l p P , . . . , P n , M , . . . , M m qq :: c : C (cid:75) “ (cid:74) Ψ ; ∆ $ F J ,..., J l p P , . . . , P n , M , . . . , M m q :: c : C (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) . By the definition of syntactic substitution, we know that σ p F J ,..., J l p P , . . . , P n , M , . . . , M m qq “ F J ,..., J l p σP , . . . , σP n , σM , . . . , σM m q . . Kavanagh 45 By the induction hypothesis, we know that for 1 ď i ď n and 1 ď j ď m , (cid:74) Φ ; ∆ i $ σP i :: c i : C i (cid:75) “ (cid:74) Ψ ; ∆ i $ P i :: c i : C i (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75)(cid:74) Φ , σM j : τ j (cid:75) “ (cid:74) Ψ , M j : τ j (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) . Using these facts we get: (cid:74)
Φ ; ∆ $ σ p F J ,..., J l p P , . . . , P n , M , . . . , M m qq :: c : C (cid:75) “ (cid:74) Φ ; ∆ $ F J ,..., J l p σP , . . . , σP n , σM , . . . , σM m q :: c : C (cid:75) “ (cid:74) F J ,..., J l (cid:75) (cid:74) Φ (cid:75) p (cid:74) Φ ; ∆ $ σP :: c : C (cid:75) , . . . , (cid:74) Φ ; ∆ n $ σP n :: c n : C n (cid:75) , (cid:74) Φ , σM : τ (cid:75) , . . . , (cid:74) Φ , σM m : τ m (cid:75) q which by the induction hypothesis, “ (cid:74) F J ,..., J l (cid:75) (cid:74) Φ (cid:75) p (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) , . . . , (cid:74) Ψ ; ∆ n $ P n :: c n : C n (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) , (cid:74) Ψ , M : τ (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) , . . . , (cid:74) Ψ , M m : τ m (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) q which by naturality of (cid:74) F J ,..., J l (cid:75) , “ (cid:74) F J ,..., J l (cid:75) (cid:74) Ψ (cid:75) p (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) , . . . , (cid:74) Ψ ; ∆ n $ P n :: c n : C n (cid:75) , (cid:74) Ψ , M : τ (cid:75) , . . . , (cid:74) Ψ , M m : τ m (cid:75) q ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) “ (cid:74) Ψ ; ∆ $ F J ,..., J l p P , . . . , P n , M , . . . , M m q :: c : C (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) . Case (I-{}).
Ψ ; a i : A i $ P :: a : A Ψ , a Ð t P u Ð a i : t a : A Ð a i : A i u p I-{} q By the standard proof and Proposition 33.
Case (F-Var). Ψ , x : τ , x : τ p F-Var q Recall Equation (6): (cid:74) Ψ , x : τ , x : τ (cid:75) u “ π Ψ ,xx u. Let σ, M : f Φ (cid:32) Ψ , x : τ be arbitrary. Then (cid:74) Φ , p σ, M q x : τ (cid:75) “ (cid:74) Φ , M : τ (cid:75) “ π Ψ ,xx ˝ x (cid:74) σ : f Φ (cid:32) Ψ (cid:75) , x : (cid:74) Φ , M : τ (cid:75) y“ π Ψ ,xx ˝ (cid:74) σ, M : f Φ (cid:32) Ψ , x : τ (cid:75) “ (cid:74) Ψ , x : τ , x : τ (cid:75) ˝ (cid:74) σ, M : f Φ (cid:32) Ψ , x : τ (cid:75) . Case (F-Fix). Ψ , x : τ , M : τ Ψ , fix x.M : τ p F-Fix q Recall Equation (9): (cid:74) Ψ , fix x.M : τ (cid:75) u “ (cid:74) Ψ , x : τ , M : τ (cid:75) : u The result follows from a tweak of the standard proof and Proposition 33. Let σ : f Φ (cid:32) Ψbe arbitrary. By Lemma 35, we can weaken it to σ, x : f Φ , x : τ (cid:32) Ψ , x : τ . Let η : ω - aBC p¨ ˆ (cid:74) x : τ (cid:75) , (cid:74) τ (cid:75) q ñ ω - aBC p¨ , (cid:74) τ (cid:75) q be the natural interpretation given byProposition 33. Then (cid:74) Φ , σ p fix x.M q : τ (cid:75) “ (cid:74) Φ , fix x. p σ, x q M : τ (cid:75) “ η (cid:74) Φ (cid:75) p (cid:74) Φ , x : τ , p σ, x q M : τ (cid:75) q which by the induction hypothesis: “ η (cid:74) Φ (cid:75) p (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ (cid:74) σ, x : f Φ , x : τ (cid:32) Ψ , x : τ (cid:75) q which by Equation (65): “ η (cid:74) Φ (cid:75) p (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ x (cid:74) σ : f Φ , x : τ (cid:32) Ψ (cid:75) , x : (cid:74) Φ , x : τ , x : τ (cid:75) yq which by Equation (6): “ η (cid:74) Φ (cid:75) ` (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ x (cid:74) σ : f Φ , x : τ (cid:32) Ψ (cid:75) , x : π Φ ,xx y ˘ which by Lemma 35: “ η (cid:74) Φ (cid:75) ´ (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ x (cid:74) σ : f Φ (cid:32) Ψ (cid:75) ˝ π Φ ,x Φ , x : π Φ ,xx y ¯ which by a property of products and projections: “ η (cid:74) Φ (cid:75) p (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ p (cid:74) σ : f Φ (cid:32) Ψ (cid:75) ˆ (cid:74) x : τ (cid:75) qq“ ` η (cid:74) Φ (cid:75) ˝ ω - aBC p (cid:74) σ : f Φ (cid:32) Ψ (cid:75) ˆ (cid:74) x : τ (cid:75) , (cid:74) τ (cid:75) q ˘ p (cid:74) Ψ , x : τ , M : τ (cid:75) q which by naturality: “ ` ω - aBC p (cid:74) σ : f Φ (cid:32) Ψ (cid:75) , (cid:74) τ (cid:75) q ˝ η (cid:74) Ψ (cid:75) ˘ p (cid:74) Ψ , x : τ , M : τ (cid:75) q which by definition of natural interpretation: “ ω - aBC p (cid:74) σ : f Φ (cid:32) Ψ (cid:75) , (cid:74) τ (cid:75) q p (cid:74) Ψ , fix x.M : τ (cid:75) q“ (cid:74) Ψ , fix x.M : τ (cid:75) ˝ (cid:74) σ : f Φ (cid:32) Ψ (cid:75) . Case (F-Fun). Ψ , x : τ , M : σ Ψ , λx : τ.M : τ Ñ σ p F-Fun q This case is analogous to the case (
F-Fix ). Case (F-App). Ψ , M : τ Ñ σ Ψ , N : τ Ψ , M N : σ p F-App q By the standard proof and Proposition 33.
Case (Fwd).
Ψ ; a : A $ b Ð a :: b : A p Fwd q By the standard proof and Proposition 33. . Kavanagh 47
Case (Cut).
Ψ ; ∆ $ P :: a : A Ψ ; a : A, ∆ $ Q :: c : C Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C p Cut q By the standard proof and Proposition 33.
Case ( R ). Ψ ; ¨ $ close a :: a : p R q By the standard proof and Proposition 33.
Case ( L ). Ψ ; ∆ $ P :: c : C Ψ ; ∆ , a : $ wait a ; P :: c : C p L q By the standard proof and Proposition 33.
Case ( Ó R ). Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ send a shift ; P :: a : Ó A pÓ R q By the standard proof and Proposition 33.
Case ( Ó L ). Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : Ó A $ shift Ð recv a ; P :: c : C pÓ L q By the standard proof and Proposition 33.
Case ( Ò R ). Ψ ; ∆ $ P :: a :Ψ ; ∆ $ shift Ð recv a ; P :: a : Ò A pÒ R q By the standard proof and Proposition 33.
Case ( Ò L ). Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : Ò A $ send a shift ; P :: c : C pÒ L q By the standard proof and Proposition 33.
Case ( ‘ R k ). Ψ ; ∆ $ P :: a : A k p k P L q Ψ ; ∆ $ a.k ; P :: a : ‘t l : A l u l P L p‘ R k q By the standard proof and Proposition 33.
Case ( ‘ L ). Ψ ; ∆ , a : A l $ P l :: c : C p@ l P L q Ψ ; ∆ , a : ‘t l : A l u l P L $ case a t l l ñ P l u i P I :: c : C p‘ L q By the standard proof and Proposition 33.
Case ( & R ). Ψ ; ∆ $ P l :: a : A l p@ l P L q Ψ ; ∆ $ case a t l ñ P l u l P L :: a : & t l : A l u l P L p & R q By the standard proof and Proposition 33.
Case ( & L k ). Ψ ; ∆ , a : A k $ P :: c : C p k P L q Ψ ; ∆ , a : & t l : A l u l P L $ a.k ; P :: c : C p & L k q By the standard proof and Proposition 33.
Case ( b R ˚ ). Ψ ; ∆ $ P :: a : A Ψ ; ∆ , b : B $ send a b ; P :: a : B b A pb R ˚ q By the standard proof and Proposition 33.
Case ( b L ). Ψ ; ∆ , a : A, b : B $ P :: c : C Ψ ; ∆ , a : B b A $ b Ð recv a ; P :: c : C pb L q By the standard proof and Proposition 33.
Case ( (cid:40) R ). Ψ ; ∆ , b : B $ P :: a : A Ψ ; ∆ $ b Ð recv a ; P :: a : B (cid:40) A p (cid:40) R q By the standard proof and Proposition 33.
Case ( (cid:40) L ). Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , b : B, a : B (cid:40) A $ send a bb ; P :: c : C p (cid:40) L q By the standard proof and Proposition 33.
Case ( ^ R ). Ψ , M : τ Ψ ; ∆ $ P :: a : A Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A p^ R q By the standard proof and Proposition 33.
Case ( ^ L ). Ψ , x : τ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : τ ^ A $ x Ð input a ; P :: c : C p^ L q This case is analogous to the case (
F-Fix ). Case ( Ą R ). Ψ , x : τ ; ∆ $ P :: a : A Ψ ; ∆ $ x Ð input a ; P :: a : τ Ą A pĄ R q This case is analogous to the case (
F-Fix ). . Kavanagh 49 Case ( Ą L ). Ψ , M : τ Ψ ; ∆ , a : A $ P :: c : C Ψ ; ∆ , a : τ Ą A $ _ Ð output a M ; P :: c : C pĄ L q By the standard proof and Proposition 33.
Case ( ρ ` R ). Ψ ; ∆ $ P :: a : r ρα.A { α s A ¨ $ ρα.A type ` s Ψ ; ∆ $ send a unfold ; P :: a : ρα.A p ρ ` R q By the standard proof and Proposition 33.
Case ( ρ ` L ). Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C ¨ $ ρα.A type ` s Ψ ; ∆ , a : ρα.A $ unfold Ð recv a ; P :: c : C p ρ ` L q By the standard proof and Proposition 33.
Case ( ρ ´ R ). Ψ ; ∆ $ P :: a : r ρα.A { α s A ¨ $ ρα.A type ´ s Ψ ; ∆ $ unfold Ð recv a ; P :: a : ρα.A p ρ ´ R q By the standard proof and Proposition 33.
Case ( ρ ´ L ). Ψ ; ∆ , a : r ρα.A { α s A $ P :: c : C ¨ $ ρα.A type ´ s Ψ ; ∆ , a : ρα.A $ send a unfold ; P :: c : C p ρ ´ L q By the standard proof and Proposition 33.
Case (E-{}). Ψ , M : t a : A Ð a i : A i u Ψ ; a i : A i $ a Ð t M u Ð a i :: a : A p E-{} q By the standard proof and Proposition 33. đ E Semantic Results for Type Formers
We show various semantic results for type interpretations. These results have a similarstructure as Appendix D. We ignore size issues: they can be addressed using a hierarchy ofuniverses [41, § 3].Recall that we interpret judgments Ξ $ A type s as locally continuous functors from (cid:74) Ξ (cid:75) to ω - aBC K ! . These categories and functors are respectively objects and morphisms in thecategory CFP of O -categories that support canonical fixed points ( CFP is also known as
Kind [20, § 7.3.2]). Consider a type-forming ruleΞ $ A type s ¨ ¨ ¨ Ξ $ A n type s J ¨ ¨ ¨ J m Ξ $ F J ,..., J m p A , . . . , A n q type s Assume the polarized aspect (cid:74) Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p is given by (cid:74) Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p “ (cid:74) F J ,..., J m (cid:75) (cid:74) Ξ (cid:75) p (cid:74) Ξ $ A type s (cid:75) p , . . . , (cid:74) Ξ $ A n type s (cid:75) p q . (67) where (cid:74) F J ,..., J m (cid:75) p is a family of morphisms (cid:74) F J ,..., J m (cid:75) (cid:74) Ξ (cid:75) : ˜ n ź i “ CFP p (cid:74) Ξ (cid:75) , ω - aBC K ! q ¸ Ñ CFP p (cid:74) Ξ (cid:75) , ω - aBC K ! q . (68)We say that Equation (67) is natural in its environment if the family (cid:74) F J ,..., J m (cid:75) p (cid:74) Ξ (cid:75) isnatural in (cid:74) Ξ (cid:75) , i.e., if for all functors σ : (cid:74) Ξ (cid:75) Ñ (cid:74) Φ (cid:75) , the following commutes: ś ni “ CFP p (cid:74) Φ (cid:75) , ω - aBC K ! q CFP p (cid:74) Φ (cid:75) , ω - aBC K ! q ś ni “ CFP p (cid:74) Ξ (cid:75) , ω - aBC K ! q CFP p (cid:74) Ξ (cid:75) , ω - aBC K ! q (cid:74) F J ,..., J m (cid:75) (cid:74) Φ (cid:75) ś ni “ CFP p σ,ω - aBC K ! q CFP p σ,ω - aBC K ! q (cid:74) F J ,..., J m (cid:75) (cid:74) Ξ (cid:75) Concretely, this means that for all n -tuples of locally continuous functors p G i : (cid:74) Φ (cid:75) Ñ ω - aBC K ! q ď i ď n , (cid:74) F J ,..., J m (cid:75) (cid:74) Ξ (cid:75) pp G i σ q ď i ď n q “ (cid:74) F J ,..., J m (cid:75) (cid:74) Φ (cid:75) pp G i q ď i ď n q σ. In this case, we call (cid:74) F J ,..., J l (cid:75) p a natural interpretation of the rule. § Proposition 37. If Ξ $ A type s , then (cid:74) Ξ $ A type s (cid:75) ´ and (cid:74) Ξ $ A type s (cid:75) ` are natural intheir environments. Proof.
By case analysis on the last rule in the derivation of Ξ $ A type s . Case (C ). Ξ $ type ` s p C q Recall Equations (19) and (20): (cid:74) Ξ $ type s (cid:75) ´ “ λξ. J ω - aBC K ! (cid:74) Ξ $ type s (cid:75) ` “ λξ. t˚u K . We must show that there exist natural transformations η ´ : J Set ñ CFP p´ , ω - aBC K ! q η ` : J Set ñ CFP p´ , ω - aBC K ! q that are the respective natural interpretations. Given a category C , let∆ C : ω - aBC K ! Ñ r C Ñ ω - aBC K ! s be the diagonal functor. Take η ´ C p˚q “ ∆ C pJ ω - aBC K ! q : C Ñ ω - aBC K ! η ` C p˚q “ ∆ C pt˚u K q : C Ñ ω - aBC K ! . These are obviously natural. When C “ (cid:74) Ξ (cid:75) , we recover: η ´ (cid:74) Ξ (cid:75) p˚q “ (cid:74) Ξ $ type s (cid:75) ´ η ` (cid:74) Ξ (cid:75) p˚q “ (cid:74) Ξ $ type s (cid:75) ` . . Kavanagh 51 Case (CVar). Ξ , α type p s $ α type p s p CVar q Recall Equation (35): (cid:74) Ξ , α type p s $ α type p s (cid:75) q “ π Ξ ,αα p q P t´ , `uq We must show that there exist natural transformations η ´ : J Set ñ CFP p´ ˆ (cid:74) α (cid:75) , ω - aBC K ! q η ` : J Set ñ CFP p´ ˆ (cid:74) α (cid:75) , ω - aBC K ! q that are the respective natural interpretations. Take η ´ C p˚q “ π α : C ˆ (cid:74) α (cid:75) Ñ ω - aBC K ! η ` C p˚q “ π α : C ˆ (cid:74) α (cid:75) Ñ ω - aBC K ! . These are are obviously natural. When C “ (cid:74) Ξ (cid:75) , we recover: η ´ (cid:74) Ξ (cid:75) p˚q “ (cid:74) Ξ , α $ α type s (cid:75) ´ η ` (cid:74) Ξ (cid:75) p˚q “ (cid:74) Ξ , α $ α type s (cid:75) ` . Case (C ρ ). Ξ , α type p s $ A type p s Ξ $ ρα.A type p s p C ρ q Recall Equation (36): (cid:74) Ξ $ ρα.A type s (cid:75) p “ p (cid:74) Ξ , α type s $ A type s (cid:75) p q : p p P t´ , `uq We must show that there exist natural transformations η p : CFP p´ ˆ (cid:74) α (cid:75) , ω - aBC K ! q ñ CFP p´ , ω - aBC K ! q p p P t´ , `uq that are the respective natural interpretations. Take η p C p G q “ G : : C Ñ ω - aBC K ! To show the naturality of η p , we must show that for all functors σ : D Ñ C , p G ˝ p σ ˆ id qq : “ G : ˝ σ : D Ñ ω - aBC K ! . This is exactly the parameter identify [10] satisfied by the dagger p¨q : , so we are done. Case (C Ó ). Ξ $ A type ´ s Ξ $ Ó A type ` s p C Óq Recall Equations (27) and (28): (cid:74) Ξ $ Ó A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ (cid:74) Ξ $ Ó A type s (cid:75) ` “ (cid:74) Ξ $ A type s (cid:75) `K We must show that there exist natural transformations η ´ : CFP p´ , ω - aBC K ! q ñ CFP p´ , ω - aBC K ! q η ` : CFP p´ , ω - aBC K ! q ñ CFP p´ , ω - aBC K ! q that are the respective natural interpretations. Recall that we write F K for the composition p´q K F and σ K for the natural transformation p´q K σ . Take η ´ C p F q “ F : C Ñ ω - aBC K ! η ` C p F q “ F K : C Ñ ω - aBC K ! . To show the naturality of η ´ and η ` , we must show for all functors F : C Ñ ω - aBC K ! and σ : D Ñ C that η ´ D p F σ q “ η ´ C p F q ση ` D p F σ q “ η ` C p F q σ. In the negative case, η ´ D p F σ q “
F σ “ η ´ C p F q σ. In the positive case, we have by associativity of composition: η ` D p F σ q “ p´q K p F σ q “ pp´q K F q σ “ η ` C p F q σ. Case (C Ò ). Ξ $ A type ` s Ξ $ Ò A type ´ s p C Òq This case is analogous to the case ( C Ó ). Case (C ‘ ). Ξ $ A l type ` s p@ l P L q Ξ $ ‘t l : A l u l P L type ` s p C ‘q Recall Equations (31) and (32): (cid:74) Ξ $ ‘t l : A l u l P L type s (cid:75) ´ “ ź l P L (cid:74) Ξ $ A l type s (cid:75) ´ (cid:74) Ξ $ ‘t l : A l u l P L type s (cid:75) ` “ à l P L (cid:74) Ξ $ A l type s (cid:75) `K We must show that there exist natural transformations η ´ : ˜ź l P L CFP p´ , ω - aBC K ! q ¸ ñ CFP p´ , ω - aBC K ! q η ` : ˜ź l P L CFP p´ , ω - aBC K ! q ¸ ñ CFP p´ , ω - aBC K ! q that are the respective natural interpretations. Take η ´ C pp F l q l P L q “ ź l P L F l : C Ñ ω - aBC K ! η ` C pp F l q l P L q “ à l P L p´q K F l : C Ñ ω - aBC K ! . These are both easily seen to be natural. . Kavanagh 53
Case (C & ). Ξ $ A l type ´ s p@ l P L q Ξ $ & t l : A l u l P L type ´ s p C & q This case is analogous to the case ( C ‘ ). Case (C b ). Ξ $ A type ` s Ξ $ B type ` s Ξ $ A b B type ` s p C bq Recall Equations (23) and (24): (cid:74) Ξ $ A b B type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ ˆ (cid:74) Ξ $ B type s (cid:75) ´ (cid:74) Ξ $ A b B type s (cid:75) ` “ ` (cid:74) Ξ $ A type s (cid:75) ` ˆ (cid:74) Ξ $ B type s (cid:75) ` ˘ K We must show that there exist natural transformations η ´ : CFP p´ , ω - aBC K ! q ˆ CFP p´ , ω - aBC K ! q ñ CFP p´ , ω - aBC K ! q η ` : CFP p´ , ω - aBC K ! q ˆ CFP p´ , ω - aBC K ! q ñ CFP p´ , ω - aBC K ! q that are the respective natural interpretations. Take η ´ C p A, B q “ A ˆ B : C Ñ ω - aBC K ! η ` C p A, B q “ p A ˆ B q K : C Ñ ω - aBC K ! . These are easily seen to be natural.
Case (C (cid:40) ). Ξ $ A type ` s Ξ $ B type ´ s Ξ $ A (cid:40) B type ´ s p C (cid:40) q This case is analogous to the case ( C b ). Case (C ^ ). τ type f Ξ $ A type ` s Ξ $ τ ^ A type ` s p C ^q Recall Equations (13) and (14): (cid:74) Ξ $ τ ^ A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ (cid:74) Ξ $ τ ^ A type s (cid:75) ` “ ` (cid:74) τ (cid:75) ˆ (cid:74) Ξ $ A type s (cid:75) ` ˘ K We must show that there exist natural transformations η ´ : Cell ω - aBC K ! p´ , ω - aBC K ! q ñ Cell ω - aBC K ! p´ , ω - aBC K ! q η ` : Cell ω - aBC K ! p´ , ω - aBC K ! q ñ Cell ω - aBC K ! p´ , ω - aBC K ! q that are the respective natural interpretations. Take η ´ C p F q “ F : C Ñ ω - aBC K ! η ` C p F q “ p (cid:74) τ (cid:75) ˆ F q K : C Ñ ω - aBC K ! These are easily seen to be natural.
Case (C Ą ). τ type f Ξ $ A type ´ s Ξ $ τ Ą A type ´ s p C Ąq This case is analogous to the case ( C ^ ). đ E.1 Semantic Weakening
We show that weakening is semantically well-behaved, i.e., that the semantic clauses arecoherent [47, p. 218]. § Proposition 38 (Coherence) . Let Θ , Ξ be a context of type variables. If Ξ $ A type p s , thenthe following diagram commutes for q P t´ , `u : (cid:74) Θ , Ξ (cid:75)(cid:74) Ξ (cid:75) ω - aBC K ! (cid:74) Θ , Ξ $ A type p s (cid:75) q π Θ , ΞΞ (cid:74) Ξ $ A type p s (cid:75) q (69) Proof.
By induction on the derivation of Ξ $ A type p s .Except where otherwise stated, each rule uses the same proof outline. We refer to itbelow as the “standard proof”. Consider a type-forming ruleΞ $ A type s ¨ ¨ ¨ Ξ $ A n type s J ¨ ¨ ¨ J m Ξ $ F J ,..., J m p A , . . . , A n q type s Assume its interpretation is given by (cid:74) Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p “ (cid:74) F J ,..., J m (cid:75) (cid:74) Ξ (cid:75) p (cid:74) Ξ $ A type s (cid:75) p , . . . , (cid:74) Ξ $ A n type s (cid:75) p q . where (cid:74) F J ,..., J m (cid:75) is a natural interpretation (cid:74) F J ,..., J m (cid:75) (cid:74) Ξ (cid:75) : ˜ n ź i “ CFP p (cid:74) Ξ (cid:75) , ω - aBC K ! q ¸ Ñ CFP p (cid:74) Ξ (cid:75) , ω - aBC K ! q . Given any other context of type variables Θ disjoint from Ξ, we would like to show that (cid:74) Θ , Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p “ (cid:74) Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p ˝ π Θ , ΞΞ . By the induction hypothesis, we have for all 1 ď i ď n , (cid:74) Θ , Ξ $ A i type s (cid:75) p “ (cid:74) Ξ $ A i type s (cid:75) p ˝ π Θ , ΞΞ . Using these facts we get: (cid:74) Θ , Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p “ (cid:74) F J ,..., J m (cid:75) (cid:74) Θ , Ξ (cid:75) p (cid:74) Θ , Ξ $ A type s (cid:75) p , . . . , (cid:74) Θ , Ξ $ A n type s (cid:75) p q which by the induction hypothesis, “ (cid:74) F J ,..., J m (cid:75) (cid:74) Θ , Ξ (cid:75) ´ (cid:74) Ξ $ A type s (cid:75) p ˝ π Θ , ΞΞ , . . . , (cid:74) Ξ $ A n type s (cid:75) p ˝ π Θ , ΞΞ ¯ . Kavanagh 55 which by naturality of (cid:74) F J ,..., J m (cid:75) , “ (cid:74) F J ,..., J m (cid:75) (cid:74) Ξ (cid:75) p (cid:74) Ξ $ A type s (cid:75) p , . . . , (cid:74) Ξ $ A n type s (cid:75) p q ˝ π Θ , ΞΞ “ (cid:74) Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p ˝ π Θ , ΞΞ . This is what we wanted to show.
Case (C ). By the standard proof and Proposition 37.
Case (CVar). Ξ , α type p s $ α type p s p CVar q Recall Equation (35): (cid:74) Ξ , α type p s $ α type p s (cid:75) q “ π Ξ ,αα p q P t´ , `uq Then (cid:74) Θ , Ξ , α type s $ α type s (cid:75) q “ π Θ , Ξ ,αα “ π Ξ ,αα π Θ , Ξ ,α Ξ ,α “ (cid:74) Ξ , α type s $ α type s (cid:75) π Θ , Ξ ,α Ξ ,α . This is what we wanted to show.
Case (C ρ ). Ξ , α type p s $ A type p s Ξ $ ρα.A type p s p C ρ q Recall Equation (36): (cid:74) Ξ $ ρα.A type s (cid:75) p “ p (cid:74) Ξ , α type s $ A type s (cid:75) p q : p p P t´ , `uq The result follows from a tweak of the standard proof and Proposition 37. Let η p : CFP p´ ˆ (cid:74) α (cid:75) , ω - aBC K ! q ñ CFP p´ , ω - aBC K ! q be the natural interpretation given byProposition 37. Then (cid:74) Θ , Ξ $ ρα.A type s (cid:75) p “ η p (cid:74) Θ , Ξ (cid:75) p (cid:74) Θ , Ξ , α $ A type s (cid:75) p q which by the induction hypothesis: “ η p (cid:74) Θ , Ξ (cid:75) ´ (cid:74) Ξ , α $ A type s (cid:75) p π Θ , Ξ ,α Ξ ,α ¯ which by a property of products and projections: “ η p (cid:74) Θ , Ξ (cid:75) ´ (cid:74) Ξ , α $ A type s (cid:75) p ´ π Θ , ΞΞ ˆ (cid:74) α (cid:75) ¯¯ which by naturality: “ η p (cid:74) Ξ (cid:75) p (cid:74) Ξ , α $ A type s (cid:75) p q π Θ , ΞΞ “ (cid:74) Ξ $ ρα.A type s (cid:75) p π Θ , ΞΞ . Case (C Ó ). By the standard proof and Proposition 37.
Case (C Ò ). By the standard proof and Proposition 37.
Case (C ‘ ). By the standard proof and Proposition 37.
Case (C & ). By the standard proof and Proposition 37.
Case (C b ). By the standard proof and Proposition 37.
Case (C (cid:40) ). By the standard proof and Proposition 37.
Case (C ^ ). By the standard proof and Proposition 37.
Case (C Ą ). By the standard proof and Proposition 37. đ E.2 Semantic Substitution
Our goal in this section is to show that substitution is given by composition.
Contextmorphisms give us a semantic account of substitutions. To this end, we introduce explicittyping rules for type substitutions. We use the judgment σ : s Ξ (cid:32) Θ to mean that thesubstitution σ is a morphism of type variable contexts from Ξ to Θ. It is inductively definedby ¨ : s Θ (cid:32) ¨ p S-S-Empty q σ : s Θ (cid:32) Ξ Θ $ A type p s σ, A : s Θ (cid:32) Ξ , α type p s p S-S-T p q These rules ensure that substitutions of types for type variables respects polarities, i.e., thatwe only substitute positive session types for a positive type variable and negative session typesfor negative type variables. Given a morphism σ “ A , . . . , A n satisfying σ : s Ξ (cid:32) α , . . . , α n with n ě
0, and a session type α , . . . , α n $ B , we write σB for the result of the simultaneoussubstitution r A , . . . , A n { α , . . . , α n s B . § Proposition 39 (Syntactic Substitution of Session Types) . Let σ : s Θ (cid:32) Ξ be arbitrary. If Ξ $ A type p s , then Θ $ σA type p s . Context morphisms are subject to the same classes of interpretation as session types.A context morphism σ : s Θ (cid:32) Ξ gives rise to polarized interpretations, which are locallycontinuous functors (cid:74) Θ (cid:75) Ñ (cid:74) Ξ (cid:75) . The polarized interpretations of ( S-S-Empty ) and (
S-S-T p )are respectively (cid:74) ¨ : s Θ (cid:32) ¨ (cid:75) q “ J (cid:74) Θ (cid:75) (cid:74) σ, A : s Θ (cid:32) Ξ , α type p s (cid:75) q “ x (cid:74) σ : s Θ (cid:32) Ξ (cid:75) q , α : (cid:74) Θ $ A type p s (cid:75) q y where J (cid:74) Θ (cid:75) is the constant functor from (cid:74) Θ (cid:75) to the terminal category J and q P t´ , `u . § Lemma 40 (Weakening of Context Morphisms) . Let σ : s Θ (cid:32) Ξ be arbitrary and Θ , Ω acontext. Then σ : s Ω , Θ (cid:32) Ξ and where p ranges over t´ , `u , (cid:74) σ : s Ω , Θ (cid:32) Ξ (cid:75) p “ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p π Ω , ΘΘ . Proof.
By induction on the derivation of σ : s Θ (cid:32) Ξ. Case (S-S-Empty).
Then σ : s Ω , Θ (cid:32) ¨ by ( S-S-Empty ). Moreover, (cid:74) σ : s Ω , Θ (cid:32) ¨ (cid:75) p “ J CFP “ J Θ π Ω , ΘΘ “ (cid:74) σ : s Θ (cid:32) ¨ (cid:75) p π Ω , ΘΘ . Case (S-S-T q ). σ : s Θ (cid:32) Ξ Θ $ A type q s σ, A : s Θ (cid:32) Ξ , α type q s p S-S-T q q Then by the induction hypothesis, σ : s Ω , Θ (cid:32) Ξ and (cid:74) σ : s Ω , Θ (cid:32) Ξ (cid:75) p “ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p π Ω , ΘΘ . By weakening, Ω , Θ $ A type q s , and by Proposition 38 (cid:74) Ω , Θ $ A type q s (cid:75) p “ (cid:74) Θ $ A type q s (cid:75) p π Ω , ΘΘ . . Kavanagh 57 By (
S-S-T q ), σ, A : s Ω , Θ (cid:32) Ξ , α type q s . By the interpretation of ( S-S-T q ), (cid:74) σ, A : s Ω , Θ (cid:32) Ξ , α type q s (cid:75) p “ x (cid:74) σ : s Ω , Θ (cid:32) Ξ (cid:75) p , α : (cid:74) Ω , Θ $ A type q s (cid:75) p y“ x (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p π Ω , ΘΘ , α : (cid:74) Θ $ A type q s (cid:75) p π Ω , ΘΘ y“ x (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p , α : (cid:74) Θ $ A type q s (cid:75) p y π Ω , ΘΘ “ (cid:74) σ, A : s Θ (cid:32) Ξ , α type q s (cid:75) p π Ω , ΘΘ . We conclude the result by induction. đ§ Proposition 41 (Semantic Substitution of Session Types) . Let σ : s Θ (cid:32) Ξ be arbitrary andlet p range over t´ , `u . If Ξ $ A type q s , then (cid:74) Θ $ σA type q s (cid:75) p “ (cid:74) Ξ $ A type q s (cid:75) p ˝ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p . Proof.
By induction on the derivation of Ξ $ A type s . As in Proposition 36, we describe thestandard case. Consider a type-forming ruleΞ $ A type s ¨ ¨ ¨ Ξ $ A n type s J ¨ ¨ ¨ J m Ξ $ F J ,..., J m p A , . . . , A n q type s Assume (cid:74) Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p is given by a natural interpretation (cid:74) F J ,..., J m (cid:75) p (cid:74) Ξ (cid:75) : ˜ n ź i “ CFP p (cid:74) Ξ (cid:75) , ω - aBC K ! q ¸ Ñ CFP p (cid:74) Ξ (cid:75) , ω - aBC K ! q . We need to show that (cid:74) Θ $ σ p F J ,..., J m p A , . . . , A n qq type s (cid:75) p “ (cid:74) Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p ˝ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p . By the definition of syntactic substitution, we know that σ p F J ,..., J m p A , . . . , A n qq “ F J ,..., J m p σA , . . . , σA n q . By the induction hypothesis, we know for 1 ď i ď n that (cid:74) Θ $ σA i type s (cid:75) p “ (cid:74) Ξ $ A i type s (cid:75) p ˝ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p . Using these facts, we get: (cid:74) Θ $ σ p F J ,..., J m p A , . . . , A n qq type s (cid:75) p “ (cid:74) Θ $ F J ,..., J m p σA , . . . , σA n q type s (cid:75) p “ (cid:74) F J ,..., J m (cid:75) p (cid:74) Θ (cid:75) ` p (cid:74) Θ $ σA i type s (cid:75) p q ď i ď n ˘ which by the induction hypothesis, “ (cid:74) F J ,..., J m (cid:75) p (cid:74) Θ (cid:75) ` p (cid:74) Ξ $ A i type s (cid:75) p ˝ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p q ď i ď n ˘ which by naturality of (cid:74) F J ,..., J m (cid:75) p , “ (cid:74) F J ,..., J m (cid:75) p (cid:74) Ξ (cid:75) ` p (cid:74) Ξ $ A i type s (cid:75) p q ď i ď n ˘ ˝ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p “ (cid:74) Ξ $ F J ,..., J m p A , . . . , A n q type s (cid:75) p ˝ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p . Case (C ). Ξ $ type ` s p C q By the standard proof and Proposition 37.
Case (CVar). Ξ , α type p s $ α type p s p CVar q Recall Equation (35): (cid:74) Ξ , α type p s $ α type p s (cid:75) q “ π Ξ ,αα p q P t´ , `uq Let σ, A : s Θ (cid:32) Ξ , α be arbitrary. (cid:74) Θ $ p σ, A q α type s (cid:75) q “ (cid:74) Θ $ A type s (cid:75) q “ id π Ξ ,αα ˝ x (cid:74) σ : s Θ (cid:32) Ξ (cid:75) q , α : (cid:74) Θ $ A type s (cid:75) q y“ (cid:74) Ξ , α type p s $ α type p s (cid:75) q ˝ (cid:74) σ, A : s Θ (cid:32) Ξ , α (cid:75) q . Case (C ρ ). Ξ , α type p s $ A type p s Ξ $ ρα.A type p s p C ρ q Recall Equation (36): (cid:74) Ξ $ ρα.A type s (cid:75) p “ p (cid:74) Ξ , α type s $ A type s (cid:75) p q : p p P t´ , `uq The result follows from a tweak of the standard proof and Proposition 37. Let σ : s Θ (cid:32) Ξ be arbitrary. By Lemma 40, we can weaken it to σ, α : s Θ , α (cid:32) Ξ , α . Let η p : CFP p´ ˆ (cid:74) α (cid:75) , ω - aBC K ! q ñ CFP p´ , ω - aBC K ! q be the natural interpretation givenby Proposition 37. Then (cid:74) Θ $ σ p ρα.A q type s (cid:75) p “ (cid:74) Θ $ ρα. p σ, α q A type s (cid:75) p “ η p (cid:74) Θ (cid:75) p (cid:74) Θ , α $ p σ, α q A type s (cid:75) p q which by the induction hypothesis: “ η p (cid:74) Θ (cid:75) p (cid:74) Ξ , α $ A type s (cid:75) p ˝ (cid:74) σ, α : s Θ , α (cid:32) Ξ , α (cid:75) p q which by the interpretation of ( S-S-T q ): “ η p (cid:74) Θ (cid:75) p (cid:74) Ξ , α $ A type s (cid:75) p ˝ x (cid:74) σ : s Θ , α (cid:32) Ξ (cid:75) p , α : (cid:74) Θ , α $ α type s (cid:75) p yq which by Equation (36): “ η p (cid:74) Θ (cid:75) ´ (cid:74) Ξ , α $ A type s (cid:75) p ˝ x (cid:74) σ : s Θ , α (cid:32) Ξ (cid:75) p , α : id π Θ ,αα y ¯ which by Lemma 40: “ η p (cid:74) Θ (cid:75) ´ (cid:74) Ξ , α $ A type s (cid:75) p ˝ x (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p π Θ ,α Θ , α : id π Θ ,αα y ¯ which by a property of products and projections: “ η p (cid:74) Θ (cid:75) p (cid:74) Ξ , α $ A type s (cid:75) p ˝ p (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p ˆ (cid:74) α (cid:75) qq which by naturality: “ η p (cid:74) Ξ (cid:75) p (cid:74) Ξ , α $ A type s (cid:75) p q ˝ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p “ (cid:74) Ξ $ ρα.A type s (cid:75) p ˝ (cid:74) σ : s Θ (cid:32) Ξ (cid:75) p . . Kavanagh 59 Case (C Ó ). Ξ $ A type ´ s Ξ $ Ó A type ` s p C Óq By the standard proof and Proposition 37.
Case (C Ò ). Ξ $ A type ` s Ξ $ Ò A type ´ s p C Òq By the standard proof and Proposition 37.
Case (C ‘ ). Ξ $ A l type ` s p@ l P L q Ξ $ ‘t l : A l u l P L type ` s p C ‘q By the standard proof and Proposition 37.
Case (C & ). Ξ $ A l type ´ s p@ l P L q Ξ $ & t l : A l u l P L type ´ s p C & q By the standard proof and Proposition 37.
Case (C b ). Ξ $ A type ` s Ξ $ B type ` s Ξ $ A b B type ` s p C bq By the standard proof and Proposition 37.
Case (C (cid:40) ). Ξ $ A type ` s Ξ $ B type ´ s Ξ $ A (cid:40) B type ´ s p C (cid:40) q By the standard proof and Proposition 37.
Case (C ^ ). τ type f Ξ $ A type ` s Ξ $ τ ^ A type ` s p C ^q By the standard proof and Proposition 37.
Case (C Ą ). τ type f Ξ $ A type ´ s Ξ $ τ Ą A type ´ s p C Ąq By the standard proof and Proposition 37. đ E.3 Interpretations are Well-Defined
In this section we show that our interpretations are all well-defined, i.e., that the polarizedaspects are locally continuous functors. § Proposition 42 (Functorial Interpretations are Well-Defined) . If Ξ $ A type s , then theinterpretations (cid:74) Ξ $ A type s (cid:75) ´ and (cid:74) Ξ $ A type s (cid:75) ` are locally continuous functors from (cid:74) Ξ (cid:75) to ω - aBC K ! . Proof.
By induction on the derivation of Ξ $ A type s . We must show that each of thefunctor interpretations is locally continuous. Case (C ). Ξ $ type ` s p C q Recall Equations (19) and (20): (cid:74) Ξ $ type s (cid:75) ´ “ λξ. J ω - aBC K ! (cid:74) Ξ $ type s (cid:75) ` “ λξ. t˚u K Constant functors are easily seen to be locally continuous.
Case (CVar). Ξ , α type p s $ α type p s p CVar q Recall Equation (35): (cid:74) Ξ , α type p s $ α type p s (cid:75) q “ π Ξ ,αα p q P t´ , `uq Projection functors are easily seen to be locally continuous.
Case (C ρ ). Ξ , α type p s $ A type p s Ξ $ ρα.A type p s p C ρ q Recall Equation (36): (cid:74) Ξ $ ρα.A type s (cid:75) p “ p (cid:74) Ξ , α type s $ A type s (cid:75) p q : p p P t´ , `uq By the induction hypothesis, (cid:74) Ξ , α type s $ A type s (cid:75) p is locally continuous. By [5, Propos-ition 5.2.7], we know that whenever F : (cid:74) Ξ (cid:75) ˆ ω - aBC K ! Ñ ω - aBC K ! is locally continuous,then so is F : : (cid:74) Ξ (cid:75) Ñ ω - aBC K ! . It follows that the interpretations are locally continuous. Case (C Ó ). Ξ $ A type ´ s Ξ $ Ó A type ` s p C Óq Recall Equations (27) and (28): (cid:74) Ξ $ Ó A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ (cid:74) Ξ $ Ó A type s (cid:75) ` “ (cid:74) Ξ $ A type s (cid:75) `K By the induction hypothesis, the interpretations for Ξ $ A type s are locally continuous.The lifting functor is locally continuous. Locally continuous functors are closed undercomposition. This gives the result. . Kavanagh 61 Case (C Ò ). Ξ $ A type ` s Ξ $ Ò A type ´ s p C Òq This case is analogous to the case ( C Ó ). Case (C ‘ ). Ξ $ A l type ` s p@ l P L q Ξ $ ‘t l : A l u l P L type ` s p C ‘q Recall Equations (31) and (32): (cid:74) Ξ $ ‘t l : A l u l P L type s (cid:75) ´ “ ź l P L (cid:74) Ξ $ A l type s (cid:75) ´ (cid:74) Ξ $ ‘t l : A l u l P L type s (cid:75) ` “ à l P L (cid:74) Ξ $ A l type s (cid:75) `K By the induction hypothesis, the interpretations for Ξ $ A type s are locally continuous.The lifting, coalesced-sum, and product functors are locally continuous. Locally continuousfunctors are closed under composition. This gives the result. Case (C & ). Ξ $ A l type ´ s p@ l P L q Ξ $ & t l : A l u l P L type ´ s p C & q This case is analogous to the case ( C ‘ ). Case (C b ). Ξ $ A type ` s Ξ $ B type ` s Ξ $ A b B type ` s p C bq Recall Equations (23) and (24): (cid:74) Ξ $ A b B type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ ˆ (cid:74) Ξ $ B type s (cid:75) ´ (cid:74) Ξ $ A b B type s (cid:75) ` “ ` (cid:74) Ξ $ A type s (cid:75) ` ˆ (cid:74) Ξ $ B type s (cid:75) ` ˘ K By the induction hypothesis, the interpretations for Ξ $ A type s and Ξ $ B type s arelocally continuous. The lifting and product functors are locally continuous. Locallycontinuous functors are closed under composition. This gives the result. Case (C (cid:40) ). Ξ $ A type ` s Ξ $ B type ´ s Ξ $ A (cid:40) B type ´ s p C (cid:40) q This case is analogous to the case ( C b ). Case (C ^ ). τ type f Ξ $ A type ` s Ξ $ τ ^ A type ` s p C ^q Recall Equations (13) and (14): (cid:74) Ξ $ τ ^ A type s (cid:75) ´ “ (cid:74) Ξ $ A type s (cid:75) ´ (cid:74) Ξ $ τ ^ A type s (cid:75) ` “ ` (cid:74) τ (cid:75) ˆ (cid:74) Ξ $ A type s (cid:75) ` ˘ K By the induction hypothesis, the interpretations for Ξ $ A type s are locally continuous.The constant functor (cid:74) τ (cid:75) , the lifting functor, and the product functors are locallycontinuous. Locally continuous functors are closed under composition. This givesthe result. Case (C Ą ). τ type f Ξ $ A type ´ s Ξ $ τ Ą A type ´ s p C Ąq This case is analogous to the case ( C ^ ). đ F Illustrative Example: Flipping Bit Streams
We give the full details for the case study in Section 6. We will show that flipping thebits in a stream twice is equivalent to forwarding it. The bit stream protocol is specifiedby the session type bits “ ρβ. ‘ t : β, : β u . It denotes the domains (cid:74) bits (cid:75) ` “ FIX p X ÞÑ pp : X K q ‘ p : X K qqq and (cid:74) bits (cid:75) ´ “ tKu . Its unfolding is BITS “ ‘t : bits , : bits u . There are canonical isomorphisms Unfold ` : (cid:74) bits (cid:75) ` Ñ `` : (cid:74) bits (cid:75) `K ˘ ‘ ` : (cid:74) bits (cid:75) `K ˘˘ Unfold ´ : tKu Ñ tp : K , : Kqu with respective inverses
Fold ` and Fold ´ . Write :: α and :: α for Fold ` pp , r α sqq and Fold ` pp , r α sqq , respectively.We desugar the bit-flipping process flip . Write ˜ l for the complement of l P t , u .Desugaring the quoted process gives a term ¨ , flip : t f : bits Ð b : bits u where flip is: fix F.f Ð (cid:32) send f unfold ; unfold Ð recv b ; case b t l ñ f. ˜ l ; f Ð t F u Ð b u l Pt , u ( Ð b. We compute its denotation. Let φ “ t f : bits Ð b : bits u . The branch B “ f.1; f <- F <- b of flip ’s case statement has the derivation: F : φ , F : φ p F-Var q F : φ ; b : bits $ f Ð t F u Ð b :: f : bits p E-{} q F : φ ; b : bits $ f. ; f Ð t F u Ð b :: f : BITS p‘ R q We calculate that its denotation is: (cid:74) F : φ ; b : bits $ f. ; t Ð t F u Ð b :: f : BITS (cid:75) p F : g q ` b ` , K ˘ “ ` K , “` , a ` ˘‰˘ where pK , a ` q “ down p g q p b ` , Kq . The branch B “ f.0; f <- F <- b is symmetric.The functional term flip has the derivation: F : φ ; b : bits $ B l :: f : BITS p@ l P t , uq F : φ ; b : BITS $ case b t l ñ B l u l Pt , u :: f : BITS p‘ L q F : φ ; b : bits $ unfold Ð recv b ; case b t l ñ B l u l Pt , u :: f : BITS p ρ ` L q F : φ ; b : bits $ send f unfold ; unfold Ð recv b ; case b t l ñ B l u l Pt , u :: f : bits p ρ ` R q F : φ , f Ð (cid:32) send f unfold ; unfold Ð recv b ; case b t l ñ B l u l Pt , u ( Ð b : φ p I-{} q¨ , fix F.f Ð (cid:32) send f unfold ; unfold Ð recv b ; case b t l ñ B l u l Pt , u ( Ð b : φ p F-Fix q . Kavanagh 63 We calculate its denotation as follows. First, we find the denotation of the process: (cid:74) F : φ ; b : bits $ send f unfold ; unfold Ð recv b ; case b t l ñ B l u l Pt , u :: f : bits (cid:75) p F : g q“ strict b ` ¨˚˚˝ λ p b ` , Kq . K , :: a ` ˘ if b ` “ :: b ` ` K , :: a ` ˘ if b ` “ :: b ` where down p g q p b ` l , Kq “ pK , a ` l q for l P L ˛‹‹‚ Let Φ : (cid:74) b : bits $ a : bits (cid:75) Ñ (cid:74) b : bits $ a : bits (cid:75) be the functionΦ p r q “ strict b ` ¨˚˚˝ λ p b ` , Kq . K , :: a ` ˘ if b ` “ :: b ` ` K , :: a ` ˘ if b ` “ :: b ` where r p b ` l , Kq “ pK , a ` l q for l P L ˛‹‹‚ Quoting the process gives: (cid:74) F : φ , f Ð t send f unfold ; . . . u Ð b : φ (cid:75) “ up ˝ (cid:74) F : φ ; b : bits $ send f unfold ; . . . :: f : bits (cid:75) “ up ˝ Φ ˝ down By Equation (9), fixing the functional variable F gives: (cid:74) ¨ , fix F.f
Ð t send f unfold ; . . . u Ð b : φ (cid:75) K“ (cid:74) F : φ , f Ð t send f unfold ; . . . u Ð b : φ (cid:75) : K“ p up ˝ Φ ˝ down q : K“ fix p up ˝ Φ ˝ down q which by Proposition 31: “ up p fix p Φ qq . Consider the composition ¨ ; a : bits $ t Ð t flip u Ð a ; b Ð t flip u Ð t :: b : bits oftwo bit-flipping processes. We want to show that it is equivalent to forwarding, i.e., that (cid:74) ¨ ; a : bits $ t Ð t flip u Ð a ; b Ð t flip u Ð t :: b : bits (cid:75) “ (cid:74) ¨ ; a : bits $ b Ð a :: b : bits (cid:75) . This means that we must show for all p a ` , Kq P (cid:74) a : bits (cid:75) ` ˆ (cid:74) b : bits (cid:75) ´ : (cid:74) ¨ ; a : bits $ t Ð t flip u Ð a ; b Ð t flip u Ð t :: b : bits (cid:75) Kp a ` , Kq “ pK , a ` q . (70)We first compute the denotation of the composition. By Equation (12), (cid:74) ¨ ; a : bits $ t Ð t flip u Ð a ; b Ð t flip u Ð t :: b : bits (cid:75) Kp a ` , Kq“ Tr t ´ ˆ t ` p down p (cid:74) ¨ , flip : t t : bits Ð a : bits u (cid:75) Kq ˆˆ down p (cid:74) ¨ , flip : t b : bits Ð t : bits u (cid:75) Kqq p a ` , Kq“ Tr t ´ ˆ t ` p down p up p fix p Φ qqq ˆ down p up p fix p Φ qqqq p a ` , Kq“ Tr t ´ ˆ t ` p fix p Φ q ˆ fix p Φ qq p a ` , Kq which by Lemma 32 with σ : (cid:74) a : bits (cid:75) ´ ˆ (cid:74) t : bits (cid:75) ` Ñ (cid:74) t : bits (cid:75) ` ˆ (cid:74) b : bits (cid:75) ´ theobvious relabelling isomorphism: “ p fix p Φ q ˝ σ ˝ fix p Φ qq p a ` , Kq Alternatively, we could compute the denotation as the least upper bound of an ascendingchain: (cid:74) ¨ ; a : bits $ t Ð t flip u Ð a ; b Ð t flip u Ð t :: b : bits (cid:75) Kp a ` , Kq“ Tr t ´ ˆ t ` p fix p Φ q ˆ fix p Φ qq p a ` , Kq“ Tr t ´ ˆ t ` p down p (cid:74) ¨ , flip : t t : bits Ð a : bits u (cid:75) Kq ˆˆ down p (cid:74) ¨ , flip : t b : bits Ð t : bits u (cid:75) Kqq p a ` , Kq“ ğ Ò n P N p b ´ n , a ` n q where we inductively define p a ´ , t ` q “ (cid:74) ¨ , flip : t t : bits Ð a : bits u (cid:75) Kp a ` , Kq “ fix p Φ qp a ` , Kqp t ´ , b ` q “ (cid:74) ¨ , flip : t b : bits Ð t : bits u (cid:75) KpK , Kq “ fix p Φ qpK , Kqp a ´ n ` , t ` n ` q “ (cid:74) ¨ , flip : t t : bits Ð a : bits u (cid:75) Kp a ` , t ´ n q “ fix p Φ qp a ` , t ´ n qp t ´ n ` , b ` n ` q “ (cid:74) ¨ , flip : t b : bits Ð t : bits u (cid:75) Kp t ` n , Kq “ fix p Φ p t ` n , Kq . We observe that a ´ n “ t ´ n “ K and t ` n “ t ` n ` for all n P N , so this chain stabilizes and stopsevolving at n “
2. We conclude that ğ Ò n P N p b ´ n , a ` n q “ p b ´ , a ` q “ p fix p Φ q ˝ σ ˝ fix p Φ qq p a ` , Kq . Given an a P (cid:74) bits (cid:75) ` , let a be given by p fix p Φ q ˝ σ ˝ fix p Φ qq p a, Kq “ pK , a q . To showEquation (70), we must show that a “ a for all a P (cid:74) bits (cid:75) ` . We begin by characterizing a .We claim that: if a “ K , then a “ K ; if a “ :: α , then a “ :: α ; if a “ :: α , then a “ :: α .Claim 1 is clear by strictness. By the fixed-point identity fix p Φ q “ Φ p fix p Φ qq , we have for all α P (cid:74) bits (cid:75) ` that: fix p Φ qp :: α, Kq “ Φ p fix p Φ qqp :: α, Kq “ pK , :: β q where pK , β q “ fix p Φ qp α, Kq fix p Φ qp :: α, Kq “ Φ p fix p Φ qqp :: α, Kq “ pK , :: β q where pK , β q “ fix p Φ qp α, Kq These imply: p fix p Φ q ˝ σ ˝ fix p Φ qq p :: α, Kq “ fix p Φ qp :: β, Kq “ p :: α , Kq (71) p fix p Φ q ˝ σ ˝ fix p Φ qq p :: α, Kq “ fix p Φ qp :: β, Kq “ p :: α , Kq . (72)Equations (71) and (72) respectively establish claims 2 and 3.To show that a “ a , we use a coinduction principle by Pitts [37]. Given a relation R on (cid:74) bits (cid:75) `K , let ˆ R be the relation on (cid:74) BITS (cid:75) `K where a ˆ R b if and only if for all α P (cid:74) bits (cid:75) ` :if a “ rp , r α sqs , then b “ rp , r β sqs for some β P (cid:74) bits (cid:75) ` with r α s R r β s ;if a “ rp , r α sqs , then b “ rp , r β sqs for some β P (cid:74) bits (cid:75) ` with r α s R r β s . . Kavanagh 65 The relation R is a simulation if a R b implies Unfold `K p a q ˆ R Unfold `K p b q . By [37, The-orem 2.5], a Ď b in (cid:74) bits (cid:75) `K if and only if there exists a simulation R such that a R b . Let R Ď (cid:74) bits (cid:75) `K ˆ (cid:74) bits (cid:75) `K be the relation: R “ (cid:32) prKs , rKsq , pr :: α s , “ :: α ‰ q , pr :: α s , “ :: α ‰ q | α P (cid:74) bits (cid:75) ` ( . Assume R is a simulation. To show that a Ď a , it is sufficient to show that r a s R r a s . If a “ K , then a “ K by strictness. If a “ :: α , then a “ :: α by Equation (71). If a “ :: α , then a “ :: α by Equation (72).So r a s R r a s by definition of R . It follows that a Ď a .The relation R is clearly a simulation if and only if R op is a simulation. So a R op a ,which gives a Ď a . We conclude a “ a as desired.We now show that R is a simulation. Let pr a s , r b sq P R be arbitrary. We must show that Unfold `K pr a sq ˆ R Unfold `K pr b sq . Assume first that a “ :: α . By definition of R , b “ :: α . Wehave Unfold `K p a q “ rp , r α sqs and Unfold `K p b q “ rp , r α sqs . We must show that r α s R r α s .We proceed by case analysis on α . If α “ K , then α “ K by strictness, and rKs R rKs by definition of R . If α “ :: γ , then α “ :: γ by Equation (71), and r :: γ s R r :: γ s by definition of R . If α “ :: γ , then α “ :: γ by Equation (72), and r :: γ s R r :: γ s by definition of R .This completes the case of a “ :: α . The case of a “ :: α is symmetric. We conclude that R is a simulation.It follows that flipping a stream twice is equivalent to forwarding (the identity process). G Proofs for Results in the Paper
We restate the statements of the results in the main part of the paper and give their proofs. § Proposition 2.
For all Ψ , x : τ , M : τ , we have r fix x.M { x s M ” fix x.M . Proof.
Let Ψ “ ψ : τ , . . . , ψ n : τ n . By Equation (9), (cid:74) Ψ , fix x.M : τ (cid:75) “ (cid:74) Ψ , x : τ , M : τ (cid:75) : . By the parametrized fixed-point property (Definition 22), (cid:74) Ψ , x : τ , M : τ (cid:75) : “ (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ x id (cid:74) Ψ (cid:75) , (cid:74) Ψ , fix x.M : τ (cid:75) y . By Equation (6) and properties of products, this equals (cid:74) Ψ , x : τ , M : τ (cid:75) ˝ x (cid:74) Ψ , ψ : τ (cid:75) , . . . , (cid:74) Ψ , ψ n : τ n (cid:75) , (cid:74) Ψ , fix x.M : τ (cid:75) y , which by Proposition 16 is (cid:74) Ψ , r fix x.M { x s M : τ (cid:75) . đ§ Proposition 3.
For all
Ψ ; a i : A i $ P :: a : A , we have P ” a Ð t a Ð t P u Ð a i u Ð a i . Proof.
Let u P (cid:74) Ψ (cid:75) be arbitrary. Using the fact that p up , down q is a section-retraction pair,we get (cid:74) Ψ ; a i : A i $ a Ð t a Ð t P u Ð a i u Ð a i :: a : A (cid:75) u “ down ` (cid:74) Ψ , a Ð t P u Ð a i : t a : A Ð a i : A i u (cid:75) u ˘ “ down `` up ˝ (cid:74) Ψ ; a i : A i $ P :: a : A (cid:75) ˘ u ˘ “ p down ˝ up q ` (cid:74) Ψ ; a i : A i $ P :: a : A (cid:75) u ˘ “ (cid:74) Ψ ; a i : A i $ P :: a : A (cid:75) u. đ The proofs of the η -like equivalences make extensive use of the Knaster-Tarski formulation(58) of the trace operator. Though the proofs are detailed, they are not conceptually difficult. § Proposition 4.
For all
Ψ ; ∆ $ P :: a : A , all Ψ , x : τ ; a : A, ∆ $ Q :: c : C , andall Ψ , M : τ , we have a Ð P ; r M { x s Q ” a Ð p _ Ð output a M ; P q ; p x Ð input a ; Q q whenever (cid:74) Ψ , M : τ (cid:75) u ‰ K for all u P (cid:74) Ψ (cid:75) . Proof.
Given u P (cid:74) Ψ (cid:75) , write ˆ u for r u | x ÞÑ (cid:74) Ψ , M : τ (cid:75) u s P (cid:74) Ψ , x : τ (cid:75) . Set l : (cid:74) Ψ (cid:75) ˆ (cid:74) ∆ , ∆ , a : A (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ Ñ (cid:74) ∆ , ∆ , a : A (cid:75) ´ ˆ (cid:74) c : C (cid:75) ` l “ Λ ´ p λu P (cid:74) Ψ (cid:75) . (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u ˆ (cid:74) Ψ , x : τ ; ∆ , a : A $ Q :: c : C (cid:75) ˆ u q r : (cid:74) Ψ (cid:75) ˆ (cid:74) ∆ , ∆ , a : τ ^ A (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ Ñ (cid:74) ∆ , ∆ , a : τ ^ A (cid:75) ´ ˆ (cid:74) c : C (cid:75) ` r “ Λ ´ p λu P (cid:74) Ψ (cid:75) . (cid:74) Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A (cid:75) u ˆˆ (cid:74) Ψ ; ∆ , a : τ ^ A $ x Ð input a ; Q :: c : C (cid:75) u q Let x i : τ i be such that Ψ “ x : τ , . . . , x n : τ n . By substitution (Proposition 36), we have (cid:74) Ψ ; ∆ , ∆ $ a Ð P ; r M { x s Q :: c : C (cid:75) u “ p (cid:74) Ψ , x : τ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) ˝˝ x (cid:74) Ψ , x : τ (cid:75) , . . . , (cid:74) Ψ , x n : τ n (cid:75) , (cid:74) Ψ , M : τ (cid:75) yq u “ ` (cid:74) Ψ , x : τ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) ˝ x id (cid:74) Ψ (cid:75) , (cid:74) Ψ , M : τ (cid:75) y ˘ u “ (cid:74) Ψ , x : τ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) r u | x ÞÑ (cid:74) Ψ , M : τ (cid:75) u s“ (cid:74) Ψ , x : τ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) ˆ u which by Equation (18): “ Tr a ´ ˆ a ` ∆ ` ˆ ∆ ` ˆ c ´ , ∆ ´ ˆ ∆ ´ ˆ c ` p (cid:74) Ψ , x : τ ; ∆ $ P :: a : A (cid:75) ˆ u ˆˆ (cid:74) Ψ , x : τ ; ∆ , a : A $ Q :: c : C (cid:75) ˆ u q which by coherence (Proposition 15): “ Tr a ´ ˆ a ` ∆ ` ˆ ∆ ` ˆ c ´ , ∆ ´ ˆ ∆ ´ ˆ c ` p (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) u ˆˆ (cid:74) Ψ , x : τ ; ∆ , a : A $ Q :: c : C (cid:75) ˆ u q which by Proposition 29: “ λ p δ ` , δ ` , c ´ q P (cid:74) ∆ , ∆ (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ . Tr a ´ ˆ a ` Ψ ˆ ∆ ` ˆ ∆ ` ˆ c ´ , ∆ ´ ˆ ∆ ´ ˆ c ` p l q p u, δ ` , δ ` , c ´ q . Similarly, we have (cid:74)
Ψ ; ∆ , ∆ $ a Ð p _ Ð output a M ; P q ; p x Ð input a ; Q q :: c : C (cid:75) u “ Tr a ´ ˆ a ` p (cid:74) Ψ ; ∆ $ _ Ð output a M ; P :: a : τ ^ A (cid:75) u ˆˆ (cid:74) Ψ ; ∆ , a : τ ^ A $ x Ð input a ; Q :: c : C (cid:75) u q which by Proposition 29: “ λ p δ ` , δ ` , c ´ q P (cid:74) ∆ , ∆ (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ . Tr a ´ ˆ a ` Ψ ˆ ∆ ` ˆ ∆ ` ˆ c ´ , ∆ ´ ˆ ∆ ´ ˆ c ` p r q p u, δ ` , δ ` , c ´ q . We abbreviate judgments by their processes. We use the Knaster-Tarski formulation(58) of the trace operator. Let u P (cid:74) Ψ (cid:75) and p δ ` , δ ` , c ´ q P (cid:74) ∆ , ∆ (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ be arbitrary. . Kavanagh 67 Using the above chains of equations, we calculate that (cid:74)
Ψ ; ∆ , ∆ $ a Ð P ; r M { x s Q :: c : C (cid:75) u p δ ` , δ ` , c ´ q“ π ∆ ´ , ∆ ´ ,c ` ´ (cid:108) L ¯ , (cid:74) Ψ ; ∆ , ∆ $ a Ð p _ Ð output a M ; P q ; p x Ð input a ; Q q :: c : C (cid:75) u p δ ` , δ ` , c ´ q“ π ∆ ´ , ∆ ´ ,c ` ´ (cid:108) R ¯ where L “ (cid:32)` δ ´ , δ ´ , a ´ , a ` , c ` ˘ P (cid:74) ∆ , ∆ , a : A (cid:75) ´ ˆ (cid:74) a : A, c : C (cid:75) ` || l p u, δ ` , δ ` , a ` , a ´ , c ´ q Ď p δ ´ , δ ´ , a ´ , a ` , c ` q ( R “ (cid:32)` δ ´ , δ ´ , a ´ , a ` , c ` ˘ P (cid:74) ∆ , ∆ , a : τ ^ A (cid:75) ´ ˆ (cid:74) a : τ ^ A, c : C (cid:75) ` || r p u, δ ` , δ ` , a ` , a ´ , c ´ q Ď p δ ´ , δ ´ , a ´ , a ` , c ` q ( . Infima of products are computed component-wise, so to show the semantic equivalence, itis sufficient to show that π ∆ ´ , ∆ ´ ,c ` L “ π ∆ ´ , ∆ ´ ,c ` R . Set v “ (cid:74) Ψ , M : τ (cid:75) u .To show π ∆ ´ , ∆ ´ ,c ` L Ď π ∆ ´ , ∆ ´ ,c ` R , let p δ ´ , δ ´ , a ´ , a ` , c ` q P L be arbitrary. We showthat there exists p α ´ , α ` q P (cid:74) a : τ ^ A (cid:75) ´ ˆ (cid:74) a : τ ^ A (cid:75) ` such that p δ ´ , δ ´ , α ´ , α ` , c ` q P R .Then where (cid:74) P (cid:75) u p δ ` , a ´ q “ p δ ´ P , a ` P q and (cid:74) Q (cid:75) ˆ u p δ ` , a ` , c ´ q “ p δ ´ Q , a ´ Q , c ` Q q , l p u, δ ` , δ ` , a ` , a ´ , c ´ q “ p δ ´ : δ ´ P , δ ´ : δ ´ Q , a ´ : a ´ Q , a ` : a ` P , c ` : c ` Q q . By definition of L , p δ ´ P , δ ´ Q , a ´ Q , a ` P , c ` Q q Ď p δ ´ , δ ´ , a ´ , a ` , c ` q . (73)Take α ´ “ a ´ and α ` “ rp v, a ` qs . We show that p δ ´ , δ ´ , a ´ , rp v, a ` qs , c ` q P R . Byassumption, (cid:74) Ψ , M : τ (cid:75) u “ v ‰ K . By definition of r , r p u, δ ` , δ ` , “ p v, a ` q ‰ , a ´ , c ´ q“ p (cid:74) _ Ð output a M ; P (cid:75) u ˆ (cid:74) x Ð input a ; Q (cid:75) u q p δ ` , δ ` , “ p v, a ` q ‰ , a ´ , c ´ q“ p (cid:74) _ Ð output a M ; P (cid:75) u p δ ` , a ´ q , (cid:74) x Ð input a ; Q (cid:75) u p δ ` , “ p v, a ` q ‰ , c ´ qq“ p (cid:74) _ Ð output a M ; P (cid:75) u p δ ` , a ´ q , (cid:74) Q (cid:75) ˆ u p δ ` , a ` , c ´ qq“ p δ ´ : δ ´ P , δ ´ : δ ´ Q , a ´ : a ´ Q , a ` : “ p v, a ` P q ‰ , c ` : c ` Q q . We must show that p δ ´ P , δ ´ Q , a ´ Q , “ p v, a ` P q ‰ , c ` Q q Ď p δ ´ , δ ´ , a ´ , “ p v, a ` q ‰ , c ` q . But this inequality follows readily from Equation (73).To show π ∆ ´ , ∆ ´ ,c ` R Ď π ∆ ´ , ∆ ´ ,c ` L , let p δ ´ , δ ´ , a ´ , a ` , c ` q P R be arbitrary. We showthat there exists p α ´ , α ` q P (cid:74) a : A (cid:75) ´ ˆ (cid:74) a : A (cid:75) ` such that p δ ´ , δ ´ , α ´ , α ` , c ` q P L . Where (cid:74) P (cid:75) u p δ ` , a ´ q “ p δ ´ P , a ` P q , p π a ` ˝ r qp u, δ ` , δ ` , a ` , a ´ , c ´ q “ “ p v, a ` P q ‰ . The definition of R implies “ p v, a ` P q ‰ Ď a ` . This implies that a ` “ rp v , a qs for some v P (cid:74) τ (cid:75) and a P (cid:74) A (cid:75) ` . So where (cid:74) Q (cid:75) ˆ u p δ ` , a ` , c ´ q “ p δ ´ Q , a ´ Q , c ` Q q , r p u, δ ` , δ ` , a ` , a ´ , c ´ q “ p δ ´ : δ ´ P , δ ´ : δ ´ Q , a ´ : a ´ Q , a ` : “ p v, a ` P q ‰ , c ` : c ` Q q . By definition of R , p δ ´ P , δ ´ Q , a ´ Q , “ p v, a ` P q ‰ , c ` Q q Ď p δ ´ , δ ´ , a ´ , “ p v , a q ‰ , c ` q . (74)Take α ´ “ a ´ and α ` “ a . Then by Equation (74), p δ ´ P , δ ´ Q , a ´ Q , a ` P , c ` Q q Ď p δ ´ , δ ´ , α ´ , α ` , c ` q . But l p u, δ ` , δ ` , α ` , α ´ , c ´ q “ p δ ´ : δ ´ P , δ ´ : δ ´ Q , a ´ : a ´ Q , a ` : a ` P , c ` : c ` Q q . By transitivity, l p u, δ ` , δ ` , α ` , α ´ , c ´ q Ď p δ ´ , δ ´ , α ´ , α ` , c ` q . We conclude that p δ ´ , δ ´ , α ´ , α ` , c ` q P L and we are done. đ§ Proposition 5.
For all
Ψ ; ∆ $ P :: c : C , all Ψ ; c : C , ∆ $ P :: c : C , and all Ψ ; c : C , ∆ $ P :: c : C , we have c Ð P ; p c Ð P ; P q ” c Ð p c Ð P ; P q ; P . Proof.
This is an immediate corollary of Proposition 27. đ§ Proposition 6.
For all
Ψ ; ∆ $ P :: c : C , we have P ” a Ð close a ; p wait a ; P q . Proof.
We use the Knaster-Tarski formulation (58) of the trace operator. Let u P (cid:74) Ψ (cid:75) and p δ ` , c ´ q P (cid:74) ∆ (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ be arbitrary. We abbreviate judgments by their processes andcalculate that (cid:74) a Ð close a ; p wait a ; P q (cid:75) u p δ ` , c ´ q “ π ∆ ´ ˆ c ` p (cid:100) R q where r “ (cid:74) Ψ ; ¨ $ close a :: a : (cid:75) u ˆ (cid:74) Ψ ; ∆ , a : $ wait a ; P :: c : C (cid:75) uR “ (cid:32) p δ ` , a ´ , a ` , c ´ q P (cid:74) ∆ , a : A (cid:75) ` ˆ (cid:74) a : A, c : C (cid:75) ´ || r p a ´ , δ ` , a ` , c ´ q Ď p a ` , δ ´ , a ´ , c ` q ( . To show that (cid:74) P (cid:75) u p δ ` , c ´ q “ (cid:74) a Ð close a ; p wait a ; P q (cid:75) u p δ ` , c ´ q it is sufficient to show that (cid:74) P (cid:75) u p δ ` , c ´ q “ π ∆ ´ ˆ c ` ´ (cid:108) R ¯ . Observe that for all a ` , c ` , δ ` , we have π a ` p f pK , δ ` , a ` , c ´ qq “ ˚ . Recall that ˚ is the topelement in (cid:74) (cid:75) ` . By monotonicity of f , this implies that every element in R is of the form p˚ , c ` , δ ´ , a ´ q . By definition of R and f , it then follows that every element in R is of theform p a ` : ˚ , c ` : v, δ ´ : w, a ´ : Kq where p δ ´ : w, c ` : v q “ (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) u p δ ` , c ´ q .This gives the result. đ§ Proposition 7.
For all
Ψ ; ∆ $ P :: a : A and Ψ ; a : A, ∆ , b : B $ Q :: c : C , we have a Ð P ; Q ” b Ð p send a b ; P q ; p b Ð recv a ; Q q . Proof.
We use the Knaster-Tarski formulation (58) of the trace operator. Let u P (cid:74) Ψ (cid:75) and p δ ` , δ ` , a ` , c ´ q P (cid:74) ∆ , ∆ , a : A (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ be arbitrary. We abbreviate judgments by . Kavanagh 69 their processes and calculate that (cid:74) b Ð p send b a ; P q ; p a Ð recv b ; Q q (cid:75) u p δ ` , δ ` , a ` , c ´ q “ π ∆ ´ , ∆ ´ ,a ´ ,c ` p (cid:100) L q and (cid:74) b Ð P ; Q (cid:75) u p δ ` , δ ` , a ` , c ´ q “ π ∆ ´ , ∆ ´ ,a ´ ,c ` p (cid:100) R q where l “ (cid:74) Ψ ; ∆ , a : A $ send b a ; P :: b : A b B (cid:75) u ˆˆ (cid:74) Ψ ; ∆ , b : A b B $ a Ð recv b ; Q :: c : C (cid:75) u,L “ (cid:32)` δ ´ , δ ´ , a ´ , b ´ , b ` , c ` ˘ P (cid:74) ∆ , ∆ , a : A, b : A b B (cid:75) ´ ˆ (cid:74) b : A b B, c : C (cid:75) ` || l p δ ` , δ ` , a ` , b ` , b ´ , c ´ q Ď p δ ´ , δ ´ , a ´ , b ´ , b ` , c ` q ( ,r “ (cid:74) Ψ ; ∆ $ P :: b : B (cid:75) u ˆ (cid:74) Ψ ; ∆ , a : A, b : B $ Q :: c : C (cid:75) u,R “ (cid:32)` δ ´ , δ ´ , a ´ , b ´ , b ` , c ` ˘ P (cid:74) ∆ , ∆ , a : A, b : B (cid:75) ´ ˆ (cid:74) b : B, c : C (cid:75) ` || r p δ ` , δ ` , a ` , b ` , b ´ , c ´ q Ď p δ ´ , δ ´ , a ´ , b ´ , b ` , c ` q ( . Infima of products are computed component-wise, so to show (cid:74) b Ð p send b a ; P q ; p a Ð recv b ; Q q (cid:75) u p δ ` , δ ` , a ` , c ´ q “ (cid:74) b Ð P ; Q (cid:75) u p δ ` , δ ` , a ` , c ´ q it is sufficient to show that π ∆ ´ , ∆ ´ ,a ´ ,c ` L “ π ∆ ´ , ∆ ´ ,a ´ ,c ` R .To show π ∆ ´ , ∆ ´ ,a ´ ,c ` L Ď π ∆ ´ , ∆ ´ ,a ´ ,c ` R , let ` δ ´ , δ ´ , a ´ , b ´ , b ` , c ` ˘ P L be arbitrary,then b ´ “ p b ´ a , b ´ b q . We show that there exist p β ´ , β ` q P (cid:74) b : B (cid:75) ´ ˆ (cid:74) b : B (cid:75) ` such that ` δ ´ , δ ´ , a ´ , β ´ , β ` , c ` ˘ P R . When b ` “ p b ` a , b ` b q K , we take β ` “ b ` b and β ´ “ b ´ b . Thenwhere (cid:74) P (cid:75) u p δ ` , b ´ b q “ p δ ´ P , b ` P q and (cid:74) Q (cid:75) u p δ ` , b ` a , b ` b , c ´ q “ p δ ´ Q , a ´ Q , b ´ Q , c ` Q q , l p δ ` , δ ` , a ` , p b ` a , b ` b q K , p b ´ a , b ´ b q , c ´ q“ p δ ´ : δ ´ P , δ ´ : δ ´ Q , a ´ : b ´ a , b ´ : p a ´ Q , b ´ Q q , b ` : p a ` , b ` P q K , c ` : c ` Q q . By definition of L , p δ ´ P , δ ´ Q , b ´ a , p a ´ Q , b ´ Q q , p a ` , b ` P q K , c ` Q q Ď p δ ´ , δ ´ , a ´ , p b ´ a , b ´ b q , p b ` a , b ` b q , c ` q . (75)We show ` δ ´ , δ ´ , a ´ , β ´ , β ` , c ` ˘ P R . r ` δ ` , δ ` , a ` , b ` b , b ´ b , c ´ ˘ “ p δ ´ : δ ´ P , δ ´ : δ ´ Q , a ´ : a ´ Q , b ´ : b ´ Q , b ` : b ` P , c ` : c ` Q q . We must show p δ ´ P , δ ´ Q , a ´ Q , b ´ Q , b ` P , c ` Q q Ď p δ ´ , δ ´ , a ´ , b ´ b , b ` b , c ` q . All cases except a ´ Q Ď a ´ are immediate from Equation (75). That a ´ Q Ď a ´ follows by transit-ivity from a ´ Q Ď b ´ a and b ´ a Ď a ´ , both by Equation (75). This establishes the case when b ` “p b ` a , b ` b q K . The case b ` “ K is impossible. When b ` “ K , (cid:74) a Ð recv b ; Q (cid:75) u p δ ` , K , c ´ q “pK , K , Kq . Then by definition of l and L , l p δ ` , δ ` , a ` , p b ` a , b ` b q K , p b ´ a , b ´ b q , c ´ q“ p δ ´ : δ ´ P , δ ´ : K , a ´ : b ´ b , b ´ : K , b ` : p a ` , b ` P q K , c ` : Kq Ď p δ ´ , δ ´ , a ´ , p b ´ a , b ´ b q , K , c ` q . Looking at the b ` component, we have p a ` , b ` P q K Ď K , a contradiction. This establishes π ∆ ´ , ∆ ´ ,a ´ ,c ` L Ď π ∆ ´ , ∆ ´ ,a ´ ,c ` R .To show π ∆ ´ , ∆ ´ ,a ´ ,c ` R Ď π ∆ ´ , ∆ ´ ,a ´ ,c ` L , let ` δ ´ , δ ´ , a ´ , b ´ , b ` , c ` ˘ P R be arbitrary.We claim ` δ ´ , δ ´ , a ´ , p a ´ , b ´ q , p a ` , b ` q K , c ` ˘ P L . Where (cid:74) P (cid:75) u p δ ` , b ´ q “ p δ ´ P , b ` P q and (cid:74) Q (cid:75) u p δ ` , a ` , b ` , c ´ q “ p δ ´ Q , a ´ Q , b ´ Q , c ` Q q , r p δ ` , δ ` , a ` , b ` , b ´ , c ´ q “ p δ ´ : δ ´ P , δ ´ : δ ´ Q , a ´ : a ´ Q , b ´ : b ´ Q , b ` : b ` P , c ` : c ` Q q . By definition of R , p δ ´ P , δ ´ Q , a ´ Q , b ´ Q , b ` P , c ` Q q Ď p δ ´ , δ ´ , a ´ , b ´ , b ` , c ` q . (76)We compute l p δ ` , δ ` , a ` , p a ` , b ` q K , p a ´ , b ´ q , c ´ q“ p δ ´ : δ ´ P , δ ´ : δ ´ Q , a ´ : K , b ´ : p a ´ Q , b ´ Q q , b ` : p a ` , b ` P q K , c ` : c ` Q q . We must show p δ ´ P , δ ´ Q , K , p a ´ Q , b ´ Q q , p a ` , b ` P q K , c ` Q q Ď p δ ´ , δ ´ , a ´ , p a ´ , b ´ q , p a ` , b ` q K , c ` q . This follows immediately from Equation (76), so π ∆ ´ , ∆ ´ ,a ´ ,c ` R Ď π ∆ ´ , ∆ ´ ,a ´ ,c ` L .Having established π ∆ ´ , ∆ ´ ,a ´ ,c ` R “ π ∆ ´ , ∆ ´ ,a ´ ,c ` L , it follows that (cid:74) Ψ ; ∆ , ∆ , a : A $ b Ð p send b a ; P q ; p a Ð recv b ; Q q :: c : C (cid:75) u p δ ` , δ ` , a ` , c ´ q“ (cid:74) Ψ ; ∆ , ∆ , a : A $ b Ð P ; Q :: c : C (cid:75) u p δ ` , δ ` , a ` , c ´ q . Because p δ ` , δ ` , a ` , c ´ q was an arbitrary element in their domain, we conclude the functionsare equal. đ§ Proposition 9.
For all
Ψ ; ∆ $ P :: a : A and Ψ ; a : A, ∆ $ Q :: c : C , we have a Ð P ; Q ” a Ð p send a shift ; P q ; p shift Ð recv a ; Q q . Proof.
We abbreviate judgments by their processes. The function π a ` ˝ (cid:74) send a shift ; P (cid:75) u isnot strict because of the post-composition with up in the a ` component. By Proposition 28,this implies we can drop the strict a ` when computing the denotation of the cut processes: (cid:74) Ψ ; ∆ , ∆ $ a Ð p send a shift ; P q ; p shift Ð recv a ; Q q :: c : C (cid:75) u “ Tr a ´ ˆ a ` p (cid:74) send a shift ; P (cid:75) u ˆ (cid:74) shift Ð recv a ; Q (cid:75) u q“ Tr a ´ ˆ a ` ``` id ˆ ` a ` : up ˘˘ ˝ (cid:74) P (cid:75) u ˘ ˆ strict a ` ` (cid:74) Q (cid:75) u ˝ ` id ˆ ` a ` : down ˘˘˘˘ “ Tr a ´ ˆ a ` ``` id ˆ ` a ` : up ˘˘ ˝ (cid:74) P (cid:75) u ˘ ˆ ` (cid:74) Q (cid:75) u ˝ ` id ˆ ` a ` : down ˘˘˘˘ “ Tr a ´ ˆ a ` `` id ˆ ` a ` : up ˘˘ ˝ p (cid:74) P (cid:75) u ˆ (cid:74) Q (cid:75) u q ˝ ` id ˆ ` a ` : down ˘˘˘ Because p up , down q is a section-retraction pair, by Proposition 26: “ Tr a ´ ˆ a ` p (cid:74) P (cid:75) u ˆ (cid:74) Q (cid:75) u q“ (cid:74) Ψ ; ∆ , ∆ $ a Ð P ; Q :: c : C (cid:75) u. đ§ Proposition 11.
Let k P L . If Ψ ; ∆ $ P :: a : A k , and Ψ ; a : A l , ∆ $ Q l :: c : C for all l P L , then a Ð P ; Q k ” a Ð p a.k ; P q ; p case a t l ñ Q l u l P L q . Proof.
We use the Knaster-Tarski formulation (58) of the trace operator. Let u P (cid:74) Ψ (cid:75) and p δ ` , δ ` , c ´ q P (cid:74) ∆ , ∆ (cid:75) ` ˆ (cid:74) c : C (cid:75) ´ be arbitrary. We abbreviate judgments by their processesand calculate that (cid:74) a Ð P ; Q k (cid:75) u p δ ` , δ ` , c ´ q “ Tr b ´ ˆ b ` p l qp δ ` , δ ` , c ´ q“ π ∆ ´ , ∆ ´ ,c ` ´ (cid:108) L ¯ , (cid:74) a Ð p a.k ; P q ; p case a t l ñ Q l u l P L q (cid:75) u p δ ` , δ ` , c ´ q “ Tr b ´ ˆ b ` p r qp δ ` , δ ` , c ´ q“ π ∆ ´ , ∆ ´ ,c ` ´ (cid:108) R ¯ . Kavanagh 71 where l : (cid:74) ∆ , ∆ , a : A k (cid:75) ` ˆ (cid:74) a : A k , c : C (cid:75) ´ Ñ (cid:74) ∆ , ∆ , a : A k (cid:75) ´ ˆ (cid:74) a : A k , c : C (cid:75) ` l “ (cid:74) Ψ ; ∆ $ P :: a : A k (cid:75) u ˆ (cid:74) Ψ ; ∆ , a : A k $ Q k :: c : C (cid:75) u,L “ (cid:32)` δ ´ , δ ´ , a ´ , a ` , c ` ˘ P (cid:74) ∆ , ∆ , a : A k (cid:75) ´ ˆ (cid:74) a : A k , c : C (cid:75) ` || l ` δ ` , δ ` , a ` , a ´ , c ´ ˘ Ď ` δ ´ , δ ´ , a ´ , a ` , c ` ˘( ,r : (cid:74) ∆ , ∆ , a : ‘t l : A l u l P L (cid:75) ` ˆ (cid:74) a : ‘t l : A l u l P L , c : C (cid:75) ´ ÑÑ (cid:74) ∆ , ∆ , a : ‘t l : A l u l P L (cid:75) ´ ˆ (cid:74) a : ‘t l : A l u l P L , c : C (cid:75) ` r “ (cid:74) Ψ ; ∆ $ a.k ; P :: a : ‘t l : A l u l P L (cid:75) u ˆˆ (cid:74) Ψ ; ∆ , a : ‘t l : A l u l P L $ case a t l ñ Q l u l P L :: c : C (cid:75) u,R “ (cid:32)` δ ´ , δ ´ , a ´ , a ` , c ` ˘ P (cid:74) ∆ , ∆ , a : ‘t l : A l u l P L (cid:75) ´ ˆ (cid:74) a : ‘t l : A l u l P L , c : C (cid:75) ` || r ` δ ` , δ ` , a ` , a ´ , c ´ ˘ Ď ` δ ´ , δ ´ , a ´ , a ` , c ` ˘( . Infima of products are computed component-wise, so to show (cid:74) a Ð P ; Q k (cid:75) u p δ ` , δ ` , c ´ q “ (cid:74) a Ð p a.k ; P q ; p case a t l ñ Q l u l P L q (cid:75) u p δ ` , δ ` , c ´ q it is sufficient to show that π ∆ ´ , ∆ ´ ,c ` L “ π ∆ ´ , ∆ ´ ,c ` R .We first show π ∆ ´ , ∆ ´ ,c ` L Ě π ∆ ´ , ∆ ´ ,c ` R . Let p δ ´ , δ ´ , p a ´ l q l P L , a ` , c ` q P R be arbitraryand let (cid:74) P (cid:75) u p δ ` , a ´ k q “ p δ ´ P , a ` P q . The case a ` “ K is impossible. Indeed, when a ` “ K ,strictness gives (cid:74) case a t l ñ Q l u l P L (cid:75) u p δ ` , K , c ´ q “ K . This implies r p δ ´ , δ ´ , a ` : K , p a ´ l q l P L , c ` q “ p ∆ ´ : δ ´ P , ∆ ´ : K , a ´ : K , a ` : p k, “ a ` P ‰ q , c ` : Kq , which by definition of R implies the contradiction p k, “ a ` P ‰ q Ď K . So a ` “ p l, “ a ` l ‰ q for some l P L and a ` l P (cid:74) A l (cid:75) ` . The definitions of r and R imply p k, “ a ` P ‰ q Ď p l, “ a ` l ‰ q , so we have l “ k . We show that p δ ´ , δ ´ , a ´ k , a ` k , c ` q P L . Let (cid:74) Q k (cid:75) u p δ ` , a ` k , c ´ q “ p δ ´ Q , a ´ Q , c ` Q q . Wecalculate l p δ ` , δ ` , a ` k , a ´ k , c ´ q “ p ∆ ´ : δ ´ P , ∆ ´ : δ ´ Q , a ´ : a ´ Q , a ` : a ` P , c ` : c ` Q q , (77) r p δ ´ , δ ´ , p k, “ a ` k ‰ q , p a ´ l q l P L , c ` q“ p ∆ ´ : δ ´ P , ∆ ´ : δ ´ Q , a ´ : p k : a ´ Q , l ‰ k : Kq , a ` : p k, “ a ` P ‰ q , c ` : c ` Q q . (78)By definition of R , Equation (78) implies p δ ´ P , δ ´ Q , p k : a ´ Q , l ‰ k : Kq , p k, “ a ` P ‰ q , c ` Q q Ď p δ ´ , δ ´ , p a ´ l q l P L , p k, “ a ` k ‰ q , c ` q . (79)It immediately follows from (79) that p δ ´ P , δ ´ Q , a ´ Q , a ` P , c ` Q q Ď p δ ´ , δ ´ , a ´ k , a ` k , c ` q , i.e., that p δ ´ , δ ´ , a ´ k , a ` k , c ` q P L . We deduce π ∆ ´ , ∆ ´ ,c ` L Ě π ∆ ´ , ∆ ´ ,c ` R .To show π ∆ ´ , ∆ ´ ,c ` L Ď π ∆ ´ , ∆ ´ ,c ` R , let p δ ´ , δ ´ , a ´ k , a ` k , c ` q P L be arbitrary. Let (cid:74) P (cid:75) u p δ ` , a ´ k q “ p δ ´ P , a ` P q and (cid:74) Q k (cid:75) u p δ ` , a ` k , c ´ q “ p δ ´ Q , a ´ Q , c ` Q q . We calculate l p δ ` , δ ` , a ` k , a ´ k , c ´ q “ p ∆ ´ : δ ´ P , ∆ ´ : δ ´ Q , a ´ : a ´ Q , a ` : a ` P , c ` : c ` Q q , (80) r p δ ´ , δ ´ , p k, “ a ` k ‰ q , p k : a ´ k , l ‰ k : Kq , c ` q“ p ∆ ´ : δ ´ P , ∆ ´ : δ ´ Q , a ´ : p k : a ´ Q , l ‰ k : Kq , a ` : p k, “ a ` P ‰ q c ` : c ` Q q . (81) By definition of L , Equation (80) implies p δ ´ P , δ ´ Q , a ´ Q , a ` P , c ` Q q Ď p δ ´ , δ ´ , a ´ k , a ` k , c ` q . (82)It immediately follows from (82) that p δ ´ P , δ ´ Q , p k : a ´ Q , l ‰ k : Kq , p k, “ a ` P ‰ q , c ` Q q Ď p δ ´ , δ ´ , p k : a ´ k , l ‰ k : Kq , p k, “ a ` k ‰ q , c ` q , i.e., that p δ ´ , δ ´ , p k : a ´ k , l ‰ k : Kq , p k, “ a ` k ‰ q , c ` q P R . đ§ Proposition 13. If Ψ ; ∆ $ P :: a : r ρα.A { α s A and Ψ ; a : r ρα.A { α s A, ∆ $ Q :: c : C ,then a Ð P ; Q ” a Ð p send a unfold ; P q ; p unfold Ð recv a ; Q q . Proof.
We abbreviate judgments by their processes. (cid:74) a Ð p send a unfold ; P q ; p unfold Ð recv a ; Q q (cid:75) u “ Tr a ´ ˆ a ` p (cid:74) send a unfold ; P (cid:75) u ˆ (cid:74) unfold Ð recv a ; Q (cid:75) u q“ Tr a ´ ˆ a ` ``` id ˆ ` a ` : Fold ˘˘ ˝ (cid:74) P (cid:75) u ˝ ` id ˆ ` a ´ : Unfold ˘˘˘ ˆˆ `` id ˆ ` a ´ : Fold ˘˘ ˝ (cid:74) Q (cid:75) u ˝ ` id ˆ ` a ` : Unfold ˘˘˘˘ “ Tr a ´ ˆ a ` `` id ˆ ` a ` : Fold ˘ ˆ ` a ´ : Fold ˘˘ ˝ p (cid:74) P (cid:75) u ˆ (cid:74) Q (cid:75) u q ˝˝ ` id ˆ ` a ´ : Unfold ˘ ˆ ` a ` : Unfold ˘˘˘ which by Proposition 26: “ Tr a ´ ˆ a ` p (cid:74) P (cid:75) u ˆ (cid:74) Q (cid:75) u q“ (cid:74) a Ð P ; Q (cid:75) u. đ§ Proposition 14 (Coherence of Session Types) . If Ξ $ A type q s , then (cid:74) Ξ , Θ $ A type q s (cid:75) “ (cid:74) Ξ $ A type q s (cid:75) p π Ξ , ΘΞ for all p P t´ , `u . Proof.
This is exactly Proposition 38. đ§ Proposition 15 (Coherence of Terms and Processes) . If Ψ , M : τ , then (cid:74) Φ , Ψ , M : τ (cid:75) “ (cid:74) Ψ , M : τ (cid:75) ˝ π Φ , ΨΨ . If Ψ ; ∆ $ P :: a : A , then (cid:74) Φ , Ψ ; ∆ $ P :: a : A (cid:75) “ (cid:74) Ψ ; ∆ $ P :: a : A (cid:75) ˝ π Φ , ΨΨ . Proof.
This is exactly Proposition 15. đ§ Proposition 16 (Semantic Substitution of Session Types) . Let Ξ “ α type p s , . . . , α n type p n s .For all p P t´ , `u and all choices of types Θ $ A i type p i s ( ď i ď n ), if Ξ $ B type q s , then (cid:74) Θ $ r ~A { ~α s B type q s (cid:75) p “ (cid:74) Ξ $ B type q s (cid:75) p ˝ x (cid:74) Θ $ A i type p i s (cid:75) p | ď i ď n y . Proof.
This is exactly Proposition 41. đ§ Proposition 17 (Semantic Substitution of Functional Terms) . Let Ψ “ x : τ , . . . , x n : τ n .For all choices of terms Φ , M i : τ i ( ď i ď n ), if Ψ , N : τ and Ψ ; ∆ $ P :: c : C , then (cid:74) Φ , r ~M { ~x s N : τ (cid:75) “ (cid:74) Ψ , N : τ (cid:75) ˝ x (cid:74) Φ , M i : τ i (cid:75) | ď i ď n y , (cid:74) Φ ; ∆ $ r ~M { ~x s P :: c : C (cid:75) “ (cid:74) Ψ ; ∆ $ P :: c : C (cid:75) ˝ x (cid:74) Φ , M i : τ i (cid:75) | ď i ď n y . Proof.