How To Write A Type System For A Linear Logic (For A Linear Type System)

Size: px
Start display at page:

Download "How To Write A Type System For A Linear Logic (For A Linear Type System)"

Transcription

1 The Least Must Speak with the Greatest J. Garrett Morris, Sam Lindley, and Philip Wadler The University of Edinburgh Abstract. We extend a propositions-as-types correspondence between linear logic and session types to include recursive sessions. Our extension takes least and greatest fixed points as dual, an idea well-known to theorists, but which has not previously appeared in the treatment of recursive sessions. We preserve the freedom from races, deadlock, and livelock that is a hallmark of the propositions-as-types approach, and avoid a problem with preservation of duality that appears in the standard treatment of recursive session types. We treat two systems, one based on classical linear logic, derived from work of Caires and Pfenning and of Wadler, and one based on a linear functional language, derived from work of Gay and Vasconcelos. Our treatment of recursion is inspired by Baelde. 1 Introduction Previous work on session types suffers from a mismatch. Session types capture communication protocols. The two ends of a channel must be dual, which ensures that when one end of a channel performs output the other performs input, and when one end offers a choice of actions the other selects from these alternatives. Session types are of limited use without recursion, which permits defining sessions of arbitrary size. Recursion traditionally comes in two dual forms, least fixed point and greatest fixed point. However, in previous work on session types recursion is introduced in such a way that both ends of a channel are treated as least fixed points, a mismatch with the treatment of the other connectives. Here, we introduce a notion of recursion for session types that restores the traditional notion that least fixed points are dual to greatest fixed points. Honda (1993) introduced session types as a type system for process calculi, and Gay and Vasconcelos (2010) reformulated session types in the context of a functional language with linear types. Caires and Pfenning (2010) uncovered a propositions-as-types correspondence between session types and intuitionistic linear logic, and Wadler (2012) adapted the correspondence to classical linear logic. Wadler defines two systems, a process calculus CP (inspired by Caires and Pfenning) and a linear functional language GV (inspired by Gay and Vasconcelos), and presents a type-preserving translation from GV to CP. Subsequently, Lindley and Morris (2014) extended GV to support translation in the other direction, giving type-preserving translations not only from GV to CP but also from CP to GV. A hallmark of the propositions-as-types approach is that it yields systems guaranteed free of races and deadlock; both CP and GV benefit from these properties. Toninho et al. (2013, 2014) also treat recursion in systems inspired by a propositions-as-types correspondence, but they have no notion of duality for least and greatest fixed points.

2 There is much previous work that supports recursive session types, starting with Honda et al. (1998), and including Yoshida and Vasconcelos (2007) and Demangeon and Honda (2011), all of which suffer from the mismatch mentioned above. Here, drawing on work of Baelde (2012), we extend both CP and GV with recursive session types, taking least and greatest fixed points as duals. We show that the type-preserving translations extend to the new systems, and that the new systems are still guaranteed free of races, deadlock, and livelock. Bono and Padovani (2012) and Bernardi and Hennessy (2013) independently observed that the standard treatment of recursive session types fails to preserve duality in the case that the recursive variable appears within a carried type. Their solution relies on an unusual form of substitution that applies only to the carried types within a session type, while ours avoids the problem while using only standard forms of substitution. This paper makes the following contributions. Section 2 extends GV to support recursion, yielding µgv; and demonstrates its power with a series of examples of streams and a calculator. In µgv, unlike in previous session type systems, least fixed points are dual to greatest fixed points and duality is preserved in all cases. Section 3 extends CP to support recursion, yielding µcp, and presents a translation of some of the same examples. We show µcp is guaranteed free of races, deadlock, and livelock. Section 4 presents type-preserving translations from µgv into µcp and inversely. The translation guarantees that GV also is free of races, deadlock, and livelock. As a technical aid, we also present a type-preserving translation from µgv into a subset of itself, similar to one in Lindley and Morris (2014), showing how function and product types can be represented by session types. Section 5 surveys related work and Section 6 concludes. 2 A Session-Typed Functional Language In this section, we present µgv, a simple functional language with session types patterned on the language of Gay and Vasconcelos (2010) (which we call LAST) and Wadler s language GV. Throughout the paper we highlight the novel parts of µgv and µcp by shading them in gray. 2.1 Types Types in µgv are given by the following grammar: Types T, U, V ::= S T U T U T U Session Types S ::=!T.S?T.S end! end? {l i : S i} i {l i : S i} i S S X X µg νg Type Operators G ::= X.S The types comprise session types, linear pairs (T U ), and both linear (T U ) and unlimited (T U ) functions. Session types include input (?T.S), output

3 (!T.S), selection ( {l i : S i } i ), choice ( {l i : S i } i ), and closed channels (end? and end! ). There are two variations on the closed channel (end? ) and (end! ); these arise from our interpretation of session types in classical linear logic, where there is no self-dual proposition corresponding to closed channels. We include a notion of replicated sessions, corresponding to exponentials in linear logic: a channel of type S is a service, offering any number of channels of type S; a channel of type S is the server providing such channels. For simplicity, we omit polymorphism as it is an orthogonal concern. We include session variables (X ) and their duals (X ), and types corresponding to bounded recursion (µx.s) and unbounded corecursion (νx.s). If G is an operator X.S, then G(S ) denotes the standard capture-avoiding substitution of S for X in S, which we write as S[S /X ]. Each type T is either linear (lin(t )) or unlimited (un(t )). All types are linear except unlimited functions T U, replicated channels S, and closed input channels end?. We extend the standard notion of duality to recursive and corecursive session types:!t.s =?T.S?T.S =!T.S end? = end! end! = end? {l i : S i} i = {l i : S i} i {l i : S i} i = {l i : S i} i S = S S = S µg = νg νg = µg where X = X and we define the dual of an operator G = X.S as G = X.G(X ). Observe that G(S) = G(S). Unlike many notions of duality for session types, our definition preserves duality when recursive session types are unrolled, even when the recursion occurs in the carried types. For example, consider the operator G = X.?X.end?, its dual G = X.!X.end!, and the dual session types µg and νg. Unrolling µg yields G(µG) =?µg.end? ; unrolling νg yields G(νG) =!νg.end! =!µg.end!, which is the dual of?µg.end?. To ensure that fixed points exist, we require that all operators X.S be monotonic, that is, X may appear only in positive subformulas of S. Thus, the operator X.!X.end! is not monotonic, but the operator X.!(X end! ).end! is. Formally, X.S is monotonic iff the predicate pos X,S holds, where pos and neg are defined by the homomorphic extensions of the following equations: pos X,X = true pos X,X = false pos X,!T.S = neg X,T pos X,S pos X,T U = neg X,T pos X,U pos X,T U = neg X,T pos X,U neg X,X = false neg X,X = true neg X,!T.S = pos X,T neg X,S neg X,T U = pos X,T neg X,U neg X,T U = pos X,T neg X,U 2.2 Typing Rules We let Φ range over type environments. The judgement Φ M : T states that term M has type T in type environment Φ. Figure 1 gives the typing rules of µgv. The structural rules account for variables, and for weakening and contraction of unlimited types. The rules for the functional terms are standard; note that, to account for linearity, the context is split in the rules for application and pair introduction and elimination, and is restricted to unlimited types in the introduction of unlimited arrows.

4 Structural Rules un(t U ) un( S) un(end? ) x : T x : T Lambda Rules Φ M : U un(t ) Φ, x : T M : U Φ, x : T, x : T M : U un(t ) Φ, x : T M [x/x ] : U Φ, x : T M : U Φ λx.m : T U Φ M : T U Φ, Ψ M N : U Ψ N : T Φ M : T U Φ M : T U un(φ) Φ M : T U Φ M : T U Session Rules Φ M : T Ψ N : U Φ, Ψ (M, N ) : T U Φ M : T U Ψ, x : T, y : U N : V Φ, Ψ let (x, y) = M in N : V Φ M : S Ψ N : S Φ M : T Ψ N :!T.S Φ, Ψ link M N : end! Φ, Ψ send M N : S Φ M :?T.S Φ receive M : T S Φ, x : S M : end! Φ fork x.m : S Φ M : {l i : S i } i Φ M : {l i : S i } i Ψ, x : S i N i : T Φ select l i M : S i Φ, Ψ case M {l i x.n i } i : T Φ M : S Φ request M : S Φ M : µg Φ M : G(µG) Φ, x : S M : end! un(φ) Φ serve x.m : S f : X T end!, c : G(X ), x : T M : end! cofix f c x = M : νg T end! Admissible Session Rules Φ M : G(µG) Φ M : µg Φ M : νg Φ M : G(νG) Φ M : G(νG) Φ M : νg Fig. 1: Typing Rules for µgv The typing of input, output, choice and selection are those of Gay and Vasconcelos (2010). Following our earlier work (Lindley and Morris, 2014), the term link M N implements channel forwarding. The fork construct provides session initiation. The rule for serve x.m parallels that for fork: it defines a server which replicates M, and returns the channel by which it may be used (of type S = S). The novelty of µgv is in its recursive and corecursive channels; we attempt to remain close to existing presentations of recursive session types (Honda et al., 1998). The construct cofix f c x = M is used to define corecursive sessions. We provide for the rolling and unrolling of fixed points µg and νg, implementing the equivalences among equirecursive types. As we observe in Section 4.3, only the first of these coercion rules is essential. The remaining rules are admissible, albeit at the cost of introducing additional computation. The remainder of the section presents several examples illustrating the use of cofix. In addition, we have implemented a prototype of µgv plus various extensions, and we have implemented many examples, including all of those of Toninho et al. (2013). All of the code is available at the following URL:

5 2.3 Streams We will write letx = M inn for (λx.m )N and assume an extension of µgv with a type of naturals (Nat), literals (0, 1,... ), addition (+), and multiplication ( ). A canonical example of a corecursive data type is a stream. Let us consider a session type for producing a stream of naturals. Source = νx. {next :!Nat.X, stop : end! } A channel of type Source can either produce the next number or stop. The dual of a source is a sink. Sink = µx. {next :?Nat.X, stop : end? } Using cofix we can define a function that sends a stream of zeros along a corecursive channel: Zeros : Source end! Zeros = cofix f c = case c {next c.let c = send 0 c in f c; stop c.c} If the next number is chosen, then a zero is sent along the channel and we recurse. Otherwise we stop. We define a helper macro to read the next value from a stream: and now: GetNext : Sink Nat Sink GetNext c = receive (select next c) let c = fork c.zeros c in let (x, c) = GetNext c in let (y, c) = GetNext c in let (z, c) = GetNext c in let c = select stop c in (x, (y, z)) begins by forking a stream of zeros, and then reads from the corresponding sink several times, returning (0, (0, 0)). Productivity. We might expect to assign c the type {next :!Nat.Source, stop : end! } and f the type Source end! in the body of Zeros, but then productivity would not be assured and deadlock would be possible. For example, under those typing assumptions, the following would also be well-typed: cofix f c = f c We restrict the typing rule for cofix in order to guarantee productivity. We use a fresh type variable X to abstract the recursive behavior, so the channel c has type G(X ) (in our example {next :!Nat.X, stop : end! }) instead of G(νG), and f has type X end! instead of νg end!. The body of cofix is thus required to provide exactly one step of the corecursive behavior.

6 Coinvariants. We allow recursive sessions to maintain internal state (a coinvariant). In the cofix typing rule this is captured by the additional arguments x. For example, we can construct a stream of consecutive naturals: Nats : Source end! Nats = cofix nats c x = case c {next c. let c = send x c in nats c (x + 1) stop c. c} The variable x tracks the next value to send to the stream, and is accordingly incremented in the recursive call. Now, the following: let c = fork c.nats c 0 1 in let (x, c) = GetNext c in let (y, c) = GetNext c in let (z, c) = GetNext c in let c = select stop c in (x, (y, z)) returns (0, (1, 2)). We can maintain coinvariants of arbitrary complexity; for example, we can define a stream of the Fibonacci numbers as follows: Fibs : Source end! Fibs = cofix fibs c m n = case c {next c.let c = send m c in fibs c n (m + n) stop c. c} 2.4 Multi-function Calculator We now define a basic multi-function calculator. We aim to implement a process that accepts a stream of addition and multiplication requests, and can at any time provide the accumulated result: Calc = νx. {add :?Nat.X, mul :?Nat.X, result :!Nat.X, stop : end! }. We implement a provider of calculator functionality as follows: MakeCalc : Calc Nat end! MakeCalc = cofix calc c accum = case c of {add c. let (x, c) = receive c in calc c (accum + x) mul c. let (x, c) = receive c in calc c (accum x) result c. let c = send accum c in calc c accum stop c. c} Here is an example of using a calculator: let c = fork c.makecalc c 0 in let c = send 6 (select add c) in let c = send 7 (select mul c) in let (x, c) = receive (select result c) in let c = select stop c in x We begin by constructing an instance of the calculator with the accumulator starting at 0. We perform several calculations, adding 6 to the accumulator and multiplying by 7. Finally, we obtain the result (42) and close the channel.

7 P Γ, y : A Q, y : A x w x : A, w : A new y (P Q) Γ, x[].0 x : 1 P Γ, y : A, x : B x(y).p Γ, x : A B P Γ, y : A Q, x : B x[y].(p Q) Γ,, x : A B P Γ x().p Γ, x : P Γ, x : A i P Γ, x : A Q Γ, x : B x[in i].p Γ, x : A 1 A 2 case x {P; Q} Γ, x : A B case x {} Γ, x : P Γ P Γ, x :?A P y : A,?Γ!x(y).P Γ, x :!A P y : A, Γ?x[y].P Γ, x :?A P Γ, x : F (µf ) rec x.p Γ, x : µf P x :?A, x :?A, Γ P[x/x ] Γ, x :?A P Γ, y : A Q y : A, x : F (A) corec F x y (P, Q) Γ, x : νf Fig. 2: Typing Rules for µcp 3 A Linear Logic-Based Process Calculus The types of µcp are the propositions of classical linear logic, extended with type operators F and fixed points µf, νf. Types A, B ::= A B A B 1 A B A B 0?A!A X X µf νf Type Operators F ::= X.A If F = X.A, define F (B) = A[B/X ]. The standard notion of classical linear logic duality is extended to fixed points in the expected fashion: (A B) = A B 1 = (A B) = A B = 1 (!A) =?A (?A) =!A (A B) = A B = 0 (A B) = A B 0 = (νf ) = µf (µf ) = νf where X = X, and we define the dual of a type operator by F = X.(F (X )). Similarly to µgv, (F (A)) = F (A ). We let Γ, range over type environments. The judgement P Γ states that process P uses channels Γ. Typing rules for µcp terms are given in Fig. 2. We write fv(p) for the free variables used in process P; in the typing rules, new bound variables are designated y. Structural Rules. µcp has two structural rules, axiom and cut. We interpret the axiom x w as channel forwarding: actions on channel x are mirrored on w, and vice versa. Thus, x and w must have dual type. Cut new y (P Q) is interpreted as communication between processes P and Q on channel y; the duality of the typing of y assures that its uses in P and Q are compatible. We identify µcp up to structural equivalence: x w w x new y (P Q) new y (Q P) new y (P new z (Q R)) new z (new y (P Q) R), if y fv(r)

8 Input and Output. The multiplicative connectives and are interpreted as input and output. The process x(y).p inputs channel y on channel x, and continues as P. The process x[y].(p Q) is interpreted as bound output: it sends a fresh variable y along x, spawns a process P in which y is used, and continues as process Q in which x is used. It amounts to the π-calculus term (νy)x(y).(p Q). We write x[y].p as syntactic sugar for x[y ].(y y P). The units of and, and 1, are interpreted as nullary input and nullary output, respectively. Selection and Choice. The additive connectives and are interpreted as selection and choice. The process case x {P 1 ; P 2 } offers a choice of processes P 1 and P 2 ; dually, the process x[in i ].P i chooses the i-th alternative. The unit for choice is 0, indicating absurdity. Note that there is no term proving 0. The dual of absurdity is, and provides arbitrary behavior; as there is no term proving 0, no term relying on can reduce. Replication and Dereliction. The exponential connectives! and? in linear logic provide restricted access to the classical rules of weakening and contraction. We interpret them as serving (!) and requesting (?) replicated processes. For a server channel of type!a, the process P proving A may be replicated arbitrarily, so each channel that P uses must be replicable as well. We write?γ to assert that all types in Γ be of the form?b. As well as the introduction rule for a request channel of type?a, there are also implicit rules for weakening and contraction. Recursion and Corecursion. We introduce least fixed points µf and greatest fixed points νf to CP, following Baelde s (2012) proof theoretic treatment of fixed points in linear logic. The proof rules can be understood from traditional two-sided rules for least and greatest fixed points, combined with the duality between the fixed points. We begin with a two-sided presentation: F (A) A Γ, A B Γ, µf B Γ F (µf ) Γ µf Γ, F (νf ) B Γ, νf B A F (A) Γ A Γ νf Functional programmers may recognize the first as the rule for a fold, and the fourth as the rule for an unfold. We adapt the above rules to a one sided presentation as follows. (As Γ denotes any context, we write Γ instead of Γ ). F (A ), A Γ, A, B Γ, νf, B Γ, F (µf ) Γ, µf Γ, F (µf ), B Γ, µf, B A, F (A) Γ, A Γ, νf However, now we can observe that Γ, B is itself an instance of a context, and F a type operator, and so the top-right rule is just an instance of the bottom-left rule, and the top-left rule is just an instance of the bottom-right rule. The bottom two

9 new x (w x P) = P[w/x] new x (x[y].(p Q) x(y).r) = new y (Q new x (P R)) new x (x[].0 x().p) Γ = P new x (x[in i].p case x {Q 1; Q 2}) = new x (P Q i) new x (!x(y).p?x[y].q) = new y (P Q) new y (!x(y).p Q) = Q, x / fv(q) new x (!x(y).p Q[x/x ]) = new x (!x(y).p new x (!x (y).p Q)) new x (corec F x y (P, Q) rec x.r) = new y (P new x (Q new x (Q R[x /x]))) where Q = map F x,x (corecf x y (x y, Q[x /x])) Fig. 3: Principal Cut Elimination Rules map X.C x,y (P) = x y, if X is not free in C map X.X x,y (P) = P map X.C 1 C 2 x,y (P) = x(x ).y[y ].(map X.C 1 x,y (P[x /x, y /y]) map X.C 2 x,y (P)) map X.C 1 C 2 x,y (P) = case x {y[in 1].map X.C 1 x,y (P); y[in 2].map X.C 2 x,y (P)} map X.?C x,y (P) =!x(x ).?y[y ].P[x /x, y /y] map X.µF x,y (P) = corec F x y (y y, rec y.map X.F (µf ) x,y (P[y /y])) Fig. 4: Definition of map for Positive Combinators rules are the typing rules for the µcp terms rec x.p and corec F x y (P, Q). We will often omit the F annotation. As in µgv, corec terms maintain a coinvariant y, of type A. The coinvariant can be seen as being sent from P to Q; thus, its type is dual in P and Q. As carried types are not dual in µgv, no corresponding duality appears in the typing rule for cofix. 3.1 Cut Elimination Cut elimination corresponds to synchronous process reduction. The principal cut reductions are given in Fig. 3. The majority of these are standard; for instance, cut reduction of against corresponds to picking one of the offered alternatives. Cut reduction for fixed points corresponds to unrolling one iteration from the corec term, directed by the type of the fixed point operator F. It depends on a proof construction known as functoriality, which derives the following proof rule for any type operator F : A, B F (A), F (B) We call the term implementing this construction map by analogy with a similar construct in functional programming. The positive cases of map are given in Fig. 4; the remaining cases are obtained by exchanging channels x and y. Lemma 1. If P x : A, y : B then map F x,y(p) x : F (A), y : F (B). The commuting conversions push communication under process prefixes, and are given in Fig. 5. The standard meta theoretic properties of classical linear

10 new z (x[y].(p Q) R) = x[y].(new z (P R) Q), if z fv(q) new z (x[y].(p Q) R) = x[y].(p new z (Q R)), if z fv(p) new z (x(y).p Q) = x(y).new z (P Q) new z (x[in i].p Q) = x[in i].new z (P Q) new z (case x {P; Q} R) = case x {new z (P R); new z (Q R)} new z (?x[y].p Q) =?x[y].new z (P Q) new z (!x(y).p Q) =!x(y).new z (P Q) new z (rec x.p Q) = rec x.new z (P Q) new z (corec x y (P, Q) R) = corec x y (new z (P R), Q) Fig. 5: Commuting Conversions logic with fixed points apply directly to µcp. Therefore deadlock and livelock freedom follow directly from cut elimination, and race freedom follows directly from confluence. 3.2 Streams As we did for µgv, we assume that our language is extended with constants implementing unlimited natural numbers (we could implement Nat within µcp, but choose not to due to lack of space). In particular, assume there exists a proposition Nat, such that Nat is subject to contraction and weakening, and terms: Zero x x : Nat Inc y,x y : Nat, x : Nat We can now use fixed points in µcp to encode streams of naturals. Source = νx. {next : Nat X, stop : 1} Sink = µx. {next : Nat X, stop : } We can define a process which generates a stream of zeros. In this example, we make no use of the coinvariant, and so assign it the type 1: Zeros y y : Source Zeros y = corec y z (z[].0, z().case y {next : y[x].(zero x y[].0); stop : y[].0}). Now we define a process which generates a stream of naturals. As in the corresponding µgv example, we use the coinvariant represent the next number in the stream. Nats y y : Source Nats y = cofix y z (Zero z, case y {next : y[x].(z x new w (Inc z,w w y)) stop : y[].0}) In the next case, we rely on contraction to copy the coinvariant z. We then send one copy along the channel y and increment the other giving w, which we use to re-establish the coinvariant. In the stop case, we rely on weakening for Nat to dispose of the coinvariant. The following receives the first three numbers from the stream of naturals and sends them on z; thus, z has type Nat (Nat Nat ). new y (Nats y rec y.y[next].y(a).rec y.y[next].y(b).rec y.y[next].y(c). rec y.y[stop].y().z[a].z[b].z c)

11 (λx.m ) = fork z.let (x, z) = receive z in link (M ) z (L M ) = send (M ) (L) (M, N ) = fork z.link (send (M ) z) (N ) (let (x, y) = M in N ) = let (x, y) = receive (M ) in (N ) (L : T U ) = serve z.link (L) z (L : T U ) = request (L) (receive M ) = (M ) (cofix f c x = M ) = cofix p c z = let f = λ c x.send x (send c (request p)) in let x = z in (M ) Fig. 6: Translation of µgv Terms to µgvπ 4 Relating µgv and µcp In our previous work (Lindley and Morris, 2014) we give translations between CP and HGV, an extension of GV, corresponding to µgv without recursive session types. In this section, we extend these translations to incorporate recursion. 4.1 Translation from µgv to µgvπ Following our previous work, we factor the translation of µgv into µcp through an intermediate translation. The language µgvπ is the restriction of µgv to session types; that is, µgv without,, or. In order to avoid, we permit receive M, only fused with a pair elimination let (x, y) = receive M in N. We can simulate all non-session types as session types via a translation from µgv to µgvπ. The translation on types is given by the homomorphic extension of the following equations: (T U ) =!(T ).(U ) (T U ) = (!(T ).(U ) ) (T U ) =?(T ).(U ) Each target type is the interface to the simulated source type. A linear function is simulated by input on a channel; its interface is output on the other end of the channel. An unlimited function is simulated by a server; its interface is the service on the other end of that channel. A tensor is simulated by output on a channel; its interface is input on the other end of that channel. This duality between implementation and interface explains the dualization of types in Wadler s original CPS translation from GV to CP. To translate away the arrows in the cofix rule, we adopt a simplified session-oriented variant of cofix for µgvπ: p : (!X.!T.end! ), c : G(X ), x : T M : end! Φ cofix p c x = M : (!νg.!t.end! ) This rule takes advantage of the translation of functions given by ( ), and simulates multiple arguments using. The translation on terms is given by the homomorphic extension of the equations in Fig. 6. Formally, this is a translation from derivations to terms. We write type annotations to indicate introduction and elimination. The only new case is that for corec. We collect the arguments into a tuple, and simulate the interface

12 Φ, x : end? N : S z = x(). Φ N : S z Φ, x : end? N [x/x ] : S z = new x ( Φ, x : end?, x : end? N : S z x [].0) x z = x z fork x.m z = new x (new y ( M y y[].0) x z) link M N z = z().new x ( M x N x) send M N z = new x (x[y].( M y x z) N x) let (x, y) = receive M in M z = new y ( M y y(x). N z) select l M z = new x ( M x x[l].x z) case M {l i x.n i} i z = new x ( M x case x {l i. N i z} i) request M z = new x ( M x?x[y].y z) serve y.m z =!z(y).new x ( M x x[].0) Φ M : G(µG) z = new y ( Φ M : µg y rec y.y z) cofix p c x = M z =!z(y).y(c).y(w).y().corec c x (x w, new p (!p(y).y(c).y(w).y().c w new y ( M y y[].0))) Φ M : µg z = new y ( Φ M : G(µG) y corec z x (y x, map G z,x (rec x.x z))) Φ M : G(νG) z = new y ( Φ M : νg y corec y x (y x, map G z,x (rec x.x z))) Φ M : νg = new y ( Φ M : G(νG) y rec z.y z) Fig. 7: Translation of µgvπ Terms into µcp to the arrows using session operations as in the rest of the ( ) translation. We use the obvious encodings for n-ary let binding, lambdas, and send. We write (Φ) for the pointwise extension of (T ). Theorem 2. If Φ M : T then (Φ) (M ) : (T ). 4.2 Translation from µgvπ to µcp We now give a translation from µgvπ to CP. Post composing this with the embedding of µgv in µgvπ yields a semantics for µgv. For uniformity, we assume the obvious encodings of n-ary,, and case in CP. The translation on session types is as follows:!t.s = T S?T.S = T S end! = 1 end? = {l i : S i} i = {l i : S i } i {l i : S i} i = {l i : S i } i S =? S S =! S X = X X = X νg = ν G µg = µ G X.S = X. S The translation is homomorphic except for output, where the argument type is dualized. This accounts for the discrepancy between!t.s =?T.S and (A B) = A B. The translation on terms (Fig. 7) is formally specified as a CPS translation on derivations as in Wadler s work. We abbreviate the derivation by its final judgement in the translations of weakening and contraction for end?, and for rolling and unrolling of recursive session types νg and µg, as these steps are implicit in the syntax of µgv terms, but explicit in µcp. The other

13 new x (P Q) = let x = fork x. P in Q x y = link x y x[y].(p Q) = let x = send (fork y. P ) x in Q x(y).p = let (y, x) = receive x in P x[].0 = x x().p = P x[l].p = let x = select l x in P case x {l i.p i} i = case x {l i. P i } i?s[x].p = let x = request s in P!s(x).P = link s (serve x. P ) rec x.p = P corec F c x (P, Q) = send c (send (fork x. P ) (request (cofix p c x = Q F,p,c,x ))) where Q F,p,c,x = let c = fork c. Q in map F c,c(?p[z].z[c].z[c ].z[].0) Fig. 8: Translation of µcp Terms into µgvπ constructs depend only on the immediate syntactic structure, so we abbreviate their translations as mappings on plain terms. The majority of translations are as in our previous work. The rolling and unrolling of fixed points in µgv can be translated to cuts against the µcp proofs of the corresponding equivalences. The translation of cofix is a corecursive process with coinvariant x in which p abstracts re-establishing the coinvariant at the end of each step. Theorem 3. If Φ M : T, then M z Φ, z : T. As we have already argued that µcp is deadlock and livelock free, and we now have that all µgv terms correspond to µcp derivations, we can also conclude that µgv is deadlock and livelock free. Note that the type environment Φ is not dual in the result of the translation. This reflects the different interpretations of types in µcp and µgv: a µgv type!t.s designates a channel that expects output, whereas the µcp type T S designates a process that performs output. 4.3 Translating from µcp to µgvπ We now present the translation from µcp to µgvπ. On types: A B =! A. B A B =? A. B 1 = end! = end? +{l i : A i} i = +{l i : A i } i {l i : A i} i = {l i : A i } i?a = A!A = A X = X X = X νf = ν F µf = µ F X.A = X. A The translation on terms makes use of let expressions to simplify the presentation; these are expanded to µgvπ as follows: let x = M in N ((λx.n )M ) = send M (fork z.let (x, z) = receive z in link N z) The translation is given in Fig. 8. The interesting cases are for rec and corec. The translation of rec x.p relies on exactly one use of the rule that unrolls

14 µf to F (µf ) applied to the variable x. The translation of corec simulates the expansion of Q, using p to re-establish the coinvariant after each expansion, and thus depends on the translation of functoriality from µcp to µgv. Theorem 4. If P Γ, then Γ P : end!. As the semantics of µgv is defined by translation to µcp, the following soundness theorem tells us that µgv and µcp are equally expressive. Theorem 5. If P Γ then new z (z[].0 P z) = P. Remark. The admissibility of the final three rules of Fig. 1 follows from Theorem 5, as neither nor uses any of these rules. 5 Related Work Session types were originally introduced by Honda (1993), and were further extended by Takeuchi et al. (1994), Honda et al. (1998), and Yoshida and Vasconcelos (2007). The systems of Honda et al. (1998) and Yoshida and Vasconcelos (2007) include recursive session types. They do not distinguish between recursion and corecursion, and do not exhibit deadlock freedom. Bono and Padovani (2012) and Bernardi and Hennessy (2013) independently observed that duality in those systems was not preserved under unrolling of recursive types; Bernardi et al. (2014) studies the role of duality in session types, including those with recursion. This work adopts a different solution from ours, however, and we hope to investigate the consequences of these different approaches in future work. Caires and Pfenning (2010) showed the first complete propositions-as-types correspondence between intuitionistic linear logic (ILL) and session types. Their work shows both an interpretation of session types as ILL propositions, and a computational interpretation of ILL proofs as π-calculus processes. As a result, they are able to show that well-typed processes are free of races, deadlock, and livelock, by analogy with corresponding cut-elimination results for ILL. Toninho et al. (2013) demonstrate an embedding of their calculus within a functional language; the resulting system admits unrestricted recursion in the functional setting, and can thus provide recursive communication behavior, but does not guarantee that the evaluation of function terms terminates. Girard (1987) speculated that linear logic would be well-suited to reasoning about concurrency. Abramsky (1994) and Bellin and Scott (1994) explored the interpretation of linear logic proofs as concurrent programs. Kobayashi et al. (1996) introduced the use of linear typing to the π-calculus, and demonstrated a form of linear channels similar in usage to session-typed channels; Dardha et al. s (2012) extensions to this work include full session types. 6 Conclusion and Future Work We have demonstrated a propositions-as-types correspondence linking recursive session types and fixed points in linear logic. Unlike previous work on recursive

15 session types, our presentation distinguishes between recursive and corecursive processes. As a consequence of cut elimination in linear logic, all well-typed processes are free of races, deadlock, and livelock. We identify several areas of future work. We would like to give an asynchronous semantics to µgv, following the original presentation of LAST by Gay and Vasconcelos (2010), and show that it is equivalent to the synchronous semantics provided by cut elimination in µcp. We would like to extend µgv with recursive and corecursive types in general, and investigate whether we can extend the ( ) translation to simulate these types as recursive and corecursive session types. We would like to explore further extensions of µcp and their consequences for µgv, including: the addition of second-order polymorphism, as studied by Wadler (2012) for CP and Lindley and Morris (2014) for GV; the addition of the MIX 0 and MIX 2 rules, providing additional notions of parallel composition and unifying the types end! and end? ; and identify natural extensions of CP that give rise to non-determinism, and thus allow programs to exhibit more interesting concurrent behavior, while preserving the underlying connection to linear logic. References S. Abramsky. Proofs as processes. In Selected Papers of the Conference on Meeting on the Mathematical Foundations of Programming Semantics, Part I : Linear Logic: Linear Logic, MFPS 92, pages 5 9, Oxford, United Kingdom, Elsevier. D. Baelde. Least and greatest fixed points in linear logic. ACM Trans. Comput. Logic, 13(1): 2:1 2:44, Jan ISSN G. Bellin and P. J. Scott. On the π-calculus and linear logic. Theoretical Computer Science, 135 (1):11 65, G. Bernardi and M. Hennessy. Using higher-order contracts to model session types. CoRR, abs/ , G. Bernardi, O. Dardha, S. J. Gay, and D. Kouzapas. On duality relations for session types, Draft. V. Bono and L. Padovani. Typing copyless message passing. Logical Methods in Computer Science, 8(1), L. Caires and F. Pfenning. Session types as intuitionistic linear propositions. In International Conference on Concurrency Theory, CONCUR 10, pages , O. Dardha, E. Giachino, and D. Sangiorgi. Session types revisited. In PPDP, pages , R. Demangeon and K. Honda. Full abstraction in a subtyped π-calculus with linear types. In CONCUR, pages , S. J. Gay and V. T. Vasconcelos. Linear type theory for asynchronous session types. Journal of Functional Programming, 20(01):19 50, J.-Y. Girard. Linear logic. Theoretical Computer Science, 50(1):1 101, Jan K. Honda. Types for dyadic interaction. In CONCUR, pages , K. Honda, V. T. Vasconcelos, and M. Kubo. Language primitives and type discipline for structured communication-based programming. In ESOP, pages , N. Kobayashi, B. C. Pierce, and D. N. Turner. Linearity and the pi-calculus. In POPL, pages , S. Lindley and G. Morris. Sessions as propositions. In PLACES, K. Takeuchi, K. Honda, and M. Kubo. An interaction-based language and its typing system. In PARLE, pages , B. Toninho, L. Caires, and F. Pfenning. Higher-order processes, functions, and sessions: A monadic integration. In Proceedings of the 22nd European Conference on Programming Languages and Systems, ESOP 13, pages , Rome, Italy, Springer-Verlag. ISBN B. Toninho, L. Caires, and F. Pfenning. Corecursion in session-typed processes, Draft. P. Wadler. Propositions as sessions. In Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, ICFP 12, pages ACM, N. Yoshida and V. T. Vasconcelos. Language primitives and type discipline for structured communication-based programming revisited: Two systems for higher-order session communication. Electr. Notes Theor. Comput. Sci., 171(4):73 93, 2007.

Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic

Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic Lars Birkedal Rasmus Ejlers Møgelberg Rasmus Lerchedahl Petersen IT University Technical Report Series TR-00-7 ISSN 600 600 February 00

More information

Boolean Algebra Part 1

Boolean Algebra Part 1 Boolean Algebra Part 1 Page 1 Boolean Algebra Objectives Understand Basic Boolean Algebra Relate Boolean Algebra to Logic Networks Prove Laws using Truth Tables Understand and Use First Basic Theorems

More information

Linear Types for Continuations

Linear Types for Continuations 1/28 Linear Types for Continuations Alex Simpson LFCS, School of Informatics University of Edinburgh, UK Joint work with: Jeff Egger (LFCS, Edinburgh) Rasmus Møgelberg (ITU, Copenhagen) Linear Types for

More information

Observational Program Calculi and the Correctness of Translations

Observational Program Calculi and the Correctness of Translations Observational Program Calculi and the Correctness of Translations Manfred Schmidt-Schauss 1, David Sabel 1, Joachim Niehren 2, and Jan Schwinghammer 1 Goethe-University, Frankfurt, Germany 2 INRIA Lille,

More information

Foundational Proof Certificates

Foundational Proof Certificates An application of proof theory to computer science INRIA-Saclay & LIX, École Polytechnique CUSO Winter School, Proof and Computation 30 January 2013 Can we standardize, communicate, and trust formal proofs?

More information

Types, Polymorphism, and Type Reconstruction

Types, Polymorphism, and Type Reconstruction Types, Polymorphism, and Type Reconstruction Sources This material is based on the following sources: Pierce, B.C., Types and Programming Languages. MIT Press, 2002. Kanellakis, P.C., Mairson, H.G. and

More information

Predicate Logic Review

Predicate Logic Review Predicate Logic Review UC Berkeley, Philosophy 142, Spring 2016 John MacFarlane 1 Grammar A term is an individual constant or a variable. An individual constant is a lowercase letter from the beginning

More information

1 if 1 x 0 1 if 0 x 1

1 if 1 x 0 1 if 0 x 1 Chapter 3 Continuity In this chapter we begin by defining the fundamental notion of continuity for real valued functions of a single real variable. When trying to decide whether a given function is or

More information

Software Modeling and Verification

Software Modeling and Verification Software Modeling and Verification Alessandro Aldini DiSBeF - Sezione STI University of Urbino Carlo Bo Italy 3-4 February 2015 Algorithmic verification Correctness problem Is the software/hardware system

More information

Computing divisors and common multiples of quasi-linear ordinary differential equations

Computing divisors and common multiples of quasi-linear ordinary differential equations Computing divisors and common multiples of quasi-linear ordinary differential equations Dima Grigoriev CNRS, Mathématiques, Université de Lille Villeneuve d Ascq, 59655, France Dmitry.Grigoryev@math.univ-lille1.fr

More information

CHAPTER 7 GENERAL PROOF SYSTEMS

CHAPTER 7 GENERAL PROOF SYSTEMS CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes

More information

Linearly Used Effects: Monadic and CPS Transformations into the Linear Lambda Calculus

Linearly Used Effects: Monadic and CPS Transformations into the Linear Lambda Calculus Linearly Used Effects: Monadic and CPS Transformations into the Linear Lambda Calculus Masahito Hasegawa Research Institute for Mathematical Sciences, Kyoto University hassei@kurimskyoto-uacjp Abstract

More information

Chapter 7: Functional Programming Languages

Chapter 7: Functional Programming Languages Chapter 7: Functional Programming Languages Aarne Ranta Slides for the book Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, 2012. Fun: a language

More information

System BV is NP-complete

System BV is NP-complete System BV is NP-complete Ozan Kahramanoğulları 1,2 Computer Science Institute, University of Leipzig International Center for Computational Logic, TU Dresden Abstract System BV is an extension of multiplicative

More information

Quotient Rings and Field Extensions

Quotient Rings and Field Extensions Chapter 5 Quotient Rings and Field Extensions In this chapter we describe a method for producing field extension of a given field. If F is a field, then a field extension is a field K that contains F.

More information

Chapter 13: Basic ring theory

Chapter 13: Basic ring theory Chapter 3: Basic ring theory Matthew Macauley Department of Mathematical Sciences Clemson University http://www.math.clemson.edu/~macaule/ Math 42, Spring 24 M. Macauley (Clemson) Chapter 3: Basic ring

More information

Modal Proofs as Distributed Programs (Extended Abstract)

Modal Proofs as Distributed Programs (Extended Abstract) Modal Proofs as Distributed Programs (Extended Abstract) Limin Jia and David Walker Princeton University 35 Olden St., Princeton, NJ 08544, USA {ljia,dpw}@cs.princeton.edu Abstract. We develop a new foundation

More information

Chapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm.

Chapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm. Chapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm. We begin by defining the ring of polynomials with coefficients in a ring R. After some preliminary results, we specialize

More information

A Propositional Dynamic Logic for CCS Programs

A Propositional Dynamic Logic for CCS Programs A Propositional Dynamic Logic for CCS Programs Mario R. F. Benevides and L. Menasché Schechter {mario,luis}@cos.ufrj.br Abstract This work presents a Propositional Dynamic Logic in which the programs are

More information

Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)

Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation) Summary Summary Last Lecture sequent calculus Automated Reasoning Georg Moser Institute of Computer Science @ UIBK Winter 013 (Normalisation and Strong Normalisation) let Π be a proof in minimal logic

More information

Classical BI. (A Logic for Reasoning about Dualising Resources) James Brotherston Cristiano Calcagno

Classical BI. (A Logic for Reasoning about Dualising Resources) James Brotherston Cristiano Calcagno Classical BI (A Logic for Reasoning about Dualising Resources) James Brotherston Cristiano Calcagno Dept. of Computing, Imperial College London, UK {jbrother,ccris}@doc.ic.ac.uk Abstract We show how to

More information

(LMCS, p. 317) V.1. First Order Logic. This is the most powerful, most expressive logic that we will examine.

(LMCS, p. 317) V.1. First Order Logic. This is the most powerful, most expressive logic that we will examine. (LMCS, p. 317) V.1 First Order Logic This is the most powerful, most expressive logic that we will examine. Our version of first-order logic will use the following symbols: variables connectives (,,,,

More information

Probabilità e Nondeterminismo nella teoria dei domini

Probabilità e Nondeterminismo nella teoria dei domini Probabilità e Nondeterminismo nella teoria dei domini Daniele Varacca ENS, Paris BRICS, Aarhus Parma, 15 giugno 2004 Probabilità e Nondeterminismo nella teoria dei domini p.1 Road Map Motivation Domain

More information

The Division Algorithm for Polynomials Handout Monday March 5, 2012

The Division Algorithm for Polynomials Handout Monday March 5, 2012 The Division Algorithm for Polynomials Handout Monday March 5, 0 Let F be a field (such as R, Q, C, or F p for some prime p. This will allow us to divide by any nonzero scalar. (For some of the following,

More information

Deterministic Discrete Modeling

Deterministic Discrete Modeling Deterministic Discrete Modeling Formal Semantics of Firewalls in Isabelle/HOL Cornelius Diekmann, M.Sc. Dr. Heiko Niedermayer Prof. Dr.-Ing. Georg Carle Lehrstuhl für Netzarchitekturen und Netzdienste

More information

You know from calculus that functions play a fundamental role in mathematics.

You know from calculus that functions play a fundamental role in mathematics. CHPTER 12 Functions You know from calculus that functions play a fundamental role in mathematics. You likely view a function as a kind of formula that describes a relationship between two (or more) quantities.

More information

Notes 11: List Decoding Folded Reed-Solomon Codes

Notes 11: List Decoding Folded Reed-Solomon Codes Introduction to Coding Theory CMU: Spring 2010 Notes 11: List Decoding Folded Reed-Solomon Codes April 2010 Lecturer: Venkatesan Guruswami Scribe: Venkatesan Guruswami At the end of the previous notes,

More information

Bindings, mobility of bindings, and the -quantifier

Bindings, mobility of bindings, and the -quantifier ICMS, 26 May 2007 1/17 Bindings, mobility of bindings, and the -quantifier Dale Miller, INRIA-Saclay and LIX, École Polytechnique This talk is based on papers with Tiu in LICS2003 & ACM ToCL, and experience

More information

Introduction to Algebraic Geometry. Bézout s Theorem and Inflection Points

Introduction to Algebraic Geometry. Bézout s Theorem and Inflection Points Introduction to Algebraic Geometry Bézout s Theorem and Inflection Points 1. The resultant. Let K be a field. Then the polynomial ring K[x] is a unique factorisation domain (UFD). Another example of a

More information

Type Theory & Functional Programming

Type Theory & Functional Programming Type Theory & Functional Programming Simon Thompson Computing Laboratory, University of Kent March 1999 c Simon Thompson, 1999 Not to be reproduced i ii To my parents Preface Constructive Type theory has

More information

Non-deterministic Semantics and the Undecidability of Boolean BI

Non-deterministic Semantics and the Undecidability of Boolean BI 1 Non-deterministic Semantics and the Undecidability of Boolean BI DOMINIQUE LARCHEY-WENDLING, LORIA CNRS, Nancy, France DIDIER GALMICHE, LORIA Université Henri Poincaré, Nancy, France We solve the open

More information

Relations: their uses in programming and computational specifications

Relations: their uses in programming and computational specifications PEPS Relations, 15 December 2008 1/27 Relations: their uses in programming and computational specifications Dale Miller INRIA - Saclay & LIX, Ecole Polytechnique 1. Logic and computation Outline 2. Comparing

More information

8 Divisibility and prime numbers

8 Divisibility and prime numbers 8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express

More information

Functional Programming. Functional Programming Languages. Chapter 14. Introduction

Functional Programming. Functional Programming Languages. Chapter 14. Introduction Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The

More information

Separation Properties for Locally Convex Cones

Separation Properties for Locally Convex Cones Journal of Convex Analysis Volume 9 (2002), No. 1, 301 307 Separation Properties for Locally Convex Cones Walter Roth Department of Mathematics, Universiti Brunei Darussalam, Gadong BE1410, Brunei Darussalam

More information

SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA

SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA SECOND DERIVATIVE TEST FOR CONSTRAINED EXTREMA This handout presents the second derivative test for a local extrema of a Lagrange multiplier problem. The Section 1 presents a geometric motivation for the

More information

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook. Elementary Number Theory and Methods of Proof CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 1 Number theory Properties: 2 Properties of integers (whole

More information

Type Classes with Functional Dependencies

Type Classes with Functional Dependencies Appears in Proceedings of the 9th European Symposium on Programming, ESOP 2000, Berlin, Germany, March 2000, Springer-Verlag LNCS 1782. Type Classes with Functional Dependencies Mark P. Jones Department

More information

[Refer Slide Time: 05:10]

[Refer Slide Time: 05:10] Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

More information

Understanding Basic Calculus

Understanding Basic Calculus Understanding Basic Calculus S.K. Chung Dedicated to all the people who have helped me in my life. i Preface This book is a revised and expanded version of the lecture notes for Basic Calculus and other

More information

Linear Algebra I. Ronald van Luijk, 2012

Linear Algebra I. Ronald van Luijk, 2012 Linear Algebra I Ronald van Luijk, 2012 With many parts from Linear Algebra I by Michael Stoll, 2007 Contents 1. Vector spaces 3 1.1. Examples 3 1.2. Fields 4 1.3. The field of complex numbers. 6 1.4.

More information

4: SINGLE-PERIOD MARKET MODELS

4: SINGLE-PERIOD MARKET MODELS 4: SINGLE-PERIOD MARKET MODELS Ben Goldys and Marek Rutkowski School of Mathematics and Statistics University of Sydney Semester 2, 2015 B. Goldys and M. Rutkowski (USydney) Slides 4: Single-Period Market

More information

Simulation-Based Security with Inexhaustible Interactive Turing Machines

Simulation-Based Security with Inexhaustible Interactive Turing Machines Simulation-Based Security with Inexhaustible Interactive Turing Machines Ralf Küsters Institut für Informatik Christian-Albrechts-Universität zu Kiel 24098 Kiel, Germany kuesters@ti.informatik.uni-kiel.de

More information

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement

More information

Validated Templates for Specification of Complex LTL Formulas

Validated Templates for Specification of Complex LTL Formulas Validated Templates for Specification of Complex LTL Formulas Salamah Salamah Department of Electrical, computer, Software, and Systems Engineering Embry Riddle Aeronautical University 600 S. Clyde Morris

More information

Envelope Theorem. Kevin Wainwright. Mar 22, 2004

Envelope Theorem. Kevin Wainwright. Mar 22, 2004 Envelope Theorem Kevin Wainwright Mar 22, 2004 1 Maximum Value Functions A maximum (or minimum) value function is an objective function where the choice variables have been assigned their optimal values.

More information

Algebra Unpacked Content For the new Common Core standards that will be effective in all North Carolina schools in the 2012-13 school year.

Algebra Unpacked Content For the new Common Core standards that will be effective in all North Carolina schools in the 2012-13 school year. This document is designed to help North Carolina educators teach the Common Core (Standard Course of Study). NCDPI staff are continually updating and improving these tools to better serve teachers. Algebra

More information

Coeffects: Unified static analysis of context-dependence

Coeffects: Unified static analysis of context-dependence Coeffects: Unified static analysis of context-dependence Tomas Petricek, Dominic Orchard and Alan Mycroft University of Cambridge, UK {tp322,dao29,am}@cl.cam.ac.uk Abstract. Monadic effect systems provide

More information

Linear Codes. Chapter 3. 3.1 Basics

Linear Codes. Chapter 3. 3.1 Basics Chapter 3 Linear Codes In order to define codes that we can encode and decode efficiently, we add more structure to the codespace. We shall be mainly interested in linear codes. A linear code of length

More information

Dedekind s forgotten axiom and why we should teach it (and why we shouldn t teach mathematical induction in our calculus classes)

Dedekind s forgotten axiom and why we should teach it (and why we shouldn t teach mathematical induction in our calculus classes) Dedekind s forgotten axiom and why we should teach it (and why we shouldn t teach mathematical induction in our calculus classes) by Jim Propp (UMass Lowell) March 14, 2010 1 / 29 Completeness Three common

More information

Research Note. Bi-intuitionistic Boolean Bunched Logic

Research Note. Bi-intuitionistic Boolean Bunched Logic UCL DEPARTMENT OF COMPUTER SCIENCE Research Note RN/14/06 Bi-intuitionistic Boolean Bunched Logic June, 2014 James Brotherston Dept. of Computer Science University College London Jules Villard Dept. of

More information

The Import & Export of Data from a Database

The Import & Export of Data from a Database The Import & Export of Data from a Database Introduction The aim of these notes is to investigate a conceptually simple model for importing and exporting data into and out of an object-relational database,

More information

Rotation Matrices and Homogeneous Transformations

Rotation Matrices and Homogeneous Transformations Rotation Matrices and Homogeneous Transformations A coordinate frame in an n-dimensional space is defined by n mutually orthogonal unit vectors. In particular, for a two-dimensional (2D) space, i.e., n

More information

RINGS WITH A POLYNOMIAL IDENTITY

RINGS WITH A POLYNOMIAL IDENTITY RINGS WITH A POLYNOMIAL IDENTITY IRVING KAPLANSKY 1. Introduction. In connection with his investigation of projective planes, M. Hall [2, Theorem 6.2]* proved the following theorem: a division ring D in

More information

Functional Optimization Models for Active Queue Management

Functional Optimization Models for Active Queue Management Functional Optimization Models for Active Queue Management Yixin Chen Department of Computer Science and Engineering Washington University in St Louis 1 Brookings Drive St Louis, MO 63130, USA chen@cse.wustl.edu

More information

Notes on Determinant

Notes on Determinant ENGG2012B Advanced Engineering Mathematics Notes on Determinant Lecturer: Kenneth Shum Lecture 9-18/02/2013 The determinant of a system of linear equations determines whether the solution is unique, without

More information

Homework until Test #2

Homework until Test #2 MATH31: Number Theory Homework until Test # Philipp BRAUN Section 3.1 page 43, 1. It has been conjectured that there are infinitely many primes of the form n. Exhibit five such primes. Solution. Five such

More information

A Framework for the Semantics of Behavioral Contracts

A Framework for the Semantics of Behavioral Contracts A Framework for the Semantics of Behavioral Contracts Ashley McNeile Metamaxim Ltd, 48 Brunswick Gardens, London W8 4AN, UK ashley.mcneile@metamaxim.com Abstract. Contracts have proved a powerful concept

More information

Automated Theorem Proving - summary of lecture 1

Automated Theorem Proving - summary of lecture 1 Automated Theorem Proving - summary of lecture 1 1 Introduction Automated Theorem Proving (ATP) deals with the development of computer programs that show that some statement is a logical consequence of

More information

6 EXTENDING ALGEBRA. 6.0 Introduction. 6.1 The cubic equation. Objectives

6 EXTENDING ALGEBRA. 6.0 Introduction. 6.1 The cubic equation. Objectives 6 EXTENDING ALGEBRA Chapter 6 Extending Algebra Objectives After studying this chapter you should understand techniques whereby equations of cubic degree and higher can be solved; be able to factorise

More information

CLASSICAL BI: ITS SEMANTICS AND PROOF THEORY

CLASSICAL BI: ITS SEMANTICS AND PROOF THEORY Logical Methods in Computer Science Vol. 6 (3:3) 2010, pp. 1 42 www.lmcs-online.org Submitted Aug. 1, 2009 Published Jul. 20, 2010 CLASSICAL BI: ITS SEMANTICS AND PROOF THEORY JAMES BROTHERSTON a AND CRISTIANO

More information

PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE

PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE International Journal of Computer ScienceandCommunication Vol. 2, No. 1, January-June2011, pp. 153-157 PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE Neeraj Kumar Singhania University,

More information

(Refer Slide Time: 01:11-01:27)

(Refer Slide Time: 01:11-01:27) Digital Signal Processing Prof. S. C. Dutta Roy Department of Electrical Engineering Indian Institute of Technology, Delhi Lecture - 6 Digital systems (contd.); inverse systems, stability, FIR and IIR,

More information

On strong fairness in UNITY

On strong fairness in UNITY On strong fairness in UNITY H.P.Gumm, D.Zhukov Fachbereich Mathematik und Informatik Philipps Universität Marburg {gumm,shukov}@mathematik.uni-marburg.de Abstract. In [6] Tsay and Bagrodia present a correct

More information

Test Case Generation for Ultimately Periodic Paths Joint work with Saddek Bensalem Hongyang Qu Stavros Tripakis Lenore Zuck Accepted to HVC 2007 How to find the condition to execute a path? (weakest precondition

More information

OSTROWSKI FOR NUMBER FIELDS

OSTROWSKI FOR NUMBER FIELDS OSTROWSKI FOR NUMBER FIELDS KEITH CONRAD Ostrowski classified the nontrivial absolute values on Q: up to equivalence, they are the usual (archimedean) absolute value and the p-adic absolute values for

More information

Semantics and Verification of Software

Semantics and Verification of Software Semantics and Verification of Software Lecture 21: Nondeterminism and Parallelism IV (Equivalence of CCS Processes & Wrap-Up) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification)

More information

How To Know If A Domain Is Unique In An Octempo (Euclidean) Or Not (Ecl)

How To Know If A Domain Is Unique In An Octempo (Euclidean) Or Not (Ecl) Subsets of Euclidean domains possessing a unique division algorithm Andrew D. Lewis 2009/03/16 Abstract Subsets of a Euclidean domain are characterised with the following objectives: (1) ensuring uniqueness

More information

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER JASPER DEANTONIO Abstract. This paper is a study of the Turing Degrees, which are levels of incomputability naturally arising from sets of natural numbers.

More information

Rigorous Software Development CSCI-GA 3033-009

Rigorous Software Development CSCI-GA 3033-009 Rigorous Software Development CSCI-GA 3033-009 Instructor: Thomas Wies Spring 2013 Lecture 11 Semantics of Programming Languages Denotational Semantics Meaning of a program is defined as the mathematical

More information

2 Integrating Both Sides

2 Integrating Both Sides 2 Integrating Both Sides So far, the only general method we have for solving differential equations involves equations of the form y = f(x), where f(x) is any function of x. The solution to such an equation

More information

INTRODUCTORY SET THEORY

INTRODUCTORY SET THEORY M.Sc. program in mathematics INTRODUCTORY SET THEORY Katalin Károlyi Department of Applied Analysis, Eötvös Loránd University H-1088 Budapest, Múzeum krt. 6-8. CONTENTS 1. SETS Set, equal sets, subset,

More information

POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful

POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/

More information

EMBEDDING COUNTABLE PARTIAL ORDERINGS IN THE DEGREES

EMBEDDING COUNTABLE PARTIAL ORDERINGS IN THE DEGREES EMBEDDING COUNTABLE PARTIAL ORDERINGS IN THE ENUMERATION DEGREES AND THE ω-enumeration DEGREES MARIYA I. SOSKOVA AND IVAN N. SOSKOV 1. Introduction One of the most basic measures of the complexity of a

More information

Dynamics and Secure Information Flow for a Higher-Order Pi-Calculus

Dynamics and Secure Information Flow for a Higher-Order Pi-Calculus Dynamics and Secure Information Flow for a Higher-Order Pi-Calculus Martin Pettai 1,2 and Peeter Laud 2 1 University of Tartu 2 Cybernetica AS Abstract We show how a type system for secure information

More information

The Basics of Graphical Models

The Basics of Graphical Models The Basics of Graphical Models David M. Blei Columbia University October 3, 2015 Introduction These notes follow Chapter 2 of An Introduction to Probabilistic Graphical Models by Michael Jordan. Many figures

More information

Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.

Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom. Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.com This paper contains a collection of 31 theorems, lemmas,

More information

Parallel programming with Session Java

Parallel programming with Session Java 1/17 Parallel programming with Session Java Nicholas Ng (nickng@doc.ic.ac.uk) Imperial College London 2/17 Motivation Parallel designs are difficult, error prone (eg. MPI) Session types ensure communication

More information

Introduction to type systems

Introduction to type systems Introduction to type systems p. 1/5 Introductory Course on Logic and Automata Theory Introduction to type systems Polyvios.Pratikakis@imag.fr Based on slides by Jeff Foster, UMD Introduction to type systems

More information

A Type System for Data-Flow Integrity on Windows Vista

A Type System for Data-Flow Integrity on Windows Vista A Type System for Data-Flow Integrity on Windows Vista Avik Chaudhuri University of California at Santa Cruz avik@cs.ucsc.edu Prasad Naldurg Sriram Rajamani Microsoft Research India {prasadn,sriram}@microsoft.com

More information

A Note on Context Logic

A Note on Context Logic A Note on Context Logic Philippa Gardner Imperial College London This note describes joint work with Cristiano Calcagno and Uri Zarfaty. It introduces the general theory of Context Logic, and has been

More information

PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include 2 + 5.

PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include 2 + 5. PUTNAM TRAINING POLYNOMIALS (Last updated: November 17, 2015) Remark. This is a list of exercises on polynomials. Miguel A. Lerma Exercises 1. Find a polynomial with integral coefficients whose zeros include

More information

Load Balancing and Switch Scheduling

Load Balancing and Switch Scheduling EE384Y Project Final Report Load Balancing and Switch Scheduling Xiangheng Liu Department of Electrical Engineering Stanford University, Stanford CA 94305 Email: liuxh@systems.stanford.edu Abstract Load

More information

CS510 Software Engineering

CS510 Software Engineering CS510 Software Engineering Propositional Logic Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15-cs510-se

More information

Real Roots of Univariate Polynomials with Real Coefficients

Real Roots of Univariate Polynomials with Real Coefficients Real Roots of Univariate Polynomials with Real Coefficients mostly written by Christina Hewitt March 22, 2012 1 Introduction Polynomial equations are used throughout mathematics. When solving polynomials

More information

INCIDENCE-BETWEENNESS GEOMETRY

INCIDENCE-BETWEENNESS GEOMETRY INCIDENCE-BETWEENNESS GEOMETRY MATH 410, CSUSM. SPRING 2008. PROFESSOR AITKEN This document covers the geometry that can be developed with just the axioms related to incidence and betweenness. The full

More information

Cost Minimization and the Cost Function

Cost Minimization and the Cost Function Cost Minimization and the Cost Function Juan Manuel Puerta October 5, 2009 So far we focused on profit maximization, we could look at a different problem, that is the cost minimization problem. This is

More information

A type checking algorithm for qualified session types

A type checking algorithm for qualified session types A type checking algorithm for qualified session types Marco Giunti INRIA and LIX, École Polytechnique, France We present a type checking algorithm for establishing a session-based discipline in the pi

More information

Verifying security protocols using theorem provers

Verifying security protocols using theorem provers 1562 2007 79-86 79 Verifying security protocols using theorem provers Miki Tanaka National Institute of Information and Communications Technology Koganei, Tokyo 184-8795, Japan Email: miki.tanaka@nict.go.jp

More information

GROUPS ACTING ON A SET

GROUPS ACTING ON A SET GROUPS ACTING ON A SET MATH 435 SPRING 2012 NOTES FROM FEBRUARY 27TH, 2012 1. Left group actions Definition 1.1. Suppose that G is a group and S is a set. A left (group) action of G on S is a rule for

More information

Finite Projective demorgan Algebras. honoring Jorge Martínez

Finite Projective demorgan Algebras. honoring Jorge Martínez Finite Projective demorgan Algebras Simone Bova Vanderbilt University (Nashville TN, USA) joint work with Leonardo Cabrer March 11-13, 2011 Vanderbilt University (Nashville TN, USA) honoring Jorge Martínez

More information

How To Write Intuitionistic Logic

How To Write Intuitionistic Logic AN INTUITIONISTIC EPISTEMIC LOGIC FOR ASYNCHRONOUS COMMUNICATION by Yoichi Hirai A Master Thesis Submitted to the Graduate School of the University of Tokyo on February 10, 2010 in Partial Fulfillment

More information

Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications

Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications Sayantan Das Prasenjit Basu Ansuman Banerjee Pallab Dasgupta P.P. Chakrabarti Department of Computer Science & Engineering

More information

Large induced subgraphs with all degrees odd

Large induced subgraphs with all degrees odd Large induced subgraphs with all degrees odd A.D. Scott Department of Pure Mathematics and Mathematical Statistics, University of Cambridge, England Abstract: We prove that every connected graph of order

More information

The Trip Scheduling Problem

The Trip Scheduling Problem The Trip Scheduling Problem Claudia Archetti Department of Quantitative Methods, University of Brescia Contrada Santa Chiara 50, 25122 Brescia, Italy Martin Savelsbergh School of Industrial and Systems

More information

Representing Reversible Cellular Automata with Reversible Block Cellular Automata

Representing Reversible Cellular Automata with Reversible Block Cellular Automata Discrete Mathematics and Theoretical Computer Science Proceedings AA (DM-CCG), 2001, 145 154 Representing Reversible Cellular Automata with Reversible Block Cellular Automata Jérôme Durand-Lose Laboratoire

More information

Computationally Complete Spiking Neural P Systems Without Delay: Two Types of Neurons Are Enough

Computationally Complete Spiking Neural P Systems Without Delay: Two Types of Neurons Are Enough Computationally Complete Spiking Neural P Systems Without Delay: Two Types of Neurons Are Enough Rudolf Freund 1 and Marian Kogler 1,2 1 Faculty of Informatics, Vienna University of Technology Favoritenstr.

More information

How To Solve Factoring Problems

How To Solve Factoring Problems 05-W4801-AM1.qxd 8/19/08 8:45 PM Page 241 Factoring, Solving Equations, and Problem Solving 5 5.1 Factoring by Using the Distributive Property 5.2 Factoring the Difference of Two Squares 5.3 Factoring

More information

NP-Completeness and Cook s Theorem

NP-Completeness and Cook s Theorem NP-Completeness and Cook s Theorem Lecture notes for COM3412 Logic and Computation 15th January 2002 1 NP decision problems The decision problem D L for a formal language L Σ is the computational task:

More information

Vector and Matrix Norms

Vector and Matrix Norms Chapter 1 Vector and Matrix Norms 11 Vector Spaces Let F be a field (such as the real numbers, R, or complex numbers, C) with elements called scalars A Vector Space, V, over the field F is a non-empty

More information