A linear account of session types in the pi calculus

Size: px
Start display at page:

Download "A linear account of session types in the pi calculus"

Transcription

1 A linear account of session types in the pi calculus Marco Giunti 1 and Vasco T. Vasconcelos 2 1 Iuav University, Venice 2 LaSIGE, Faculty of Sciences, University of Lisbon Abstract. We present a reconstruction of session types in a conventional pi calculus where types are qualified as linear or unrestricted. Linearly typed communication channels are guaranteed to occur in exactly one thread, possibly multiple times. We equip types with a constructor that denotes the two ends of a same communication channel. In order to assess the flexibility of the new type system, we provide three distinct encodings (from the linear lambda calculus, from the linear pi calculus, and from the pi calculus with polarized variables) into our system. For each language we present operational and typing correspondences, showing that our system effectively subsumes the linear pi calculus as well as foregoing works on session types. 1 Pi Calculus This section introduces the pi-calculus, its syntax and semantics, as well as our type system. The syntax is in Figure 1. We rely on a set of variables, ranged over by x, y, z. Values include variables and the booleans true and false. For processes we have (synchronous, unary) output and input, in the forms x v.p and x(y).p, as well as a parallel composition, conditional, scope restriction, replication and the terminated process. The binders for the language appear in parenthesis: x is bound in both y(x).p and (νx)p. Free and bound variables in processes are defined accordingly, and so is alpha conversion, substitution of a variable x by a value v in a process P, denoted P [v/x]. We follow Barendregt s variable convention, requiring bound variables to be distinct from free variables in any mathematical context. Structural congruence is the smallest relation on processes including the rules in the same figure. The first three rules say that parallel composition is commutative, associative and has 0 for neutral element. The last rule on the first line captures the essence of replication as an unbounded number of identical processes. The rules in the second line deal with scope restriction. The first, scope extrusion, allows the scope of x to encompass Q; due to variable convention, x bound in (νx)p, cannot be free in Q. The other two rules state that restricting over a terminated process has no effect, and allow exchanging the order of restrictions.

2 Syntax b ::= Booleans: P ::= Processes: true true x v.p output false false x(x).p input v ::= Values: P P composition b boolean value if v then P else P conditional x variable (νx)p restriction Rules for structural congruence P replication 0 inaction P Q Q P (P Q) R P (Q R) P 0 P P P P (νx)p Q (νx)(p Q) (νx)0 0 (νx)(νy)p (νy)(νx)p Rules for reduction x v.p x(y).q P Q[v/y] [R-Com] if true then P else Q P if false then P else Q Q [R-IfT] [R-IfF] P Q (νx)p (νx)q P Q P R Q R P P P Q Q Q P Q [R-Res] [R-Par] [R-Struct] Fig. 1. Pi calculus: Syntax and operational semantics The reduction reduction is the smallest relation on processes including the rules in Figure 1. The [R-Com] rule communicates value v from an output prefixed one x v.p to an input prefixed process x(y).q; the result is the parallel composition of the continuation processes, where the bound variable y is replaced by value v in the input process. The rules for the conditional are straightforward. The rules in the last line allow reduction to happen underneath scope restriction and parallel composition, and incorporate structural congruence into reduction. The syntax of types is described in Figure 2. Types include the boolean type, end point types and channel types. The novelty with respect linear and sessionbased systems for the pi calculus is the introduction of a new type constructor to describe the two ends of a same channel, (S 1, S 2 ), where S 1 details the behaviour of one end, whereas S 2 details that of the other end. An end point type S can be a pre type qualified with lin or un, a recursive type or a type variable. Each qualifier in a type controls the number of times the channel can be used at that point: exactly once for lin; zero or more times for un. A pre type of the form!t.s describes a channel end able to send a value of type T and to proceed as prescribed by S. Similarly, pre type?t.s describes a channel end able to receive a value of type T and continue as S. Pre type end describes a channel end on which no further interaction is possible. For recursive (end point) types we rely

3 q ::= Qualifiers: a type variable lin linear µa.s recursive type un unrestricted T ::= Types: p ::= Pre Types: bool boolean?t.s receive S end point!t.s send (S, S) channel end termination Γ ::= Contexts: S ::= End Point Types: empty context q p qualified channel Γ, x: T variable binding Fig. 2. Pi calculus: Types and typing contexts on a set of type variables, ranged over by a. Recursive types are required to be contractive, that is, containing no subexpression of the form µa 1... µa n.a 1. Type equality is not syntatic. Instead, we define it as the equality of regular infinite trees obtained by the infinite unfolding of recursive types, modulo pair commutation. The formal definition, which we omit, is co-inductive. In this way we use types (µa.lin!bool.lin?bool.a, un end) and (un end, lin!bool.µb.lin?bool.lin!bool.b) interchangeably, in any mathematical context. This allows us never to consider a type µa.s explicitly (or a for that matter). Instead, we pick another type in the same equivalence class, namely S[µa.S/a]. If the result of the process turns out to start with a µ, we repeat the procedure. Unfolding is bound to terminate due to contractiveness. In other words, we take an equi-recursive view of types [?]. Type duality plays a central role in the theory of session types, ensuring that communication between the two ends of a channel proceeds smoothly. Intuitively, the dual of output is input and the dual of input is output. In particular if S 2 is dual of S 1, then q?t.s 1 is dual of q!t.s 2. Session type end is dual of itself. Rather than providing a co-inductive definition of duality, we start by defining a function from end-point channels into end-point channels as follows. q?t.s = q!t.s q!t.s = q?t.s q end = q end µa.s = µa.s a = a Then, to check that a given end point type S 1 is dual of another type S 2, we first build the dual of S 1 and then check that the thus obtained type is equivalent to S 2. For example, to show that type µa.lin?bool.lin!bool.a is a dual of type lin!bool.µb.lin?bool.lin!bool.b, we build µa.lin?bool.lin!bool.a = µa.lin!bool.lin?bool.a, and then show that µa.lin!bool.lin?bool.a = lin!bool.µb.lin?bool.!bool.b. Qualifiers are important: S and S must be equally qualified so that a linear output process may find a linear input process to embark in reduction. Contexts, or type environments, are inductively defined in Figure 2. In a context Γ, x: T we assume that x does not occur in Γ ; we also assume the various variable bindings in Γ to be unordered. We define predicate un to be true of a)

4 Context splitting rules Γ = Γ 1 Γ 2 T = un p or (un p 1, un p 2) = Γ, x: T = (Γ 1, x: T ) (Γ 2, x: T ) Γ = Γ 1 Γ 2 T = lin p or (lin p 1, lin p 2) Γ = Γ 1 Γ 2 T = lin p or (lin p 1, lin p 2) Γ, x: T = (Γ 1, x: T ) Γ 2 Γ, x: T = Γ 1 (Γ 2, x: T ) Γ = Γ 1 Γ 2 Γ, x: (lin p 1, lin p 2) = (Γ 1, x: lin p 1) (Γ 2, x: lin p 2) Γ = Γ 1 Γ 2 Γ, x: (lin p 1, un p 2) = (Γ 1, x: (lin p 1, un p 2)) (Γ 2, x: un p 2) Γ = Γ 1 Γ 2 Γ, x: (lin p 1, un p 2) = (Γ 1, x: un p 2) (Γ 2, x: (lin p 1, un p 2)) Typing rules for values un(γ ) Γ b: bool Typing rules for processes un(γ ) Γ, x: T x: T Γ v : (S, un p) Γ v : S [T-Bool] [T-Var] [T-Strength] un(γ ) Γ 0 Γ 1 P 1 Γ 2 P 2 Γ P un(γ ) Γ 1 Γ 2 P 1 P 2 Γ P Γ 1 v : bool Γ 2 P 1 Γ 2 P 2 Γ 1 Γ 2 if v then P 1 else P 2 Γ, x: S, y : T P ( ) Γ, x: q?t.s x(y).p Γ, x: (S, S ), y : T P ( ) Γ, x: (q?t.s, S ) x(y).p ( ) q = un q?t.s = S Γ,x: (S, S) P Γ (νx)p Γ 1 v : T Γ 2, x: S P ( ) Γ 1 (Γ 2, x: q!t.s) x v.p [T-Inact] [T-Par] [T-Repl] [T-If] [T-Res] [T-In],[T-Out] Γ 1 v : T Γ 2, x: (S, S ) P ( ) Γ 1 (Γ 2, x: (q!t.s, S )) x v.p [T-InC],[T-OutC] ( ) q = un q!t.s = S Fig. 3. Pi calculus: Typing the empty context, as well as of b) context Γ, x: bool, context Γ, x: un p, and context Γ, x: (un p 1, un p 2 ), whenever un(γ ). Typing relies on the context splitting operation described in Figure 3. It should be easy to understand: unrestricted types are copied into both contexts, linear types are placed in one of the two resulting contexts. The first four rules are standard [?], the last three rules are new to this work; the philosophy however remains the same. We omit three rules, duals to the last three, obtained by interchanging the end point types in the channel type (e.g., (un p 2, lin p 1 ) in the last rule), for the effect can obtained by a suitable choice of the type in its equivalence class (recall that pair types are unordered).

5 Equipped with the notions of type duality, unrestricted contexts, and context splitting we are ready to introduce the typing rules in Figure 3. The first two typing rules for values are standard. Rule [T-Strength] is central to our system with channels described as pairs of types; we discuss it after introducing the remaining typing rules. For processes, rule [T-Inact] says that the terminated process can only be typed in an unrestricted context, ensuring that linear channels are given a chance to be consumed. Rule [T-Par] uses context splitting to partition linearly typed variables between the two processes: the incoming context is split into Γ 1 and Γ 2, and we use the former to type check process P 1 and the latter to type check process P 2. Rule [T-Repl] for replication requires the typing context not to contain linear values, for P may be used an unrestricted number of types. Rule [T-If] for the conditional process splits the incoming context in two parts: one used to check the condition, the other to check both branches. The same context for the two branches is justified by the fact that only one of P 1 or P 2 will be executed. Rule [T-Res] allows restricting channels whose end points are dual, making sure that communication on the channel happens according to the plan. Allowing to restrict a end point type S type would not break type preservation, Theorem 1, but we believe that such an alternative rule does not fit well in a linear system, where we expect linear channels to be given an opportunity to be consumed. Even though unrestricted end point types cannot be directly restricted, we can show that, for each derivation of Γ, x: S P, there is a derivation of Γ, x: (S, un p) P, thus allowing to apply scope restriction to an otherwise unrestricted channel end. We have two rules for input, [T-In] and [T-InC], depending on the type for channel x in the context. Rule [T-In] deals with end point types. If x is typed with q?t.s, we know that the bound variable y is of type T, and we type check P under the extra assumption y : T. Equally important is the fact that the continuation uses channel x at continuation type S, that is, process x(y).p uses channel x at type q?t.s whereas P may use the same channel this time at type S. Finally, unrestricted channels, given that they may be shared, must retain their behavior throughout computation, hence the side condition. A solution to the equation in the side condition is µa?t.a for a not in T, which we abbreviate to?t (and similarly for output). Rule [T-InC] follows the same pattern, consuming one end point and keeping the other unchanged. Similarly to input, we have two rules for output. Rule [T-Out], splits the context in two parts, one to check v and the other to check continuation P. Notice that the context in the conclusion, Γ 1 (Γ 2, x: q!t.s) allows to type process x x with a context x: S with type S such that S = un!s.s. Rule [T-Strength] allows for a fine grained control of the channel ends of a given channel. A process holding the two ends of a given channel x, say (!bool,?bool), may pass the output capability only by using [T-Var] followed by [T-Strength] to obtain Γ, x: (!bool,?bool) x:!bool and then compose with rule [T-Out] or [T-OutC] in a process of the form y x.p. The rule is also fundamental in establishing the main result of this section.

6 To lighten the syntax in examples, we omit all unrestricted qualifiers and only annotate linear types. We also omit the trailing un end in types, as well as the trailing 0 in processes. As an example, consider the type?(lin!bool).s of an unrestricted channel that receives a linear channel capable of outputting a boolean value. The following sequent is easy to establish, x:?(lin!bool).s x(z).z true x(w).w false but only for an appropriate type S. Reading rule [T-In], we realize that S must be equivalent to?(lin!bool).s, that is S must be (equivalent to) µa.?(lin!bool).a, abbreviated to?(lin!bool). Continuing with the example, if P is the above process, then P (νy)x y is not typable, for the linear input capability of channel y is never exercised. But P (νy)(x y y(u)) is typable under context x: (?(lin!bool),!(lin?bool)). Given that a type (un p 1, lin p 2 ) cannot possibly be restricted in a process (cf. rule [T-Res]), the reader may wonder why we consider them at all. It turns out that free channel output may lead to situations where a thread holds the two ends of a same channel [?]. For instance, process z x z(w).w(y).x true, typable under context z : (?S,!S), x: (S, S) with S = lin?bool, reduces to process P = x(y).x true, which we want to type under the same context. By applying rule [T-InC] to P we obtain a judgment with a un-lin type, namely z : (?S,!S), x: (end, lin!bool) x true. A further application of rule [T-OutC] gets rid of the un-lin type, yielding z : (?S,!S), x: (end, end) 0 typable under rule [T-Inact]. We conclude the section with the main result of our system. Reduction preserves typability only for a certain kind of contexts. To understand why reduction does not preserve typability in the presence of arbitrary contexts, take for P the process x(z).if z then 0 else 0 (νy)x y. We can easily see that P is typable under the (non balanced) context x: (lin!end.end, lin?bool.end). But P reduces to process (νy)if y then 0 else 0 which is not typable. The whole purpose of balancing is to make sure that the type of y in the output is that of z in the input. We define predicate balanced to be true of a) the empty context, and b) context Γ, x: bool and context Γ, x: (S, S) whenever Γ is balanced. Theorem 1 (Type Preservation). If Γ 1 P 1 with Γ 1 balanced and P 1 P 2, then Γ 2 P 2 with Γ 2 balanced. Proof (Sketch). Albeit standard, the proof is quite long due to the combinatorics introduced by (the various rules in) context splitting, the lin-un qualifiers and the four rules for input and for output. We rely on several standard auxiliary results, including unrestricted context weakening, context strengthening, a substitution lemma (stating that if Γ 1 v : T and Γ 2, x: T P and Γ 1 Γ 2 is defined then Γ 1 Γ 2 P [v/x]), and balanced context preservation for structural congruence. In order to proceed by induction on the derivation of the reduction step when [T-Par] is the last rule, we need a stronger statement that details the relation between Γ 1 and Γ 2, namely Γ 2 = Γ 1 or Γ 1 = Γ, x: (q?t.s, q!t.s) and Γ 2 = Γ, x: (S, S).

7 A Algoritmic Type Checking The typing rules provided in the previous sections give a concise specification of what we understand by well formed programs. They cannot however be implemented directly for three main reasons. One is the difficulty of implementing the non-deterministic splitting operation, Γ = Γ 1 Γ 2, for we must guess how to split an incoming context Γ in two parts. The other is the problem of guessing the types to include in the context when in presence of scope restriction. To solve the first problem, we restructure the type checking rules to avoid having to guess context splitting. To address the second difficulty we seek the help of programmers by requiring explicit annotations in the scope restriction constructor and write (νx: (S 1, S 2 ))P. Changes are in Figure 4. The central idea of the new type checking system is that, rather than splitting the context into two parts before checking a complex process, we pass the entire context to the first subprocess and have it return the unused part. This output is then passed to the second subprocess, which in turn returns the unused portion of the context, and so on. The output of the last subprocess is then the output of the process under consideration. To make a clear distinction among the used and unused part of a typing context we introduce starred or used end-point types S. We let T range over bool, S and (S, S ) where is empty or is. Type environments I are a map from values to starred types T. The algoritmic rules for values have the form I 1 A v : T I 2 where I 2 is the type enviroment produced as output. Notice that the judgement for the value is plain, i.e. stars are not considered when typing values. When T is a linear channel type we have I 2 = I 1 \v. Similarly, when T is a linear end point type and I(v) is a channel type we keep the other end-point, otherwise we remove the entry for v. When T is an unrestricted channel or end-point type we have I 2 = I 1. The cases for mixed channel types are similar. The rules for processes have the form I 1 A P I 2. Most of the technical device is required in rules [A-Inact],[A-Par] to remove the used part of the environment. We let I 1 \I 2 be the environment obtained by removing all the informations of I 2 from I 1 ; the formal definition is in Figure 4. In rule [A-Inact] we check that the starred types in (the codomain of) the output environment are unrestricted.this enforces linear continuations to be consumed whithin a single thread by (i) using them as input/output or (ii) delegate them. In Rule [A-Par] we type the next thread with the output environment pruned by the starred entries. We have four rules for output processes corresponding to linear channel and end-point types ([A-Out-L],[A-OutC-L]) and to unrestricted channel and endpoint types ([A-Out-Un],[A-OutC-Un]). In rule [A-Out-L] we type the sent value without using the typing for the output channel. The continuation type for the output channel is first starred to flag that a linear capability has been used and then added to the context to type the process. Rule [A-OutC-L] is similar but here remove and update only the channel-end used to type the output

8 channel. In rules [A-Out-Un] and [A-OutC-Un] we keep the same context to type the sent value and we let the continuation type for the output channel be starred only if the type for the output channel was already starred. The rules for input prefixes [A-In-L],[A-InC-L],[A-In-Un] and [A-InC-Un] follow the same rationale: the continuation of a linear input is starred while a continuation of unrestricted input is starred only if the type was already starred. Differently from [A-Inact] in the input rules we need to enforce that the linear capabilities associated to the (bound) variable for the input has been consumed within a single thread. For this very reason we reject processes that returns such variable not unrestricted. The same holds for rule [A-Res]. To illustrate the starring mechanism, consider the following judgement I 1, x : lin!bool.q!bool A x true.0 P inferred from the following judgements in [A-Par]: I 1, x : lin!bool.q!bool A x true.0 I 2 ( ) and I 2 \I 2 A P By applying [A-Out-L] and typying for linear values to (*) we infer the judgements I 1 A true : bool I 1 I 1, x : q!bool A 0 (I 1, x : q!bool ) The qualifier q is equal to un because rule [A-Inact] requires the starred closure of I 1, x : q!bool (which includes the entry x : q!bool ) to be unrestricted. Indeed if we let q to be linear we would have un unsound solution because we do not have any guarantee that the linear output will be consumed in thread P. For this very reason we first check in [A-Inact] that starred entries are unrestricted and then in [A-Par] we type the next thread by using the environment pruned by such entries. To prove that the algoritmic system is sound we first need some auxiliar result. The first Lemma says that the output environment is smaller. Lemma 1. If I 1 A P I 2 then dom(i 2 ) dom(i 1 ). The next Lemma says that linear starred entries cannot be returned. Lemma 2. If I 1 A P I 2 then un(i 2 ). An important Corollary is that linear typings are preserved, in the following sense. Corollary 1 (Linear Type Invariance). Let I 1 A P I 2. If I 1 (x) = linp 1 then I 2 (x) = linp 2 implies p 1 = p 2 and = ɛ; If I 1 (x) = (linp 1, linp 2) then I 2 (x) = (linp 3, linp 4) implies p 1 = p 2 and p 3 = p 4 and = ɛ; If I 1 (x) = (linp 1, linp 2) then I 2 (x) = linp 3 implies linp 1 = linp 3 or linp 2 = linp 3.

9 For (non-starred) unrestricted typings we have type preservation. Lemma 3 (Type preservation). Let I 1 A P I 2. If I 1 (x) = unp 1, (unp 1, unp 2 ) then I 2 (x) = I 1 (x); If I 1 (x) = (unp 1, S 1) then I 2 (x) = (unp 1, S 2) or I 2 (x) = unp 1. The linear-closure of a type environment I, noted I l, is obtained by projecting all the linear assumptions in I. l = (I, x: unp ) l = I l (I, x : linp) l = I l, x : linp (I, x : (linp 1, linp 2)) l = I l, x : (linp 1, linp 2)) (I, x : (linp 1, unp 2)) l = I l, x : linp 1 (I, x : (unp 1, linp 2)) l = I l, x : linp 2 (I, x: (unp 1, unp 2)) = I l We let erase be the function removing stars from type environments I and type annotations from processes. Function erase map type enviroments I to type enviroments Γ. Lemma 4. I 1 A P I 2 implies erase(i 1 \I l 2) erase(p ). Proof. We proceed by induction on the length of the inference. In the output cases we rely on a similar result for values stating that I 1 A v : T I 2 implies erase(i 1 \I l 2) v : T. [A-Inact] We have I A 0 I. From un(erase(i\i l )) and [T-Inact] we infer erase(i\i l ) 0, as requested. [A-Par] Assume I 1 A P Q I 3 inferred from I 1 A P I 2 and I 2 \I2 A Q I 3. By induction hypothesis we infer We prove that erase(i 1 \I l 2) erase(p ) (1) erase((i 2 \I 2 )\I l 3) erase(q) (2) erase(i 1 \I l 3) erase(p Q) by applying [T-Par] to (1,2) whenever the split of erase(i 1 \I l 2) and erase((i 2 \I 2 )\I l 3) is defined otherwise by applying [T-Par] to (1) and erase(q) (3) where is obtained by unrestricted weakening of the environment in (2). We proceed by case analysis on I 1 (x) = T. T = linp 1. We apply [T-Par] to (1,2). Indeed by linear type invariance if I 2 (x) is linear then is equal to T. In such case x dom(i 1 \I l 2). Therefore ((I 2 \I 2 )\I l 3)(x) = (I 1 \I l 3)(x), as required. Otherwise assume I 2 (x) = un p. We have x (I 2 \I 2 ) and by Lemma 1 we deduce that x dom(i 3 ). Thus (I 1 \I l 2)(x) = T = (I 1 \I l 3)(x). Similarly when x dom(i 2 ) we have x dom(i 3 ) and (I 1 \I l 2)(x) = T = (I 1 \I l 3)(x).

10 T = linp 1. We apply [T-Par] to (1,2). Indeed by Lemma 2 we infer that x dom(i 2 ) and we proceed as above. T = unp 1. By type preservation I 2 (x) = T and in turn erase(i 1 \I l 2) erase((i 2 \I 2 )\I l 3)(x) = T. We have (I 1 \I l 3)(x) = T and by applying [T-Par] to (1,2) we have done. T = unp 1, (unp 1, unp 2). We apply [T-Par] to (1,4). We have x dom((i 2 \I 2 )\I l 3). By unrestricted weakening (Lemma??) we infer the judgement erase((i 2 \I 2 \I l 3), x : T ) erase(q) (4) We have ((I 1 \I l 2) )(x) = unp 1 = (I 1 \I l 3)(x) where is the environment of (4). T = (unp 1, unp 2). We have (I 1 \I l 2)(x) = T and ((I 2 \I 2 )\I l 3)(x) = unp 1. By unrestricted weakening we have erase((i 2 \I 2 \I l 3) x : unp 2) erase(q) (5) We apply [T-Par] to (1,5) and we have done. T = (linp 1, linp 2). Assume I 2 (x) = (S1, S2). By linear type invariance we know that each Si or is linear and equal to linp i or is unrestricted and starred. For instance, let S1irc c = linp 1, S2 = un p 3. We have (I 1 \I2)(x) l = linp 2 and (I 2 \I2 )(x) = linp 1. We have (I 1 \I2) l ((I 2 \I2 ))(x) = T and in turn (I 1 \I2) l ((I 2 \I2 )\Il 3)(x) equal to (I 1\I3)(x). l We apply [T-Par] to (1,2) and we have done. Now let I 2 (x) = S1. If S1 = linp i for some i = 1, 2 then (I 1 \I2)(x) l = linp j where j = 1 when i = 2 and vice versa. We proceed as above and we close the proof. Otherwise we have S1 = unp 3 and (I 1 \I2)(x) l = linp i for some i = 1, 2. From x dom(i 2\I2 ) and in turn x dom(i 3 ) we infer the desired result by applying [T-Par] to (1,2). Finally when x dom(i 2 ) we proceed as in the previous case. T = (linp 1, unp 2 ) We could have (I 1 \I2)(x) l = unp 2 and (I 2 \I2 )(x) = T or (I 1 \I2)(x) l = T and (I 2 \I2 )(x) = unp 2. In all cases we infer (I 1 \I2) l (I 2 \I2 \Il 3)(x) equal to (I 1\I3)(x) l and we conclude by applying [T-Par] to (1,2). T = (linp 1, unp 2) If (I 1 \I2)(x) l = T then x dom(i 2 \I2 ). We apply [T-Par] to (1,4) and we have done. Otherwise if (I 1 \I2)(x) l = unp 2 then (I 2 \I2 ) = linp 1. We apply [T-Par] to (1,5) and we have done. The remaining cases for T = (unp 1, unp 2 ), (unp 1, linp 2) are similar to the symmetric cases. [A-Out-L] We have I 1, x: lin!t.s A x v.p I 3 inferred from I 1 A v : T I 2 and I 2 x : S A P I 3. Since x I 2 we could write I 2, x : S A P I 3. We use the result erase(i 1 \I l 2) v : T together with the inductive hypothesis erase((i 2, x : S )\I l 3) erase(p ) to infer the desired result. First we note that x dom(i l 3). This is immediate for S = unp while for S = linp we exploit Corollary 2. We rewrite the context as erase(i 2 \I l 3, x : S ). It s easy to check that erase(i 1 \I l 2) erase(i 2 \I l 3, x : lin!t.linp ) is defined. We apply [T-Out] and obtain erase(i 1 \I l 2) erase(i 2 \I l 3, x : lin!t.linp ) erase(x v.p )

11 To conclude we need to prove that the environment is equal to erase((i 1, x: lin!t.s )\I3). l This is obtained by noting that erase(i 1 \I2) l erase(i 2 \I3) l = erase(i 1 \I3). l [A-Out-Un] We have I 1, x: un!t.s A x v.p I 3 inferred from I 1, x: un!t.s A v : T I 2 and I 2 A P I 3. We know that erase(i 1, x: un!t.s \I2) l v : T and by I.H. we have erase(i 2 \I3) l A erase(p ). From the rule for typing unrestricted values we know that I 2 (x) = un!t.s. We apply [T-Out] and infer erase(i 1, x: un!t.s \I2) l erase(i 2 \I3) l erase(x v.p ) and we have done since the enviroment is equal to erase(i 1, x: un!t.s \I3). l [A-OutC-L] We have I 1, x: (lin!t.s1, S2) A x v.p I 3 inferred from I 1, x: S2 A v : T I 2 and I 2 x : S1 A P I 3. We exploit erase((i 1, x: S2)\I 2) l A v : T and the inductive hypothesis erase(i 2 x : S1\I 3) l erase(p ). First we note that if x dom(i3) l then it needs to be that S2 = linp; this is deduced by using Corollary 2. In such case we have (I 2 x : S1)\I 3 l = I 2 \I3, l x : S1. Since the split of erase((i 1, x: linp)\i2) l and erase(i 2 \I3, l x : lin!t.s1) is defined and equal to erase((i 1, x: (lin!t.s1, linp))\i3) l we could apply [T-OutC] and conclude: erase((i 1, x: linp)\i l 2) erase(i 2 \I l 3, x : lin!t.s 1) erase(x v.p ) Otherwise assume x dom(i l 3) and S 2 = unp ; if S 2 = linp we proceed as above. In such case we have I 2 x : S 1\I l 3 = (I 2 \x\i l 3), x : (S 1, unp ). We apply [T-OutC] and infer erase((i 1, x: unp )\I l 2) erase((i 2 \x\i l 3), x : (S 1, unp )) erase(x v.p ) [A-OutC-Un] Similar to [A-Out-Un]. [A-In-L] We have I 1, x: lin?t.s A x(y).p I 2 \y inferred from I 1, x: S, y : T A P I 2 where if y dom(i 2 ) then un(i 2 (y)). By I.H. we have erase((i 1, x: S, y : T )\I l 2) erase(p ) We know that x dom(i l 2); this is obtained by using Lemma 2 whever S = linp. The condition on y says that as well y dom(i l 2). Therefore (I 1, x: S, y : T )\I l 2 = I 1, \I l 2, x: S, y : T. We apply [T-In] and infer erase(i 1, \I l 2, x: lin?t.s ) erase(x(y).p ) as requested since erase(i 1, \I2, l x: lin?t.s ) = erase((i 1, x: lin?t.s )\I2). l [A-InC-L] We have I 1, x: (lin?t.s1, S2) A x(y).p I 2 \y inferred from I 1, x: (S1, S2), y : T A P I 2 with y I 2 only if unrestricted. If x dom(i2) l then by Corollary 1 we have S2 = linp = I2(x). l In this case we have (I 1, x: (S1, S2), y : T )\I2 l = (I 1 \I2), l x : S1, y : T since y dom(i2). l We apply [T-In] and infer erase((i 1 \I l 2), x : lin?t.s 1) erase(x(y).p )

12 We rewrite the judgement as erase((i 1, x : (lin?t.s 1, linp))\i l 2) erase(x(y).p ) and we have done. Othwerwise assume x dom(i l 2). We have (I 1, x: (S 1, S 2), y : T )\I l 2 = (I 1 \I l 2), x : (S 1, S 2), y : T. We apply [T-InC] and infer erase((i 1 \I l 2), x : (lin?t.s 1, S 2) erase(x(y).p ) We have done since erase((i 1 \I l 2), x : (lin?t.s 1, S 2) is equal to erase((i 1, x : (lin?t.s 1, S 2))\I l 2). Corollary 2 (Algorithmic Soundness). If I 1 A P I 2 with un(i 2 ) then erase(i 1 ) erase(p ). Proof. Follows from Lemma 4 and I l 2 =. Remark 1. The algorithmic system is not complete. Indeed we have erase(i, x : un!t.s ) x u. erase(p ) x v. erase(q) while I, x : un!t.s A x u.p x v.q.

13 New syntactic forms P ::=... (νx: (S, S))P T ::= bool S (S, S ) S ::=... ::= ɛ Processes: annotated scope restriction Types: end-point type annotation Context difference \x = (I, x: T )\x = I I \x = I 1 (I, y : T )\x = I 1, y : T I 1\I 2 = {x : I 1(x) x dom(i 2)} {x : S1 I 1(x) = (S1, S2 ) and I 2(x) = S2 } {x : S2 I 1(x) = (S1, S2 ) and I 2(x) = S1 } Context Updating I x : T = I, x : T x dom(i) Starred closure I x : S 2 = (I\x), x : (S 1, S 2 ) I(x) = S 1 = (I, x : S) = I (I, x : S ) = I, x : S (I, x : (S 1, S 2)) = I (I, x : (S 1, S 2 )) = I, x : (S 1, S 2 ) (I, x : (S 1, S 2)) = I, x : S 1 (I, x : (S 1, S 2 )) = I, x : S 2 Typing rules for values I 1, x: (lin p, S ), I 2 A x: lin p I 1, x: S, I 2 I 1, x: (S, lin p ), I 2 A x: lin p I 1, x: S, I 2 T = (lin p 1, un p 2) T = (un p 1, lin p 2) I 1, x: T, I 2 A x: un p 2 I 1, x: T, I 2 I 1, x: T, I 2 A x: un p 1 I 1, x: T, I 2 T = lin p, (lin p I A true, false: bool I 1, lin p 2) T = un p, (un p 1, un p 2) I 1, x: T, I 2 A x: T I 1, I 2 I 1, x: T, I 2 A x: T I 1, x: T, I 2 T = (un p 1, un p 2) T = (un p 1, un p 2) I 1, x: T, I 2 A x: un p 1 I 1, x: T, I 2 I 1, x: T, I 2 A x: un p 2 I 1, x: T, I 2 Typing rules for processes un(i ) I A 0 I I 1 A P I 2 I 2\I 2 A Q I 3 I 1 A P Q I 3 I 1 A P I 2 I 1 A P I 2 ([A-Inact],[A-Par],[A-Repl]) I 1 A v : bool; I 2 I 2 A P : I 3 I 2 A Q: I 3 I 1 A if v then P else Q I 3 I 1, y : (S, S) A P I 2 ( ) I 1 A (νy : (S, S))P I 2\y [A-If] [A-Res] I 1, x: S, y : T A P I 2 ( ) I 1, x: lin?t.s A x(y).p I 2\y I 1, x: un?t.s, y : T A P I 2 ( ) I 1, x: un?t.s A x(y).p I 2\y I 1, x: (S1, S2 ), y : T A P I 2 ( ) I 1, x: (lin?t.s1, S 2 ) A x(y).p I2\y [A-In-L],[A-InC-L] I 1, x: (un?t.s1, S2 ), y : T A P I 2 ( ) I 1, x: (un?t.s1, S 2 ) A x(y).p I2\y [A-In-Un],[A-InC-Un] I 1 A v : T I 2 I 2 x : S A P I 3 I 1, x: S2 A v : T I 2 I 2 x : S1 A P I 3 I 1, x: lin!t.s A x v.p I 3 I 1, x: (lin!t.s1, S 2 ) A x v.p I3 [A-Out-L],[A-OutC-L] I 1, x : un!t.s A v : T I 2 I 2 A P I 3 I 1, x: (un!t.s1, S2 ) A v : T I 2 I 2 A P I 3 I 1, x: un!t.s A x v.p I 3 I 1, x: (un!t.s1, S 2 ) A x v.p I3 [A-Out-Un],[A-OutC-Un] ( ) y dom(i 2) un(i 2(y)) Fig. 4. Algoritmic type checking

Fundamentals of Session Types

Fundamentals of Session Types Fundamentals of Session Types Vasco T. Vasconcelos LaSIGE, Faculty of Sciences, University of Lisbon, Portugal Abstract We present a reconstruction of session types in a linear pi calculus where types

More information

Session Types Revisited

Session Types Revisited Session Types Revisited Ornela Dardha a, Elena Giachino b, Davide Sangiorgi b a School of Computing Science, University of Glasgow, United Kingdom b INRIA Focus Team / DISI, University of Bologna, Italy

More information

Lecture Notes on Sequent Calculus

Lecture Notes on Sequent Calculus Lecture Notes on Sequent Calculus 15-816: Modal Logic Frank Pfenning Lecture 8 February 9, 2010 1 Introduction In this lecture we present the sequent calculus and its theory. The sequent calculus was originally

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 September 2, 2004 These supplementary notes review the notion of an inductive definition and

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 28, 2003 These supplementary notes review the notion of an inductive definition and give

More information

The Underlying Semantics of Transition Systems

The Underlying Semantics of Transition Systems The Underlying Semantics of Transition Systems J. M. Crawford D. M. Goldschlag Technical Report 17 December 1987 Computational Logic Inc. 1717 W. 6th St. Suite 290 Austin, Texas 78703 (512) 322-9951 1

More information

Lecture Notes on Linear Logic

Lecture Notes on Linear Logic Lecture Notes on Linear Logic 15-816: Modal Logic Frank Pfenning Lecture 23 April 20, 2010 1 Introduction In this lecture we will introduce linear logic [?] in its judgmental formulation [?,?]. Linear

More information

The Locally Nameless Representation

The Locally Nameless Representation Noname manuscript No. (will be inserted by the editor) The Locally Nameless Representation Arthur Charguéraud Received: date / Accepted: date Abstract This paper provides an introduction to the locally

More information

CS522 - Programming Language Semantics

CS522 - Programming Language Semantics 1 CS522 - Programming Language Semantics Simply Typed Lambda Calculus Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 We now discuss a non-trivial extension of

More information

Consequence Relations and Natural Deduction

Consequence Relations and Natural Deduction Consequence Relations and Natural Deduction Joshua D. Guttman Worcester Polytechnic Institute September 9, 2010 Contents 1 Consequence Relations 1 2 A Derivation System for Natural Deduction 3 3 Derivations

More information

Concurrency theory. proof-techniques for syncronous and asynchronous pi-calculus. Francesco Zappa Nardelli. INRIA Rocquencourt, MOSCOVA research team

Concurrency theory. proof-techniques for syncronous and asynchronous pi-calculus. Francesco Zappa Nardelli. INRIA Rocquencourt, MOSCOVA research team Concurrency theory proof-techniques for syncronous and asynchronous pi-calculus Francesco Zappa Nardelli INRIA Rocquencourt, MOSCOVA research team francesco.zappa nardelli@inria.fr together with Frank

More information

Programming Languages and Types

Programming Languages and Types Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Subtyping Motivation With our usual typing rule for applications the term is not well typed. ` t 1 : T 11!T 12 ` t

More information

Secrecy and Group Creation

Secrecy and Group Creation Secrecy and Group Creation Luca Cardelli 1 Giorgio Ghelli 2 Andrew D. Gordon 1 Abstract We add an operation of group creation to the typed π-calculus, where a group is a type for channels. Creation of

More information

Bilateral Proofs of Safety and Progress Properties of Concurrent Programs (Working Draft)

Bilateral Proofs of Safety and Progress Properties of Concurrent Programs (Working Draft) Bilateral Proofs of Safety and Progress Properties of Concurrent Programs (Working Draft) Jayadev Misra December 18, 2015 Contents 1 Introduction 3 2 Program and Execution Model 4 2.1 Program Structure..........................

More information

Lecture 11: Measuring the Complexity of Proofs

Lecture 11: Measuring the Complexity of Proofs IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 11: Measuring the Complexity of Proofs David Mix Barrington and Alexis Maciel July

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

Design of Distributed Systems Melinda Tóth, Zoltán Horváth

Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Publication date 2014 Copyright 2014 Melinda Tóth, Zoltán Horváth Supported by TÁMOP-412A/1-11/1-2011-0052

More information

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus

More information

Supplementary Notes on Inductive Definitions

Supplementary Notes on Inductive Definitions Supplementary Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 29, 2002 These supplementary notes review the notion of an inductive definition

More information

A Tableau Calculus for Minimal Modal Model Generation

A Tableau Calculus for Minimal Modal Model Generation M4M 2011 A Tableau Calculus for Minimal Modal Model Generation Fabio Papacchini 1 and Renate A. Schmidt 2 School of Computer Science, University of Manchester Abstract Model generation and minimal model

More information

Bisimulation for conditional modalities

Bisimulation for conditional modalities Bisimulation for conditional modalities Alexandru Baltag and Giovanni Ciná Institute for Logic, Language and Computation, University of Amsterdam March 21, 2016 Abstract We give a general definition of

More information

arxiv: v1 [cs.lo] 1 Oct 2018

arxiv: v1 [cs.lo] 1 Oct 2018 COMPARING TYPE SYSTEMS FOR DEADLOCK-FREEDOM ORNELA DARDHA AND JORGE A. PÉREZ arxiv:1810.00635v1 [cs.lo] 1 Oct 2018 School of Computing Science, University of Glasgow, UK e-mail address: ornela.dardha@glasgow.ac.uk

More information

Safety Analysis versus Type Inference

Safety Analysis versus Type Inference Information and Computation, 118(1):128 141, 1995. Safety Analysis versus Type Inference Jens Palsberg palsberg@daimi.aau.dk Michael I. Schwartzbach mis@daimi.aau.dk Computer Science Department, Aarhus

More information

Programming Languages and Types

Programming Languages and Types Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Where we re going Type Systems... Type systems are one of the most fascinating and powerful aspects of programming

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

More information

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures CS 6110 S18 Lecture 21 Products, Sums, and Other Datatypes 1 Introduction In this lecture, we add constructs to the typed λ-calculus that allow working with more complicated data structures, such as pairs,

More information

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181. Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität

More information

Chapter 5: Linear Temporal Logic

Chapter 5: Linear Temporal Logic Chapter 5: Linear Temporal Logic Prof. Ali Movaghar Verification of Reactive Systems Spring 94 Outline We introduce linear temporal logic (LTL), a logical formalism that is suited for specifying LT properties.

More information

First-Order Logic. Chapter Overview Syntax

First-Order Logic. Chapter Overview Syntax Chapter 10 First-Order Logic 10.1 Overview First-Order Logic is the calculus one usually has in mind when using the word logic. It is expressive enough for all of mathematics, except for those concepts

More information

A Generic Type System for the Pi-Calculus

A Generic Type System for the Pi-Calculus A Generic Type System for the Pi-Calculus Atsushi Igarashi Kyoto University email:igarashi@kuis.kyoto-u.ac.jp Naoki Kobayashi Tokyo Institute of Technology email:kobayasi@cs.titech.ac.jp April 20, 2009

More information

Denotational Semantics

Denotational Semantics 5 Denotational Semantics In the operational approach, we were interested in how a program is executed. This is contrary to the denotational approach, where we are merely interested in the effect of executing

More information

3.2 Reduction 29. Truth. The constructor just forms the unit element,. Since there is no destructor, there is no reduction rule.

3.2 Reduction 29. Truth. The constructor just forms the unit element,. Since there is no destructor, there is no reduction rule. 32 Reduction 29 32 Reduction In the preceding section, we have introduced the assignment of proof terms to natural deductions If proofs are programs then we need to explain how proofs are to be executed,

More information

Subtyping for Session Types in the Pi Calculus

Subtyping for Session Types in the Pi Calculus Acta Informatica manuscript No. (will be inserted by the editor) Subtyping for Session Types in the Pi Calculus Simon Gay 1, Malcolm Hole 2 1 Department of Computing Science, University of Glasgow, UK

More information

Induction; Operational Semantics. Fall Software Foundations CIS 500

Induction; Operational Semantics. Fall Software Foundations CIS 500 CIS 500 Software Foundations Fall 2005 Induction; Operational Semantics CIS 500, Induction; Operational Semantics 1 Announcements Review recitations start this week. You may go to any recitation section

More information

Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3.

Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3. Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3. Elena Machkasova Contents 1 Introduction and Related Work 1 1.1 Introduction..............................

More information

3 Propositional Logic

3 Propositional Logic 3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists

More information

Self-Adaptation and Information Flow in Multiparty Communications

Self-Adaptation and Information Flow in Multiparty Communications Self-Adaptation and Information Flow in Multiparty Communications Joint work with Ilaria Castellani (INRIA, FR) Jorge A. Pérez (University of Groningen, NL) ABCD meeting London, 20th April, 2015 1 / 36

More information

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic The Importance of Being Formal Martin Henz February 5, 2014 Propositional Logic 1 Motivation In traditional logic, terms represent sets, and therefore, propositions are limited to stating facts on sets

More information

Applied Logic for Computer Scientists. Answers to Some Exercises

Applied Logic for Computer Scientists. Answers to Some Exercises Applied Logic for Computer Scientists Computational Deduction and Formal Proofs Springer, 2017 doi: http://link.springer.com/book/10.1007%2f978-3-319-51653-0 Answers to Some Exercises Mauricio Ayala-Rincón

More information

Erasable Contracts. Abstract. 1. Introduction. Harvard University {jchinlee,

Erasable Contracts. Abstract. 1. Introduction. Harvard University {jchinlee, Erasable Contracts Jao-ke Chin-Lee Louis Li Harvard University {jchinlee, louisli}@college.harvard.edu Abstract Contract programming is a design approach that allows programmers to design formal specifications

More information

Communication Errors in the π-calculus are Undecidable

Communication Errors in the π-calculus are Undecidable Communication Errors in the π-calculus are Undecidable Vasco T. Vasconcelos Department of Informatics Faculty of Sciences, University of Lisbon António Ravara Department of Mathematics Lisbon Institute

More information

Review of The π-calculus: A Theory of Mobile Processes

Review of The π-calculus: A Theory of Mobile Processes Review of The π-calculus: A Theory of Mobile Processes Riccardo Pucella Department of Computer Science Cornell University July 8, 2001 Introduction With the rise of computer networks in the past decades,

More information

Consequence Relations and Natural Deduction

Consequence Relations and Natural Deduction Consequence Relations and Natural Deduction Joshua D Guttman Worcester Polytechnic Institute September 16, 2010 Contents 1 Consequence Relations 1 2 A Derivation System for Natural Deduction 3 3 Derivations

More information

Precise Relational Invariants Through Strategy Iteration

Precise Relational Invariants Through Strategy Iteration Precise Relational Invariants Through Strategy Iteration Thomas Gawlitza and Helmut Seidl TU München, Institut für Informatik, I2 85748 München, Germany {gawlitza, seidl}@in.tum.de Abstract. We present

More information

Lecture Notes on Certifying Theorem Provers

Lecture Notes on Certifying Theorem Provers Lecture Notes on Certifying Theorem Provers 15-317: Constructive Logic Frank Pfenning Lecture 13 October 17, 2017 1 Introduction How do we trust a theorem prover or decision procedure for a logic? Ideally,

More information

The L Machines are very high-level, in two senses:

The L Machines are very high-level, in two senses: What is a Computer? State of the machine. CMPSCI 630: Programming Languages An Abstract Machine for Control Spring 2009 (with thanks to Robert Harper) Internal registers, memory, etc. Initial and final

More information

First-order resolution for CTL

First-order resolution for CTL First-order resolution for Lan Zhang, Ullrich Hustadt and Clare Dixon Department of Computer Science, University of Liverpool Liverpool, L69 3BX, UK {Lan.Zhang, U.Hustadt, CLDixon}@liverpool.ac.uk Abstract

More information

CS411 Notes 3 Induction and Recursion

CS411 Notes 3 Induction and Recursion CS411 Notes 3 Induction and Recursion A. Demers 5 Feb 2001 These notes present inductive techniques for defining sets and subsets, for defining functions over sets, and for proving that a property holds

More information

Simply Typed Lambda Calculus

Simply Typed Lambda Calculus Simply Typed Lambda Calculus Language (ver1) Lambda calculus with boolean values t ::= x variable x : T.t abstraction tt application true false boolean values if ttt conditional expression Values v ::=

More information

Modal and temporal logic

Modal and temporal logic Modal and temporal logic N. Bezhanishvili I. Hodkinson C. Kupke Imperial College London 1 / 83 Overview Part II 1 Soundness and completeness. Canonical models. 3 lectures. 2 Finite model property. Filtrations.

More information

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either Introduction to Temporal Logic The purpose of temporal logics is to specify properties of dynamic systems. These can be either Desired properites. Often liveness properties like In every infinite run action

More information

Lecture Notes: Axiomatic Semantics and Hoare-style Verification

Lecture Notes: Axiomatic Semantics and Hoare-style Verification Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has

More information

Dynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007

Dynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007 Dynamic Noninterference Analysis Using Context Sensitive Static Analyses Gurvan Le Guernic July 14, 2007 1 Abstract This report proposes a dynamic noninterference analysis for sequential programs. This

More information

Chapter 4: Computation tree logic

Chapter 4: Computation tree logic INFOF412 Formal verification of computer systems Chapter 4: Computation tree logic Mickael Randour Formal Methods and Verification group Computer Science Department, ULB March 2017 1 CTL: a specification

More information

Classical Propositional Logic

Classical Propositional Logic The Language of A Henkin-style Proof for Natural Deduction January 16, 2013 The Language of A Henkin-style Proof for Natural Deduction Logic Logic is the science of inference. Given a body of information,

More information

Notes from Yesterday s Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons.

Notes from Yesterday s  Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons. CIS 500 Software Foundations Fall 2006 Notes from Yesterday s Email Discussion November 1 Some lessons This is generally a crunch-time in the semester Slow down a little and give people a chance to catch

More information

Type Soundness for Path Polymorphism

Type Soundness for Path Polymorphism Type Soundness for Path Polymorphism Andrés Ezequiel Viso 1,2 joint work with Eduardo Bonelli 1,3 and Mauricio Ayala-Rincón 4 1 CONICET, Argentina 2 Departamento de Computación, FCEyN, UBA, Argentina 3

More information

Business Process Management

Business Process Management Business Process Management Theory: The Pi-Calculus Frank Puhlmann Business Process Technology Group Hasso Plattner Institut Potsdam, Germany 1 What happens here? We discuss the application of a general

More information

A Thread Algebra with Multi-level Strategic Interleaving

A Thread Algebra with Multi-level Strategic Interleaving Theory of Computing Systems manuscript No. (will be inserted by the editor) A Thread Algebra with Multi-level Strategic Interleaving J.A. Bergstra 1,2, C.A. Middelburg 3,1 1 Programming Research Group,

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

More information

Towards a Practical Secure Concurrent Language

Towards a Practical Secure Concurrent Language Towards a Practical Secure Concurrent Language Stefan Muller and Stephen Chong TR-05-12 Computer Science Group Harvard University Cambridge, Massachusetts Towards a Practical Secure Concurrent Language

More information

Information Systems Business Process Modelling I: Models

Information Systems Business Process Modelling I: Models Information Systems 2 Information Systems 2 5. Business Process Modelling I: Models Lars Schmidt-Thieme Information Systems and Machine Learning Lab (ISMLL) Institute for Business Economics and Information

More information

Proving Completeness for Nested Sequent Calculi 1

Proving Completeness for Nested Sequent Calculi 1 Proving Completeness for Nested Sequent Calculi 1 Melvin Fitting abstract. Proving the completeness of classical propositional logic by using maximal consistent sets is perhaps the most common method there

More information

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

Axiomatic Semantics. Lecture 9 CS 565 2/12/08 Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics

More information

September 14. Fall Software Foundations CIS 500

September 14. Fall Software Foundations CIS 500 CIS 500 Software Foundations Fall 2005 September 14 CIS 500, September 14 1 Announcements I will be away September 19-October 5. I will be reachable by email. Fastest response cis500@cis.upenn.edu No office

More information

Notes. Corneliu Popeea. May 3, 2013

Notes. Corneliu Popeea. May 3, 2013 Notes Corneliu Popeea May 3, 2013 1 Propositional logic Syntax We rely on a set of atomic propositions, AP, containing atoms like p, q. A propositional logic formula φ Formula is then defined by the following

More information

Lecture 26. Daniel Apon

Lecture 26. Daniel Apon Lecture 26 Daniel Apon 1 From IPPSPACE to NPPCP(log, 1): NEXP has multi-prover interactive protocols If you ve read the notes on the history of the PCP theorem referenced in Lecture 19 [3], you will already

More information

Typed Arithmetic Expressions

Typed Arithmetic Expressions Typed Arithmetic Expressions CS 550 Programming Languages Jeremy Johnson TAPL Chapters 3 and 5 1 Types and Safety Evaluation rules provide operational semantics for programming languages. The rules provide

More information

Preliminaries. Introduction to EF-games. Inexpressivity results for first-order logic. Normal forms for first-order logic

Preliminaries. Introduction to EF-games. Inexpressivity results for first-order logic. Normal forms for first-order logic Introduction to EF-games Inexpressivity results for first-order logic Normal forms for first-order logic Algorithms and complexity for specific classes of structures General complexity bounds Preliminaries

More information

On Two Class-Constrained Versions of the Multiple Knapsack Problem

On Two Class-Constrained Versions of the Multiple Knapsack Problem On Two Class-Constrained Versions of the Multiple Knapsack Problem Hadas Shachnai Tami Tamir Department of Computer Science The Technion, Haifa 32000, Israel Abstract We study two variants of the classic

More information

Implementing Proof Systems for the Intuitionistic Propositional Logic

Implementing Proof Systems for the Intuitionistic Propositional Logic Implementing Proof Systems for the Intuitionistic Propositional Logic Veronica Zammit Supervisor: Dr. Adrian Francalanza Faculty of ICT University of Malta May 27, 2011 Submitted in partial fulfillment

More information

An Introduction to Logical Relations Proving Program Properties Using Logical Relations

An Introduction to Logical Relations Proving Program Properties Using Logical Relations An Introduction to Logical Relations Proving Program Properties Using Logical Relations Lau Skorstengaard lask@cs.au.dk July 27, 2018 Contents 1 Introduction 2 1.1 Simply Typed Lambda Calculus....................

More information

Denotational semantics

Denotational semantics Denotational semantics The method define syntax (syntactic domains) define semantic domains define semantic functions use compositional definitions Andrzej Tarlecki: Semantics & Verification - 63 - Syntactic

More information

A Theory for Composing Distributed Components, Based on Temporary Interference

A Theory for Composing Distributed Components, Based on Temporary Interference A Theory for Composing Distributed Components, Based on Temporary Interference I.S.W.B. Prasetya T.E.J. Vos S.D. Swierstra B. Widjaja Abstract Compositionality provides the foundation of software modularity,

More information

Introduction to Logic in Computer Science: Autumn 2006

Introduction to Logic in Computer Science: Autumn 2006 Introduction to Logic in Computer Science: Autumn 2006 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Plan for Today Today s class will be an introduction

More information

A Tutorial Introduction to CSP in Unifying Theories of Programming

A Tutorial Introduction to CSP in Unifying Theories of Programming A Tutorial Introduction to CSP in Unifying Theories of Programming Ana Cavalcanti and Jim Woodcock Department of Computer Science University of York Heslington, York YO10 5DD, UK {Ana.Cavalcanti,Jim.Woodcock}@cs.york.ac.uk

More information

Lecture Notes on Subject Reduction and Normal Forms

Lecture Notes on Subject Reduction and Normal Forms Lecture Notes on Subject Reduction and Normal Forms 15-814: Types and Programming Languages Frank Pfenning Lecture 4 September 13, 2018 1 Introduction In the last lecture we proved some key aspect of a

More information

An Operational Semantics for the Dataflow Algebra. A. J. Cowling

An Operational Semantics for the Dataflow Algebra. A. J. Cowling Verification and Testing Research Group, Department of Computer Science, University of Sheffield, Regent Court, 211, Portobello Street, Sheffield, S1 4DP, United Kingdom Email: A.Cowling @ dcs.shef.ac.uk

More information

Decentralized Control of Discrete Event Systems with Bounded or Unbounded Delay Communication

Decentralized Control of Discrete Event Systems with Bounded or Unbounded Delay Communication Decentralized Control of Discrete Event Systems with Bounded or Unbounded Delay Communication Stavros Tripakis Abstract We introduce problems of decentralized control with communication, where we explicitly

More information

Truth-Functional Logic

Truth-Functional Logic Truth-Functional Logic Syntax Every atomic sentence (A, B, C, ) is a sentence and are sentences With ϕ a sentence, the negation ϕ is a sentence With ϕ and ψ sentences, the conjunction ϕ ψ is a sentence

More information

The Assignment Axiom (Hoare)

The Assignment Axiom (Hoare) The Assignment Axiom (Hoare) Syntax: V := E Semantics: value of V in final state is value of E in initial state Example: X:=X+ (adds one to the value of the variable X) The Assignment Axiom {Q[E/V ]} V

More information

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza Automata theory An algorithmic approach Lecture Notes Javier Esparza July 2 22 2 Chapter 9 Automata and Logic A regular expression can be seen as a set of instructions ( a recipe ) for generating the words

More information

Tree sets. Reinhard Diestel

Tree sets. Reinhard Diestel 1 Tree sets Reinhard Diestel Abstract We study an abstract notion of tree structure which generalizes treedecompositions of graphs and matroids. Unlike tree-decompositions, which are too closely linked

More information

Chapter 2. Assertions. An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011

Chapter 2. Assertions. An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011 Chapter 2 An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011 Assertions In this chapter, we give a more detailed exposition of the assertions of separation logic: their meaning,

More information

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations Page 1 Definitions Tuesday, May 8, 2018 12:23 AM Notations " " means "equals, by definition" the set of all real numbers the set of integers Denote a function from a set to a set by Denote the image of

More information

Canonical Calculi: Invertibility, Axiom expansion and (Non)-determinism

Canonical Calculi: Invertibility, Axiom expansion and (Non)-determinism Canonical Calculi: Invertibility, Axiom expansion and (Non)-determinism A. Avron 1, A. Ciabattoni 2, and A. Zamansky 1 1 Tel-Aviv University 2 Vienna University of Technology Abstract. We apply the semantic

More information

Tableau-based decision procedures for the logics of subinterval structures over dense orderings

Tableau-based decision procedures for the logics of subinterval structures over dense orderings Tableau-based decision procedures for the logics of subinterval structures over dense orderings Davide Bresolin 1, Valentin Goranko 2, Angelo Montanari 3, and Pietro Sala 3 1 Department of Computer Science,

More information

Propositional and Predicate Logic - V

Propositional and Predicate Logic - V Propositional and Predicate Logic - V Petr Gregor KTIML MFF UK WS 2016/2017 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - V WS 2016/2017 1 / 21 Formal proof systems Hilbert s calculus

More information

High-Level Small-Step Operational Semantics for Transactions (Technical Companion)

High-Level Small-Step Operational Semantics for Transactions (Technical Companion) High-Level Small-Step Operational Semantics for Transactions (Technical Companion) Katherine F. Moore, Dan Grossman July 15, 2007 Abstract This document is the technical companion to our POPL 08 submission

More information

HOW DO ULTRAFILTERS ACT ON THEORIES? THE CUT SPECTRUM AND TREETOPS

HOW DO ULTRAFILTERS ACT ON THEORIES? THE CUT SPECTRUM AND TREETOPS HOW DO ULTRAFILTERS ACT ON THEORIES? THE CUT SPECTRUM AND TREETOPS DIEGO ANDRES BEJARANO RAYO Abstract. We expand on and further explain the work by Malliaris and Shelah on the cofinality spectrum by doing

More information

The efficiency of identifying timed automata and the power of clocks

The efficiency of identifying timed automata and the power of clocks The efficiency of identifying timed automata and the power of clocks Sicco Verwer a,b,1,, Mathijs de Weerdt b, Cees Witteveen b a Eindhoven University of Technology, Department of Mathematics and Computer

More information

Lecture Notes on Classical Linear Logic

Lecture Notes on Classical Linear Logic Lecture Notes on Classical Linear Logic 15-816: Linear Logic Frank Pfenning Lecture 25 April 23, 2012 Originally, linear logic was conceived by Girard [Gir87] as a classical system, with one-sided sequents,

More information

Equational Logic. Chapter Syntax Terms and Term Algebras

Equational Logic. Chapter Syntax Terms and Term Algebras Chapter 2 Equational Logic 2.1 Syntax 2.1.1 Terms and Term Algebras The natural logic of algebra is equational logic, whose propositions are universally quantified identities between terms built up from

More information

Propositional and Predicate Logic. jean/gbooks/logic.html

Propositional and Predicate Logic.   jean/gbooks/logic.html CMSC 630 February 10, 2009 1 Propositional and Predicate Logic Sources J. Gallier. Logic for Computer Science, John Wiley and Sons, Hoboken NJ, 1986. 2003 revised edition available on line at http://www.cis.upenn.edu/

More information

Equations, contractions, and unique solutions

Equations, contractions, and unique solutions Equations, contractions, and unique solutions Davide Sangiorgi To cite this version: Davide Sangiorgi. Equations, contractions, and unique solutions. POPL 2015 - Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT

More information

Introduction to Metalogic

Introduction to Metalogic Philosophy 135 Spring 2008 Tony Martin Introduction to Metalogic 1 The semantics of sentential logic. The language L of sentential logic. Symbols of L: Remarks: (i) sentence letters p 0, p 1, p 2,... (ii)

More information

Element x is R-minimal in X if y X. R(y, x).

Element x is R-minimal in X if y X. R(y, x). CMSC 22100/32100: Programming Languages Final Exam M. Blume December 11, 2008 1. (Well-founded sets and induction principles) (a) State the mathematical induction principle and justify it informally. 1

More information

TR : Binding Modalities

TR : Binding Modalities City University of New York (CUNY) CUNY Academic Works Computer Science Technical Reports Graduate Center 2012 TR-2012011: Binding Modalities Sergei N. Artemov Tatiana Yavorskaya (Sidon) Follow this and

More information

AN ALTERNATIVE NATURAL DEDUCTION FOR THE INTUITIONISTIC PROPOSITIONAL LOGIC

AN ALTERNATIVE NATURAL DEDUCTION FOR THE INTUITIONISTIC PROPOSITIONAL LOGIC Bulletin of the Section of Logic Volume 45/1 (2016), pp 33 51 http://dxdoiorg/1018778/0138-068045103 Mirjana Ilić 1 AN ALTERNATIVE NATURAL DEDUCTION FOR THE INTUITIONISTIC PROPOSITIONAL LOGIC Abstract

More information

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics Dynamic Semantics Operational Semantics Denotational Semantic Dynamic Semantics Operational Semantics Operational Semantics Describe meaning by executing program on machine Machine can be actual or simulated

More information