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

Size: px
Start display at page:

## Transcription

1 Linearly Used Effects: Monadic and CPS Transformations into the Linear Lambda Calculus Masahito Hasegawa Research Institute for Mathematical Sciences, Kyoto University Abstract We propose a semantic and syntactic framework for modelling linearly used effects, by giving the monadic transforms of the computational lambda calculus (considered as the core calculus of typed call-by-value programming languages) into the linear lambda calculus As an instance Berdine et al s work on linearly used continuations can be put in this general picture As a technical result we show the full completeness of the CPS transform into the linear lambda calculus 1 Introduction 11 Background: Linearly Used Effects Many higher-order applicative programming languages like ML and Scheme enjoy imperative features like states, exceptions and first-class continuations They are powerful ingredients and considered as big advantages in programming practice However, it is also true that unrestricted use of these features (in particular the combination of first-class continuations with other features) can be the source of very complicated ( higher-order spaghetti ) programs In fact, it has been observed that only the styled use of these imperative features is what we actually need in the good or elegant programming practice There can be several points to be considered as stylish, but in this work we shall concentrate on a single (and simple) concept: linearity To be more precise, we consider the linear usage of effects (note that we do not say that the effects themselves should be implemented in a linear manner but they should be used linearly) The leading examples come from the recent work on linearly used continuations by Berdine, O Hearn, Reddy and Thielecke [3] They observe: in the many forms of control, continuations are used linearly This is true for a wide range of effects, including procedure call and return, exceptions, goto statements, and coroutines They then propose linear type systems (based on a version of intuitionistic linear logic [9, 1]) for capturing the linear usage of continuations Note that the linear types are used for typing the target codes of continuation passing style (CPS) transforms, rather than the source (ML or Scheme) programs Several good Z Hu and M Rodríguez-Artalejo (Eds): FLOPS 2002, LNCS 2441, pp , 2002 c Springer-Verlag Berlin Heidelberg 2002

6 172 Masahito Hasegawa Types, Terms and Values σ ::= b σ σ M ::= x λx σ M MM V ::= x λx σ M We may omit the type superscripts of the lambda abstraction for ease of presentation As an abbreviation, we write let x σ be M in N for (λx σ N)M FV(M) denotes the set of free variables in M Typing Γ 1,x: σ, Γ 2 x : σ Γ, x : σ 1 M : σ 2 Γ λx σ1 M : σ 1 σ 2 Γ M : σ 1 σ 2 Γ N : σ 1 Γ MN : σ 2 where Γ is a context, ie a finite list of variables annotated with types, in which a variable occurs at most once We note that any typing judgement has a unique derivation Axioms let x σ be V in M = M[V/x] λx σ V x = V (x FV(V )) let x σ be M in x = M let y σ2 be (let x σ1 be L in M) in N = let x σ1 be L in let y σ2 be M in N (x FV(N)) MN = let f σ1 σ2 be M in let x σ1 be N in fx (M : σ 1 σ 2,N : σ 1 ) We assume usual conditions on variables for avoiding undesirable captures The equality judgement Γ M = N : σ, whereγ M : σ and Γ N : σ, is defined as the congruence relation on well-typed terms of the same type under the same context, generated from these axioms 32 The Linear Lambda Calculus In this formulation of the linear lambda calculus, a typing judgement takes the form Γ ; M : τ in which Γ represents an intuitionistic (or additive) context whereas is a linear (multiplicative) context Types and Terms τ ::= b τ τ!τ M ::= x λx τ M MM!M let!x τ be M in M

7 Linearly Used Effects 173 Typing Γ ; x : τ x : τ Γ 1,x: τ,γ 2 ; x : τ Γ ;, x : τ 1 M : τ 2 Γ ; λx τ1 M : τ 1 τ 2 Γ ; 1 M : τ 1 τ 2 Γ ; 2 N : τ 1 Γ ; 1 2 MN : τ 2 Γ ; M : τ Γ ;!M :!τ Γ ; 1 M :!τ 1 Γ, x : τ 1 ; 2 N : τ 2 Γ ; 1 2 let!x τ1 be M in N : τ 2 where 1 2 is a merge of 1 and 2 [1] Thus, 1 2 represents one of possible merges of 1 and 2 as finite lists We assume that, when we introduce 1 2, there is no variable occurring both in 1 and in 2 Wewrite for the empty context Again we note that any typing judgement has a unique derivation Axioms (λxm)n = M[N/x] λxmx = M let!x be!m in N = N[M/x] let!x be M in!x = M C[let!x be M in N] =let!x be M in C[N] where C[ ] is a linear context (no! binds [ ]); formally it is generated from the following grammar C ::= [ ] λxc CM MC let!x be C in M let!x be M in C The equality judgement Γ ; M = N : τ is defined in the same way as the case of the computational lambda calculus It is convenient to introduce syntax sugars for intuitionistic or non-linear function type τ 1 τ 2!τ 1 τ 2 λx τ M λy!τ let!x τ be y in M M τ1 N τ1 M (!N) which enjoy the following typing derivations Γ, x : τ 1 ; M : τ 2 Γ ; M : τ 1 τ 2 Γ ; N : τ 1 Γ ; λx τ1 M : τ 1 τ 2 Γ ; N : τ 2 Asoneexpects,theusualβη-equalities N = M[N/x] x = M (with x not free in M) are easily provable from the axioms above 4Monadic and CPS Transformations 41 Monadic Transformations By a (linearly strong) monad on the linear lambda calculus, we mean a tuple of a type constructor T, type-indexed terms η τ : τ Tτ and ( ) τ 1,τ 2 :(τ 1

8 174 Masahito Hasegawa Tτ 2 ) Tτ 1 Tτ 2 satisfying the monad laws: η τ = λxtτ x : Tτ Tτ f η τ1 = f : τ 1 Tτ 2 (g f) = g f : Tτ 1 Tτ 3 (f : τ 1 Tτ 2, g : τ 2 Tτ 3 ) For a monad T =(T,η,( ) ), the monadic transformation ( ) from the computational lambda calculus to the linear lambda calculus sends a typing judgement Γ M : σ to Γ ; M : T (!σ ), where Γ is defined by = and (Γ, x : σ) = Γ,x: σ b = b (σ 1 σ 2 ) =!σ 1 T (!σ 2 ) = σ 1 T (!σ 2 ) x η (!x) = x (λx σ M) η (!(λa!σ let!x σ be a in M )) = (λx σ M ) (M σ1 σ2 N σ1 ) (λh!(σ1 σ2) let!f (σ1 σ2) be h in f N ) M =(λf (σ1 σ2) f N ) M We shall note that (let x be M in N) =(λxn ) M holds Proposition 2 (type soundness) If Γ M : σ is derivable in the computational lambda calculus, then Γ ; M : T (!σ ) is derivable in the linear lambda calculus Proposition 3 (equational soundness) If Γ M = N : σ holds in the computational lambda calculus, so is Γ ; M = N : T (!σ ) in the linear lambda calculus As an easiest example, one may consider the identity monad (Tτ = τ, η = λxx and f = f) In this case we have (σ 1 σ 2 ) =!σ 1!σ 2 = σ 1!σ 2 and x =!x (λxm) =!(λxm ) (M N) =(λff N ) M (let x be M in N) = let!x be M in N This translation is not equationally complete it validates the commutativity axiom let x be M in let y be N in L = let y be N in let x be M in L (with x, y not free in M,N) which is not provable in the computational lambda calculus Also it is not full, as there is a term f :(σ 1 σ 2 ) ;!(λx σ 1!(let!y σ 2 be x in y)) :!(σ 1 σ 2 ) which does not stay in the image of the translation if σ 2 is a base type (note that!(let!y be M in y) =M does not hold in general, cf Note 36 of [1])

9 Linearly Used Effects 175 Remark 1 The reason of the failure of fullness of this translation can be explained as follows In the source language, we can turn a computation at the function types to a value via the η-expansion but not at the base types On the other hand, in the target language, we can do essentially the same thing at every types of the form!τ (by turning Γ ; M :!τ to Γ ;!(let!y τ be M in y) :!τ) which are strictly more general than the translations of function types This mismatch does create junks which cannot stay in the image of the translation (In terms of monads and their algebras: while the base types of the term model of the (commutative) computational lambda calculus do not have an algebra structure, all objects of the Kleisli category of the term model of DILL are equipped with an algebra structure given by the term x :!τ ; let!y τ be x in y : τ for the monad induced by the monoidal comonad) We conjecture that, if we enrich the commutative computational lambda calculus with the construct val b (M) :b for base type b and M : b, withaxiomslet x b be val b (M) in N = N[val b (M)/x] (ie val b (M) isavalue)andval b (val b (M)) = val b (M), then the translation extendedwith(val b (M)) =!(let!x b be M in x) is fully complete For example, for f : σ b we have (λx σ val b (fx)) =!(λx σ!(let!y b be x in y)) 42 The CPS Transformation By specialising the monadic transformation to that of the continuation monad, we obtain Plotkin s CPS transformation [15] from the computational lambda calculus to the linear lambda calculus Let o be a type of the linear lambda calculus Define a monad (T,η,( ) )by Tτ =(τ o) o η = λxλkk x f = λhλkh (λxf x k) Lemma 3 The data given above specify a monad Now we have the monadic transformation of this monad as follows: b = b (σ 1 σ 2 ) =!σ 1 (!σ 2 o) o = σ 1 (σ 2 o) o x λkk (!x) = x (λx σ M) λkk (!(λa!σ let!x σ be a in M )) = (λx σ M ) (M σ1 σ2 N σ1 ) λkm (λh!(σ1 σ2) let!f (σ1 σ2) be h in N (λa!σ 1 f ak)) = λkm (λf (σ1 σ2) N (λa σ 1 ak)) This is no other than the call-by-value CPS transformation of Plotkin Note that (let x be M in N) = λkm (λxn k) holds (as expected)

10 176 Masahito Hasegawa Proposition 4 (type soundness) If Γ M : σ is derivable in the computational lambda calculus, then Γ ; M :(σ o) o is derivable in the linear lambda calculus Proposition 5 (equational completeness of Sabry and Felleisen [16]) Γ M = N : σ holds in the computational lambda calculus if and only if Γ ; M = N :(σ o) o holds in the linear lambda calculus 5 Full Completeness Following the work by Berdine et al [4], we show that this CPS transformation is in fact fully complete: supposing that o is a base type of the linear lambda calculus but not of the computational lambda calculus, we claim If Γ ; N :(σ o) o is derivable in the linear lambda calculus, then there exists Γ M : σ in the computational lambda calculus such that Γ ; M = N : (σ o) o holds in the linear lambda calculus The proof is done as follows First, we note that the image of the CPS transform involves only the types of the form b, τ 1 τ 2 and τ 1 τ 2, but no!τ in contrast to the case of the identity monad or the state monad By modifying the full completeness proof for the Girard translation in [10] (via a Kripke logical relation), we are able to show that the inhabitants of these types are provably equal to terms constructed from x, λxm, MN, λxm and N Proposition 6 (fullness of Girard translation, extended version) Given Γ ; M : σ in the linear lambda calculus such that types in Γ, and σ are constructed from base types, linear function type and intuitionistic function type, M is provably equal to a term constructed from variables x, linear lambda abstraction λxn, linear application N 1 N 2, intuitionistic lambda abstraction λxn and intuitionistic application N N 2 Then we have only to consider the long βη-normal forms of the types o (answers), σ (values), σ o (continuations) and (σ o) o (programs) (with intuitionistic free variables of σ s, and one linear free variable of σ o in the cases of answers and continuations), and define the inversion function on them, as done in [16, 4] This inversion function ( ) for the long βη-normal forms of the answers, values, continuations and programs are given as follows (see Appendix for the typing) types answers o A ::= V VC values σ V ::= x λxp continuations σ o C ::= k λxa programs (σ o) o P ::= λka V

11 Linearly Used Effects 177 answers V ) = V VC) = C (xv ) values x = x (λxp ) = λxp continuations k = λxx (λxa) = λxa programs (λka) = A V ) = xv Lemma 4 For Γ ; k : θ o A : o we have Γ A : θ For Γ ; V : σ we have Γ V : σ For Γ ; k : θ o C : σ o we have Γ C : σ θ For Γ ; P :(σ o) o we have Γ P : σ Proposition 7 For Γ M : σ in the computational lambda calculus, we have Γ M = M : σ Lemma 5 For Γ ; k : θ o A : o we have Γ ; A = λka :(θ o) o For Γ ; V : σ we have Γ ; V = V :(σ o) o For Γ ; k : θ o C : σ o we have Γ ; C = x) :((σ θ) o) o For Γ ; P :(σ o) o we have Γ ; P = P :(σ o) o Theorem 1 (full completeness of the CPS transform) Given Γ ; N :(σ o) o in the linear lambda calculus, we have Γ M : σ in the computational lambda calculus such that Γ ; N = M :(σ o) o 6 Adding Recursion Following the results in [12], we can enrich our transformations with recursion while keeping the type-soundness and equational soundness valid For interpreting a call-by-value fixpoint operator on function types fix v σ 1 σ 2 :((σ 1 σ 2 ) σ 1 σ 2 ) σ 1 σ 2 it suffices to add a fixpoint operator on types of the form T!τ fix L τ :(T!τ T!τ) T!τ to the linear lambda calculus (fix v σ 1 σ 2 ) = (fix L (σ 1 σ (λgt!(σ1 σ2) g))))))) : T!(((σ 1 σ 2 ) T!(σ 1 σ 2 ) ) T!(σ 1 σ 2 ) ) where α = λg T!(σ1 σ2) λx σ 1 (λf (σ 1 σ 2) x) g : T!(σ 1 σ 2 ) (σ 1 σ 2 )

13 Linearly Used Effects 179 its full completeness we believe that these preliminary results show that our framework is useful in capturing and generalizing the ideas proposed in ibid: linearity on the use of computational effects However, there remain many open issues on this approach Most importantly, we are yet to see if this approach is applicable to many interesting computational effects In particular, in this paper we have considered only the pure computational lambda calculus as the source language An obvious question is how to deal with extensions with several computational effects we have only considered the core part of [3], and it is still open if several computational effects discussed in ibid can be accommodated within our framework More generally, we want to know a general characterization of effects which can be captured by strong monads on linear type theories (this is related to the consideration in Sec 7) There also remain several interesting issues related to the approach given here; we shall conclude this paper by giving remarks on some of them Linear Computational Lambda Calculus Although in this paper we described our transformations as the translations from the computational lambda calculus to the linear lambda calculus, there is an obvious way to factor the transformations through yet another intermediate type theory: the linear computational lambda calculus, whichisthe!-(and -) fragment of intuitionistic linear logic enriched with computational function types (which should not be confused with linear or intuitionistic function types) While the semantics of this new calculus is easily described (as a symmetric monoidal category with a suitable monoidal comonad! and Kleisli exponentials), we do not know if the calculus allows a reasonably simple axiomatization, which would be necessary for using the calculus in practice (eg as a foundation of linearized A-normal forms which could be used for the direct-style reasoning about linearly used effects) Linearly Used Continuations vs Linearly Used Global States If we have chosen a classical linear type theory as the target language, the distinction between continuation-passing style and state-passing style no longer exists: since we have τ τ in classical linear logic (CLL), a linear continuation monad is isomorphic to a linear state monad: (τ o) o o (τ o ) Thus there is no reason to deal with the effects induced by these monads separately, if we take the transformations into CLL as their semantics In fact the usual (non-linear) state monad fits in this scheme, as we have S (τ!s) (τ (!S) ) (!S), so at least we can deal with global states as a special instance of linearly used continuations Is this the case for the transformations into intuitionistic linear logic (as we considered in this paper) too? We are currently studying these issues using a term calculus for CLL proposed in [11] as the target language of the transformations In particular, if a conjecture on the fullness of CLL over ILL stated in ibid is positively solved, it follows that the linear state-passing-style transformation (derived from the linear state monad) is also fully complete, by applying the correspondence between linear continuation monads and linear state monads as noted above

14 180 Masahito Hasegawa Full Abstraction Result of Berger, Honda and Yoshida In a recent work [5], Berger, Honda and Yoshida have shown that the translation from PCF into a linearly typed π-calculus is fully abstract Since the translation ( functions as processes [13]) can be seen a variant of the CPS transform (as emphasized by Thielecke) and the linear typing is used for capturing the linear usage of continuations, it should be possible to identify the common semantic structure behind their work and our approach Lily The Lily project [7] considers the theory of polymorphic linear lambda calculi and their use as appropriate typed intermediate languages for compilers It would be fruitful to combine their ideas and results with ours Acknowledgements I thank Josh Berdine, Peter O Hearn, Uday Reddy, Hayo Thielecke and Hongseok Yang for helpful discussions, and Jacques Garrigue and Susumu Nishimura for comments on an early version Thanks also to anonymous reviewers for helpful comments Part of this work was carried out while the author was visiting Laboratory for Foundations of Computer Science, University of Edinburgh References [1] Barber, A and Plotkin, G (1997) Dual intuitionistic linear logic Submitted An earlier version available as Technical Report ECS-LFCS , LFCS, University of Edinburgh 167, 171, 173, 174 [2] Benton, N and Wadler, P (1996) Linear logic, monads, and the lambda calculus In Proc 11th Annual Symposium on Logic in Computer Science, pp , 170 [3] Berdine, J, O Hearn, P W, Reddy, U S and Thielecke, H (2001) Linearly used continuations In Proc ACM SIGPLAN Workshop on Continuations (CW 01), Technical Report No 545, Computer Science Department, Indiana University 167, 171, 178, 179 [4] Berdine, J, O Hearn, P W and Thielecke, H (2000) On affine typing and completeness of CPS Manuscript 169, 171, 176 [5] Berger, M, Honda, K and Yoshida, N (2001) Sequentiality for the π-calculus In Proc Typed Lambda Calculi and Applications (TLCA 2001), Springer Lecture Notes in Computer Science 2044, pp [6] Bierman, G M (1995) What is a categorical model of intuitionistic linear logic? In Proc Typed Lambda Calculi and Applications (TLCA 95), Springer Lecture Notes in Computer Science 902, pp [7] Bierman, G M, Pitts, A M and Russo, C V (2000) Operational properties of Lily, a polymorphic linear lambda calculus with recursion In Proc Higher Order Operational Techniques in Semantics (HOOTS 2000), Electronic Notes in Theoretical Computer Science [8] Blute, R, Cockett, J R B and Seely, R A G (1996)! and? - Storage as tensorial strength Math Structures Comput Sci 6(4), [9] Girard, J-Y (1987) Linear logic Theoret Comp Sci 50,

15 Linearly Used Effects 181 [10] Hasegawa, M (2000) Girard translation and logical predicates J Functional Programming 10(1), [11] Hasegawa, M (2002) Classical linear logic of implications In Proc Computer Science Logic (CSL 02), Springer Lecture Notes in Computer Science 179 [12] Hasegawa, M and Kakutani, Y (2001) Axioms for recursion in call-by-value (extended abstract) In Proc Foundations of Software Science and Computation Structures (FoSSaCS 2001), Springer Lecture Notes in Computer Science 2030, pp , 178 [13] Milner, R (1992) Functions as processes Math Structures Compt Sci 2(2), [14] Moggi, E (1989) Computational lambda-calculus and monads In Proc 4th Annual Symposium on Logic in Computer Science, pp 14 23; a different version available as Technical Report ECS-LFCS-88-86, University of Edinburgh, , 169, 171 [15] Plotkin, G D (1975) Call-by-name, call-by-value, and the λ-calculus Theoret Comput Sci 1(1), , 175 [16] Sabry, A and Felleisen, M (1992) Reasoning about programs in continuationpassing style In Proc ACM Conference on Lisp and Functional Programming, pp ; extended version in Lisp and Symbolic Comput 6(3/4), , , 171, 176 [17] Simpson, A K and Plotkin, G D (2000) Complete axioms for categorical fixedpoint operators In Proc 15th Annual Symposium on Logic in Computer Science (LICS 2000), pp

16 182 Masahito Hasegawa A The Inversion Function Answers : Γ ; k : θ o A : o = Γ A : θ Γ ; k : θ o k : θ o Γ ; V : θ Γ ; k : θ o V : o Γ ; P :(σ2 o) o Γ ; k : θ o C : σ2 o Γ ; k : θ o PC: o Γ V : θ Γ C : σ 2 θ Γ P : σ 2 Γ C P : θ where Γ = Γ 1,x: σ 1 σ 2,Γ 2 and P = V with Γ ; V : σ 1 (see the last case of Programs) Values : Γ ; V : σ = Γ V : σ Γ 1,x: σ,γ 2 ; x : σ Γ 1,x: σ, Γ 2 x : σ Γ,x: σ1 ; P :(σ2 o) o Γ ; λx σ 1 P :(σ 1 σ 2) Γ, x : σ 1 P : σ 2 Γ λx σ 1 P : σ 1 σ 2 Continuations : Γ ; k : θ o C : σ o = Γ C : σ θ Γ ; k : θ o k : θ o Γ,x: σ ; k : θ o A : o Γ ; k : θ o λx σ A : σ o Γ, x : θ x : θ Γ λx θ x : θ θ Γ, x : σ A : θ Γ λx σ A : σ θ Programs : Γ ; P :(σ o) o = Γ P : σ Γ ; k : θ o A : o Γ ; λk θ o A :(θ o) o Γ ; x :(σ 1 σ 2) Γ ; V : σ1 Γ ; V :(σ2 o) o where Γ = Γ 1,x: σ 1 σ 2,Γ 2 Γ A : θ Γ x : σ 1 σ 2 Γ V : σ 1 Γ xv : σ 2

### 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

### 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

### 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

### Direct models of the computational lambda-calculus

Electronic Notes in Theoretical Computer Science 20 (1999) URL: http://www.elsevier.nl/locate/entcs/volume20.html 49 pages Direct models of the computational lambda-calculus Carsten Führmann 1 Division

Computational lambda-calculus and monads Eugenio Moggi Lab. for Found. of Comp. Sci. University of Edinburgh EH9 3JZ Edinburgh, UK On leave from Univ. di Pisa Abstract The λ-calculus is considered an useful

### 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

### 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

### Basic Category Theory for Models of Syntax (Preliminary Version)

Basic Category Theory for Models of Syntax (Preliminary Version) R. L. Crole ( ) Department of Mathematics and Computer Science, University of Leicester, Leicester, LE1 7RH, U.K. Abstract. These notes

### Extraction of certified programs with effects from proofs with monadic types in Coq

Extraction of certified programs with effects from proofs with monadic types in Coq Marino Miculan 1 and Marco Paviotti 2 1 Dept. of Mathematics and Computer Science, University of Udine, Italy 2 IT University

### 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)

### Complete Axioms for Categorical Fixed-point Operators

Complete Axioms for Categorical Fixed-point Operators Alex Simpson and Gordon Plotin LFCS, Division of Informatics, University of Edinburgh, JCMB, King s Buildings, Edinburgh, EH9 3JZ {als,gdp}@dcs.ed.ac.u

### 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

### 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

### Andrew Pitts chapter for D. Sangorgi and J. Rutten (eds), Advanced Topics in Bisimulation and Coinduction, Cambridge Tracts in Theoretical Computer

Andrew Pitts chapter for D. Sangorgi and J. Rutten (eds), Advanced Topics in Bisimulation and Coinduction, Cambridge Tracts in Theoretical Computer Science No. 52, chapter 5, pages 197 232 ( c 2011 CUP)

### CHAPTER 5: MODULAR ARITHMETIC

CHAPTER 5: MODULAR ARITHMETIC LECTURE NOTES FOR MATH 378 (CSUSM, SPRING 2009). WAYNE AITKEN 1. Introduction In this chapter we will consider congruence modulo m, and explore the associated arithmetic called

### 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

### 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

### 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

### 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

### Mathematics Course 111: Algebra I Part IV: Vector Spaces

Mathematics Course 111: Algebra I Part IV: Vector Spaces D. R. Wilkins Academic Year 1996-7 9 Vector Spaces A vector space over some field K is an algebraic structure consisting of a set V on which are

### Seminal Research Articles in Programming Languages

Seminal Research Articles in Programming Languages Abstract The research articles listed here cover the period 1963 to the present. They are all important articles, and they are relevant to this offering

### 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,

### 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.

### 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

### 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

### 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

### There is no degree invariant half-jump

There is no degree invariant half-jump Rod Downey Mathematics Department Victoria University of Wellington P O Box 600 Wellington New Zealand Richard A. Shore Mathematics Department Cornell University

### [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

### MAP-I Programa Doutoral em Informática. Rigorous Software Development

MAP-I Programa Doutoral em Informática Rigorous Software Development Unidade Curricular em Teoria e Fundamentos Theory and Foundations (UCTF) DI-UM, DCC-FCUP May, 2012 Abstract This text presents a UCTF

### SOME SUPER-INTUITIONISTIC LOGICS AS THE LOGICAL FRAGMENTS OF EQUATIONAL THEORIES 1

Tatsuya Shimura Nobu-Yuki Suzuki SOME SUPER-INTUITIONISTIC LOGICS AS THE LOGICAL FRAGMENTS OF EQUATIONAL THEORIES 1 Kripke frame semantics is used as a concise and convenient apparatus for the study of

### Proof. The map. G n i. where d is the degree of D.

7. Divisors Definition 7.1. We say that a scheme X is regular in codimension one if every local ring of dimension one is regular, that is, the quotient m/m 2 is one dimensional, where m is the unique maximal

Computing and Informatics, Vol. 20, 2001,????, V 2006-Nov-6 UPDATES OF LOGIC PROGRAMS Ján Šefránek Department of Applied Informatics, Faculty of Mathematics, Physics and Informatics, Comenius University,

### Left-Handed Completeness

Left-Handed Completeness Dexter Kozen Computer Science Department Cornell University RAMiCS, September 19, 2012 Joint work with Alexandra Silva Radboud University Nijmegen and CWI Amsterdam Result A new

### 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

### Models for Quantitative Distributed Systems and Multi-Valued Logics

Universität Leipzig Institut für Informatik Models for Quantitative Distributed Systems and Multi-Valued Logics Master Thesis Leipzig, September 2010 Author Supervisor B.Sc. Martin Huschenbett Master Student

### Truth as Modality. Amsterdam Workshop on Truth 13 March 2013 truth be told again. Theodora Achourioti. ILLC University of Amsterdam

Truth as Modality Amsterdam Workshop on Truth 13 March 2013 truth be told again Theodora Achourioti ILLC University of Amsterdam Philosophical preliminaries i The philosophical idea: There is more to truth

### Equality and dependent type theory. Oberwolfach, March 2 (with some later corrections)

Oberwolfach, March 2 (with some later corrections) The Axiom of Univalence, a type-theoretic view point In type theory, we reduce proof-checking to type-checking Hence we want type-checking to be decidable

### 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.

### Bi-approximation Semantics for Substructural Logic at Work

Bi-approximation Semantics for Substructural Logic at Work Tomoyuki Suzuki Department of Computer Science, University of Leicester Leicester, LE1 7RH, United Kingdom tomoyuki.suzuki@mcs.le.ac.uk Abstract

### in quantum computation

in computation Kestrel Institute and Oxford University - Oxford, August 2008 Outline Quantum programming λ- Abstraction with pictures Consequences - Abstraction in Category of measurements - Outline Quantum

### 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

### Type and Effect Systems

Type and Effect Systems Flemming Nielson & Hanne Riis Nielson Department of Computer Science, Aarhus University, Denmark. Abstract. The design and implementation of a correct system can benefit from employing

### Categorical Monads and Computer Programming

London Mathematical Society Impact150 Stories 1 (2015) 9 14 C 2015 Author(s) doi:10.1112/i150lms/t.0002 Categorical Monads and Computer Programming Nick Benton Abstract The categorical notion of monad

### 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

### 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?

### Biinterpretability up to double jump in the degrees

Biinterpretability up to double jump in the degrees below 0 0 Richard A. Shore Department of Mathematics Cornell University Ithaca NY 14853 July 29, 2013 Abstract We prove that, for every z 0 0 with z

### A NOTE ON TRIVIAL FIBRATIONS

A NOTE ON TRIVIAL FIBRATIONS Petar Pavešić Fakulteta za Matematiko in Fiziko, Univerza v Ljubljani, Jadranska 19, 1111 Ljubljana, Slovenija petar.pavesic@fmf.uni-lj.si Abstract We study the conditions

### A Brief Overview of Agda A Functional Language with Dependent Types

A Brief Overview of Agda A Functional Language with Dependent Types Ana Bove, Peter Dybjer, and Ulf Norell e-mail: {bove,peterd,ulfn}@chalmers.se Chalmers University of Technology, Gothenburg, Sweden Abstract.

### 15.062 Data Mining: Algorithms and Applications Matrix Math Review

.6 Data Mining: Algorithms and Applications Matrix Math Review The purpose of this document is to give a brief review of selected linear algebra concepts that will be useful for the course and to develop

### FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z DANIEL BIRMAJER, JUAN B GIL, AND MICHAEL WEINER Abstract We consider polynomials with integer coefficients and discuss their factorization

### From Sets to Types to Categories to Sets

From Sets to Types to Categories to Sets Steve Awodey Three different styles of foundations of mathematics are now commonplace: set theory, type theory, and category theory. How do they relate, and how

### An Equivalence-Preserving CPS Translation via Multi-Language Semantics (Technical Appendix)

An Equivalence-Preserving CPS Translation via Multi-Language Semantics (Technical Appendix) Amal Ahmed Indiana University amal@cs.indiana.edu Matthias Blume Google blume@google.com This appendix contains

### MATHEMATICS EDUCATION FOR SOFTWARE ENGINEERS: IT SHOULD BE RADICALLY DIFFERENT!

MATHEMATICS EDUCATION FOR SOFTWARE ENGINEERS: IT SHOULD BE RADICALLY DIFFERENT! Franz LICHTENBERGER Research Institute for Sybolic Computation (Risc-Linz) Johannes Kepler University and Department of Software

### A first step towards modeling semistructured data in hybrid multimodal logic

A first step towards modeling semistructured data in hybrid multimodal logic Nicole Bidoit * Serenella Cerrito ** Virginie Thion * * LRI UMR CNRS 8623, Université Paris 11, Centre d Orsay. ** LaMI UMR

### Sets and functions. {x R : x > 0}.

Sets and functions 1 Sets The language of sets and functions pervades mathematics, and most of the important operations in mathematics turn out to be functions or to be expressible in terms of functions.

### 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

### A Subatomic Proof System

A Subatomic Proof System Andrea Aler Tubella Alessio Guglielmi University of Bath In this work we show a proof system, called SA, that generates propositional proofs by employing a single, linear, simple

### Generic Polynomials of Degree Three

Generic Polynomials of Degree Three Benjamin C. Wallace April 2012 1 Introduction In the nineteenth century, the mathematician Évariste Galois discovered an elegant solution to the fundamental problem

### ON GALOIS REALIZATIONS OF THE 2-COVERABLE SYMMETRIC AND ALTERNATING GROUPS

ON GALOIS REALIZATIONS OF THE 2-COVERABLE SYMMETRIC AND ALTERNATING GROUPS DANIEL RABAYEV AND JACK SONN Abstract. Let f(x) be a monic polynomial in Z[x] with no rational roots but with roots in Q p for

### Sign changes of Hecke eigenvalues of Siegel cusp forms of degree 2

Sign changes of Hecke eigenvalues of Siegel cusp forms of degree 2 Ameya Pitale, Ralf Schmidt 2 Abstract Let µ(n), n > 0, be the sequence of Hecke eigenvalues of a cuspidal Siegel eigenform F of degree

### MA651 Topology. Lecture 6. Separation Axioms.

MA651 Topology. Lecture 6. Separation Axioms. This text is based on the following books: Fundamental concepts of topology by Peter O Neil Elements of Mathematics: General Topology by Nicolas Bourbaki Counterexamples

### New Foundations for Fixpoint Computations: FIX-Hyperdoctrines and the FIX-Logic

New Foundations for Fixpoint Computations: FIX-Hyperdoctrines and the FIX-Logic Roy L. Crole Andrew M. Pitts Computer Laboratory, University of Cambridge, Cambridge CB2 3QG, England. Research supported

### The countdown problem

JFP 12 (6): 609 616, November 2002. c 2002 Cambridge University Press DOI: 10.1017/S0956796801004300 Printed in the United Kingdom 609 F U N C T I O N A L P E A R L The countdown problem GRAHAM HUTTON

### FIBER PRODUCTS AND ZARISKI SHEAVES

FIBER PRODUCTS AND ZARISKI SHEAVES BRIAN OSSERMAN 1. Fiber products and Zariski sheaves We recall the definition of a fiber product: Definition 1.1. Let C be a category, and X, Y, Z objects of C. Fix also

### A Generic Process Calculus Approach to Relaxed-Memory Consistency

A Generic Process Calculus Approach to Relaxed-Memory Consistency Palle Raabjerg Tjark Weber Nadine Rohde Lars-Henrik Eriksson Joachim Parrow UPMARC Workshop on Memory Models (MM 15) 23 24 February 2015,

### 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,

### ON FUNCTIONAL SYMBOL-FREE LOGIC PROGRAMS

PROCEEDINGS OF THE YEREVAN STATE UNIVERSITY Physical and Mathematical Sciences 2012 1 p. 43 48 ON FUNCTIONAL SYMBOL-FREE LOGIC PROGRAMS I nf or m at i cs L. A. HAYKAZYAN * Chair of Programming and Information

### ON THE DEGREE OF MAXIMALITY OF DEFINITIONALLY COMPLETE LOGICS

Bulletin of the Section of Logic Volume 15/2 (1986), pp. 72 79 reedition 2005 [original edition, pp. 72 84] Ryszard Ladniak ON THE DEGREE OF MAXIMALITY OF DEFINITIONALLY COMPLETE LOGICS The following definition

### (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 (,,,,

### Linear Continuation-Passing

Linear Continuation-Passing Josh Berdine and Peter O Hearn ( {berdine, ohearn}@dcs.qmul.ac.uk) Department of Computer Science, Queen Mary, University of London, London E1 4NS, United Kingdom Uday Reddy

### BI-Hyperdoctrines, Higher-order Separation Logic, and Abstraction

BI-Hyperdoctrines, Higher-order Separation Logic, and Abstraction BODIL BIERING, LARS BIRKEDAL, and NOAH TORP-SMITH Department of Theoretical Computer Science IT University of Copenhagen We present a precise

### Degree Hypergroupoids Associated with Hypergraphs

Filomat 8:1 (014), 119 19 DOI 10.98/FIL1401119F Published by Faculty of Sciences and Mathematics, University of Niš, Serbia Available at: http://www.pmf.ni.ac.rs/filomat Degree Hypergroupoids Associated

### 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

### NOTES ON CATEGORIES AND FUNCTORS

NOTES ON CATEGORIES AND FUNCTORS These notes collect basic definitions and facts about categories and functors that have been mentioned in the Homological Algebra course. For further reading about category

### IR, 45 (cor), 46 Θ, 48 MT Θ ,47 MT Θ,48 M 0,48. B l (cor)mt Θ,49 M i,49 A, 50, 134. s, 53. MT,53 Q i,53. U i,53 U s,53 φ i : M i Q i,54 P,55 s,55

References 1. G. Ludwig: Die Grundstrukturen einer physikalischen Theorie, 2nd edn (Springer-Verlag, Berlin Heidelberg New York, 1990). French translation by G. Thurler: Les structures de base d une théorie

### 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

### 11 Ideals. 11.1 Revisiting Z

11 Ideals The presentation here is somewhat different than the text. In particular, the sections do not match up. We have seen issues with the failure of unique factorization already, e.g., Z[ 5] = O Q(

### SECRET sharing schemes were introduced by Blakley [5]

206 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 1, JANUARY 2006 Secret Sharing Schemes From Three Classes of Linear Codes Jin Yuan Cunsheng Ding, Senior Member, IEEE Abstract Secret sharing has

### Extending Semantic Resolution via Automated Model Building: applications

Extending Semantic Resolution via Automated Model Building: applications Ricardo Caferra Nicolas Peltier LIFIA-IMAG L1F1A-IMAG 46, Avenue Felix Viallet 46, Avenue Felix Viallei 38031 Grenoble Cedex FRANCE

### We shall turn our attention to solving linear systems of equations. Ax = b

59 Linear Algebra We shall turn our attention to solving linear systems of equations Ax = b where A R m n, x R n, and b R m. We already saw examples of methods that required the solution of a linear system

### Games and Full Abstraction for Java programs

Games and Full Abstraction for Java programs Andrzej Murawski University of Warwick Nikos Tzevelekos Queen Mary Uni. of London PLSeminar 2013 What this talk is about Semantics of programs: Operational

### o-minimality and Uniformity in n 1 Graphs

o-minimality and Uniformity in n 1 Graphs Reid Dale July 10, 2013 Contents 1 Introduction 2 2 Languages and Structures 2 3 Definability and Tame Geometry 4 4 Applications to n 1 Graphs 6 5 Further Directions

### Imprecise probabilities, bets and functional analytic methods in Łukasiewicz logic.

Imprecise probabilities, bets and functional analytic methods in Łukasiewicz logic. Martina Fedel joint work with K.Keimel,F.Montagna,W.Roth Martina Fedel (UNISI) 1 / 32 Goal The goal of this talk is to

### Research Article Stability Analysis for Higher-Order Adjacent Derivative in Parametrized Vector Optimization

Hindawi Publishing Corporation Journal of Inequalities and Applications Volume 2010, Article ID 510838, 15 pages doi:10.1155/2010/510838 Research Article Stability Analysis for Higher-Order Adjacent Derivative

### CMSC 858T: Randomized Algorithms Spring 2003 Handout 8: The Local Lemma

CMSC 858T: Randomized Algorithms Spring 2003 Handout 8: The Local Lemma Please Note: The references at the end are given for extra reading if you are interested in exploring these ideas further. You are

### it is easy to see that α = a

21. Polynomial rings Let us now turn out attention to determining the prime elements of a polynomial ring, where the coefficient ring is a field. We already know that such a polynomial ring is a UF. Therefore

### Views: Compositional Reasoning for Concurrent Programs

Views: Compositional Reasoning for Concurrent Programs Thomas Dinsdale-Young 1, Lars Birkedal 2, Philippa Gardner 1, Matthew J. Parkinson 3, and Hongseok Yang 4 1 Imperial College London 3 Microsoft Research

### The Anatomy of Programming Languages

The Anatomy of Programming Languages Alice E. Fischer University of New Haven Frances S. Grodzinsky Sacred Heart University September 1992 ii Copyright c 1990, 1991, 1992 by Alice E. Fischer and Frances

### 1. R In this and the next section we are going to study the properties of sequences of real numbers.

+a 1. R In this and the next section we are going to study the properties of sequences of real numbers. Definition 1.1. (Sequence) A sequence is a function with domain N. Example 1.2. A sequence of real

### TROPICAL CRYPTOGRAPHY

TROPICAL CRYPTOGRAPHY DIMA GRIGORIEV AND VLADIMIR SHPILRAIN Abstract. We employ tropical algebras as platforms for several cryptographic schemes that would be vulnerable to linear algebra attacks were

### SOME PROPERTIES OF SYMBOL ALGEBRAS OF DEGREE THREE

SOME PROPERTIES OF SYMBOL ALGEBRAS OF DEGREE THREE CRISTINA FLAUT and DIANA SAVIN Communicated by the former editorial board In this paper, we study some properties of the matrix representations of the

### 8.1 Examples, definitions, and basic properties

8 De Rham cohomology Last updated: May 21, 211. 8.1 Examples, definitions, and basic properties A k-form ω Ω k (M) is closed if dω =. It is exact if there is a (k 1)-form σ Ω k 1 (M) such that dσ = ω.

### (What I Know about) the History of the Identity Type

(What I Know about) the History of the Identity Type Peter Dybjer Chalmers University, Göteborg, Sweden Workshop on Identity Types Uppsala, 13 November, 2006 When was the identity type born? Martin-Löf

### CHAPTER 3. Mapping Concepts and Mapping Problems for. Scalar Valued Functions of a Scalar Variable

A SERIES OF CLASS NOTES TO INTRODUCE LINEAR AND NONLINEAR PROBLEMS TO ENGINEERS, SCIENTISTS, AND APPLIED MATHEMATICIANS REMEDIAL CLASS NOTES A COLLECTION OF HANDOUTS FOR REMEDIATION IN FUNDAMENTAL CONCEPTS

### Object-Oriented Software Specification in Programming Language Design and Implementation

Object-Oriented Software Specification in Programming Language Design and Implementation Barrett R. Bryant and Viswanathan Vaidyanathan Department of Computer and Information Sciences University of Alabama

### ON GENERALIZED RELATIVE COMMUTATIVITY DEGREE OF A FINITE GROUP. A. K. Das and R. K. Nath

International Electronic Journal of Algebra Volume 7 (2010) 140-151 ON GENERALIZED RELATIVE COMMUTATIVITY DEGREE OF A FINITE GROUP A. K. Das and R. K. Nath Received: 12 October 2009; Revised: 15 December

### Lecture 4 -- Sets, Relations, Functions 1

Lecture 4 Sets, Relations, Functions Pat Place Carnegie Mellon University Models of Software Systems 17-651 Fall 1999 Lecture 4 -- Sets, Relations, Functions 1 The Story So Far Formal Systems > Syntax»

### A NOTE ON INITIAL SEGMENTS OF THE ENUMERATION DEGREES

A NOTE ON INITIAL SEGMENTS OF THE ENUMERATION DEGREES THEODORE A. SLAMAN AND ANDREA SORBI Abstract. We show that no nontrivial principal ideal of the enumeration degrees is linearly ordered: In fact, below