A Modality for Recursion

Size: px
Start display at page:

Download "A Modality for Recursion"

Transcription

1 A Modality for Recursion (Technical Report) March 31, 2001 Hiroshi Nakano Ryukoku University, Japan Abstract We propose a modal logic that enables us to handle self-referential formulae, including ones with negative self-references, which on one hand, would introduce a logical contradiction, namely Russell s paradox, in the conventional setting, while on the other hand, are necessary to capture a certain class of programs such as fixed point combinators and objects with so-called binary methods in object-oriented programming Our logic provides a basis for axiomatic semantics of such a wider range of programs and a new framework for natural construction of recursive programs in the proofs-as-programs paradigm We give the logic as a modal typing system with recursive types for the purpose of presentation, and show its soundness with respect to a realizability interpretation which implies the convergence of well-typed programs according to their types 1 Introduction Even though recursion, or self-reference, is an indispensable concept in both programs and their specifications, it is still far from obvious how to capture it in an axiomatic semantics such as the formulae-as-types notion of construction [17] Only a rather restricted class of recursive programs (and specifications) has been captured in this direction as (co)inductive proofs over the (co)inductive data structures (see eg, [9, 14, 24, 19, 27]), and, for example, negative self-references, which would be necessary to handle a certain range of programs such as fixed point combinators and objects with so-called binary methods in object-oriented programming, still remain out of the scope In this paper, we propose a modal logic that provides a basis for capturing such a wider range of programs in the proofs-as-programs paradigm We give the logic as a modal typing system with recursive types for the purpose of presentation, and show its soundness with respect to a realizability interpretation which implies the convergence of well-typed programs according to their types Difficulty in binary-methods Consider, for example, the specification Nat Òµ of objects that represent a natural number Ò with a method which returns an object of Nat Ò Ñµ when one of Nat ѵ is given It could be represented by a self-referential specification such as: Nat Òµ Ò ¼µ Ò ¼ Nat Ò ½µµ Ñ Nat ѵ Nat Ò Ñµµµ where we assume that Ò and Ñ range over the set of natural numbers;, and are type constructors for direct sums, direct products and function spaces, respectively; and have standard logical (annotative) meanings Although it is not obvious whether this self-referential specification is meaningful in a certain mathematical sense, it could be a first approximation of the specification we want since this can be regarded as a refined version of recursive types which have been widely adopted as a basis for object-oriented type systems [1, 6] At any rate, if we define an object 0 as: 0 i 1 Ü Ü then it would satisfy Nat ¼µ, where i 1 is the injection into the first summand of direct sums and is a constant We assume that any program satisfies annotative formulae such as Ò ¼ whenever they are true We can easily define a function that satisfies Ò Ñ Nat Òµ Nat ѵ Nat Ò Ñµ as: add Ü Ý p 2 Ü Ý Research supported in part by 1999 Overseas Researcher Program of Ryukoku University This report contains detailed proofs of results presented in [23] as well as additional ones

2 or add ¼ Ü Ý p 2 Ý Ü where p 2 extracts second components, ie, the method of addition in this particular case, from pairs We could also define the successor function as a recursive program as: s Ü i 2 Ü Ý add Ü s ݵ or s ¼ Ü i 2 Ü Ý add ¼ Ü s ¼ ݵ In spite of the apparent symmetry between add and add ¼, which are both supposed to satisfy the same specification, the computational behaviors of s and s ¼ are completely different We can observe that s works as expected, but s ¼ does not For example, p 2 s0µ0 would be evaluated as: p 2 s0µ0 Ýadd0 sýµµ0 add0 s0µ p 2 0 s0µ Ü Üµ s 0µ s 0, whereas p 2 s ¼ 0µ 0 Ý add ¼ 0 s ¼ ݵµ 0 add ¼ 0 s ¼ 0µ p 2 s ¼ 0µ 0, and more generally, for any objects Ü and Ý of Nat Òµ (for some Ò), p 2 s ¼ ÜµÝ p 2 s ¼ ÝµÜ p 2 s ¼ ÜµÝ It should be noted that this sort of divergence would also be quite common in (careless) recursive definitions of programs even if we did not have to handle object-oriented specifications like Nat Òµ The peculiarity here is the fact that the divergence is caused by a program, add ¼, which is supposed to satisfy the same specification as add This example shows such a loss of the compositionality of programs with respect to the specifications that imply their termination, or convergence It also suggests that, to overcome this difficulty, add and add ¼ should have different specifications, and accordingly the definition of Nat Òµ should be revised in some way in order to force it and its logical inconsistency The typing system (see [4], and Section 3 of the present paper for a summary) is a simply-typed lambda calculus with recursive types, where any form of self-references, including negative ones, is permitted A non-trivial model for such unrestricted recursive types was developed by MacQueen, Plotkin and Sethi [22], and has been widely adopted as a theoretical basis for object-oriented type systems [1, 6] On the other hand, it is well known that logical formulae with such unrestricted self-references would introduce a contradiction (variant of Russell s paradox) Therefore, logical systems must have certain restrictions on the forms of self-references (if ever allowed) in order to keep themselves sound; for example, -calculus [25, 20] does not allow negative self-references (see also [13]) Through the formulae-as-types notion, this paradox corresponds to the fact that every type of is inhabited by a diverging program which does not produce any information; for example, the -term Ü Üܵ Ü Üܵ can be typed with every type in Therefore, even with the model mentioned above, types can be regarded only as partial specifications of programs, and that is considered the reason why we lost the compositionality of programs in the Nat Òµ case, where we regarded convergence of programs as a part of their specifications This shows a contrast with the success of as a basis for type systems of object-oriented program languages, where the primary purpose of types, ie, coarse specifications, is to prevent run-time type errors, and termination of programs is out of the scope The logical inconsistency of also implies that no mater how much types, or specifications, are refined, convergence of programs can not be expressed by them, and must be handled by endowing the typing system with some facilities for discussing computational properties of programs For example, Constable et al adopted this approach in their pioneering works to incorporate recursive definitions and partial objects into constructive type theory [10, 11] However, in this paper, we will pursue another approach such that types themselves can express convergence of programs Towards the approximation modality Suppose that we have a recursive program defined by: µ and want to show that satisfies a certain specification Ë Since the denotational meaning of is given as the least fixed point of, ie, ÙÔ Ò Ò µ, a possible way to do that would be to apply Scott s fixed point induction [26] by showing that: satisfies Ë, ܵ satisfies Ë provided that Ü satisfies Ë, and Ë is chain closed 2

3 However, this does not suffice for our purpose if Ë includes some requirement about the convergence of, because obviously, or even Ò µ, could not satisfy the requirement So we need more refined approach The failure of the naive fixed point induction above suggests that the specification to be satisfied by each Ò µ inherently depends on Ò, and the requirement concerning its convergence must become stronger when Ò increases This leads us to a layered version of the fixed-point induction scheme as follows: in order to show that satisfies Ë, it suffices to find an infinite sequence Ë ¼, Ë ½, Ë ¾, of properties, or (virtual) specifications, such that: (1) Ë Ì Ò Ë Ò, (2) Ë Ò ½ Ë Ò, (3) satisfies Ë ¼, (4) ܵ satisfies Ë Ò ½ provided that Ü satisfies Ë Ò, and (5) Ë Ò is chain closed For, since Ò µ ¾ Ë Ò for every Ò by (3) and (4), we get µ ¾ Ë Ò for every Ò by (2) This and (5) imply ¾ Ë Ò for every Ò, and consequently ¾ Ë by (1) In this scheme, the sequence Ë ¼, Ë ½, Ë ¾, can be regarded as a successive approximation of Ë, and a (higherorder) program which constructs a program that satisfies Ë Ò ½ from one that satisfies Ë Ò It should be also noted that works independently of Ò This uniformity of over Ò leads us to consider a formalization of this scheme in a modal logic, where the set of possible worlds (in the sense of Kripke semantics) consists of all non-negative integers, and Ë Ò in the induction scheme above corresponds to the interpretation of Ë in the world Ò We now write Ü r Ë to denote the fact that Ü satisfies the interpretation of Ë in the world, and define a modality, say, as: Ü r Ë iff ¼ or Ü r ½ Ë The condition (2) of the induction scheme says that Ü r Ë implies Ü r Ð Ë for every Ð ; in other words, the interpretation of specifications should be hereditary with respect to the accessibility relation In such a modal framework, the specification to be satisfied by can be represented by Ë Ë provided that the -connective is interpreted in the standard way in each world, and our induction scheme can be rewritten as: if r ¼ Ë and r Ë Ë for every ¼, then r Ë for every Furthermore, if we assume that Ë ¼ is a trivial specification which is satisfiable by any program, then, shifting the possible worlds downwards by one, we can simplify this to: ( ) if r Ë Ë for every, then r Ë for every Although this assumption about Ë ¼ somewhat restricts our choice of the sequence Ë ¼, Ë ½, Ë ¾,, it could be thought rather reasonable because, at any rate, Ë ¼ must be an almost trivial specification that is even satisfiable by Note that Ë Ò ½ occurring in the induction now corresponds to the interpretation of Ë in the world Ò, and Ë ¼ corresponds to the interpretation of Ë in the world 0 From this interpretation, we can extract some fundamental properties concerning the -modality, which introduce a subsumption, or subtyping, relation over specifications into our modal framework First, the hereditary interpretation of specifications implies the following property: Ü r Ë implies Ü r Ë Second, this and the standard interpretations of imply the following two properties: Ü r Ë Ì implies Ü r Ë Ì, and Ü r Ë Ì implies Ü r Ë Ì µ Furthermore, if Ü r for every Ü and, where is the trivial specification which is satisfiable by any program, ie, the universe of (meanings of) programs, then the converse of the second one is also true, that is: Ü r Ë Ì µ implies Ü r Ë Ì Note that this is not always the case because we could consider non-extensional interpretations, eg, F-semantics [15], in which Ü r holds, but r does not 3

4 Specification-level self-references This modal framework introduced for program-level self-references also provides a basis for specification-level self-references Suppose that we have a self-referential specification such as: Ë Ëµ As we saw in the Nat Òµ case, negative reference to Ë in can introduce a contradiction in the conventional setting, and this is still true in our modal framework However, in the world Ò, we can now refer to the interpretation of Ë in any world Ò without worrying about the contradiction That is, as long as Ë occurs only in scopes of the modal operator in, the interpretation of Ë is well-defined and given as a fixed point of, which is actually shown to be unique For example, if Ë is defined as Ë Ë Ì, then Ë could be interpreted in each world as follows: Ë ¼ Ì ¼ Ë ½ Ë ¼ Ì ¼ µ Ì ½ µ Ë ¾ Ë ½ Ë ¼ Ì ¼ µ Ì ½ µµ Ì ¾ µ Ë Ò ½ Ë Ò Ë Ò Ì Ò ½ µ where Ë and Ì are the interpretations of Ë and Ì in the world, respectively, and the notations such as and are abused to denote their expected interpretations also Note that this kind of self-references provides us a method to define the sequence Ë ¼, Ë ½, Ë ¾, for the refined induction scheme when we derive properties of recursive programs, and the induction scheme would be useless if we did not have such a method In the following sections, we will see that this form of specification-level self-references is quite powerful, and captures a wide range of specifications including those which are not representable in the conventional setting such as ones for add and add ¼ in the Nat Òµ case Furthermore, the modal version ( ) of the induction scheme turns out to be derivable from other properties of the -modality and such self-referential specifications, where the derivation corresponds to fixed point combinators, such as Curry s Y This also gives us a way to construct recursive programs based on the proofs-as-programs notion 2 Untyped -calculus We begin with the definition of the standard untyped -calculus with individual constants Definition 21 (Untyped -terms) The syntax of the -terms is defined relatively to the following two disjoint sets: Const of individual constants ( ) and Var of countably infinite individual variables ( Ü Ý Þ ) The set Exp of -terms is defined by the following BNF notation: Exp Const (individual constants) Var (individual variables) Var Exp (-abstractions) ExpExp (applications) We use Å Æ Ã Ä to denote -terms Free and bound occurrences of individual variables and the notion of «-convertibility are defined in the standard manner Hereafter, we identify -terms by this «-convertibility We denote the set of individual variables occurring freely in Å by Î Å µ, and use Å Æ ½ Ü ½ Æ Ò Ü Ò to denote the -term obtained from a -term Å by substituting Æ ½ Æ Ò for each free occurrence of individual variables Ü ½ Ü Ò, respectively, with necessary «-conversion to avoid accidental capture of free variables Definition 22 (-reduction) The standard notion of -reduction, a binary relation follows: Ü Å µæ Å ÆÜ where is an arbitrary context of -term over Exp, is defined as We denote the transitive and reflexive closure of by, and the symmetric closure of by We define the equivalence relation as the transitive and reflexive closure of 4

5 Definition 23 Let be a mapping from a set Ì to a set Ë, and let Ü ¾ Ì and Ú ¾ Ë We define a mapping ÚÜ by: Ú Ý Üµ ÚÜ Ýµ ݵ Ý Üµ Our intended semantics for untyped -terms is summarized as the following, where we do not require extensionality with respect to their interpretations Definition 24 (-model) A -model of Exp is a tuple Î Î such that: 1 Î : a non-empty set 2 Const Î 3 Î Î Î 4 Î Exp Var ε Î 5 Ü Î Üµ 6 Î µ 7 Å Æ Î Å Î Æ Î 8 Ü Å Î Ú Å Î ÚÜ 9 If Å Æ, then Å Î Æ Î 3 A brief review of In this section, we give a brief review of the typing system, which is a simply typed lambda calculus with recursive types Definition 31 (Type expressions of ) The syntax of the type expressions of is defined relatively to the following two sets: TConst of type constants (È É Ê ) and TVar of countably infinite type variables ( ) The set TExp of type expressions of is defined as follows: TExp TConst (type constants) TVar (type variables) TExp TExp (function types) TVar TExp (recursive types) We use to denote type expressions of We regard a type variable as bound in We use ½ ½ Ò Ò to denote the type expression obtained from by substituting ½ Ò for each free occurrence of ½ Ò, respectively We denote the set of type variables occurring freely in by Ì Î µ We regard «-convertible type expressions as identical; for example, We use to denote a type expression of the form ½ ¾ Ò, where Ò is a non-negative integer Definition 32 A type expression of is -proper 1 in if and only if occurs freely only in scopes of the -operator in That is, 1 A type constant È is always -proper in 2 A type variable is -proper in if and only if 3 is always -proper in 4 is -proper in if and only if so is or Note that is -proper in if and only if for every, Definition 33 We define the equivalence relation ³ over TExp as the smallest binary relation that satisfies: ³ -reflexµ ³ ³ -symmµ If ³, then ³ ³ -transµ If ³ and ³, then ³ 1 Many authors say contractive 5

6 ³ -µ If ³ and ³, then ³ ³ -fixµ ³ ³ -uniqµ If ³ and is -proper in, then ³ Intuitively, two type expressions of are equivalent modulo ³, if they have the same (possibly infinite) type expression obtained by unfolding recursive types occurring in them to indefinitely This equivalence relation is known to be decidable (see [8] and [3]) Proposition 34 Let Ò be a non-negative integer, ½, ¾,, Ò type variables, and, ½, ¾,, Ò, ½, ¾,, Ò type expressions of If ³ for every ( ½ ¾ Ò), then ½ ½ ¾ ¾ Ò Ò ³ ½ ½ ¾ ¾ Ò Ò Proof By induction on the structure of, and by cases of the form of The only interesting case is when ¼ for some and ¼ We can assume that ¾ Ì Î µ Ì Î µ for every In the sequel, we use abbreviations and for ½ ½ ¾ ¾ Ò Ò and ½ ½ ¾ ¾ Ò Ò, respectively By the induction hypothesis, we have ¼ ³ ¼ ¼ (by ³ -fixµ) ¼ ¼ (since ¾ Ì Î µ) ³ ¼ ¼ (by the ind hyp) ¼ ¼ (since ¾ Ì Î µ) Since ¼ is also -proper in, we now get ¼ ³ ¼ by ³ -uniqµ; and therefore, ³ Proposition 35 Let Ò be a non-negative integer, ½, ¾,, Ò type variables, and,, ½, ¾,, Ò, ½, ¾,, Ò, type expressions of If ³ and ³ for every ( ½ ¾ Ò), then ½ ½ ¾ ¾ Ò Ò ³ ½ ½ ¾ ¾ Ò Ò Proof By induction on the derivation of ³, and by cases of the last rules applied in the derivation Use Proposition 34 in case of ³ -reflexµ If the last rule is ³ -fixµ, then ¼ and ¼ ¼ for some and ¼ We can assume that ¾ Ì Î µ Ì Î µ for every ¼ ³ ¼ ¼ (by ³ -fixµ) ³ ¼ ¼ (since ¾ Ì Î µ) ³ ¼ ¼ (by Proposition 34) ³ ¼ ¼ (since ¾ Ì Î µ) Since ¼ is also -proper in, we now get ¼ ³ ¼ by ³ -uniqµ; and therefore, ¼ ³ ¼ ³ ¼ ¼ (by ³ -fixµ) ¼ ¼ (since ¾ Ì Î µ) ¼ ¼ If the last rule is ³ -uniqµ, then ¼ for some and ¼ such that ³ ¼ and ¼ is -proper in We can assume that ¾ Ì Î µ Ì Î µ for every ³ ¼ ¼ (by the ind hyp) ¼ (since ¾ Ì Î µ) ³ ¼ (by Proposition 34) Since ¼ is also -proper in, we now get ³ ¼ by ³ -uniqµ; and therefore, ³ 6

7 Proposition 36 Suppose that and are both -proper in If ³, then ³ Proof We get ³ ³ by ³ -fixµ and Proposition 35 Therefore, since is -proper in, we get ³ by ³ -uniqµ Definition 37 (Typing contexts) A typing context, or a context for short, of is a finite mapping that assigns a type expression of to each individual variable of its domain We use, ¼, to denote contexts, and Ü ½ ½ Ü Ñ Ñ to denote a context whose domain is Ü ½ Ü Ñ and that assigns to Ü for every, where ½ Ñ are type expressions of, and Ü ½ Ü Ñ are distinct individual variables Definition 38 () Let be a mapping that assigns a type constant µ to each individual constant The typing system is defined relatively to this by the following derivation rules: Ü Ü (var) Ü Å Ü Å ( I ) µ (const) Å Å ¼ ³ µ ³ ¼ µ ½ Å ¾ Æ ½ ¾ Å Æ (E ) Definition 39 (Realizability models of ) A realizability model of is a tuple Î Î Ì Æ Ì such that: 1 Î Î is a -model of Exp 2 Ì È Îµ Ë Ë Î µ 3 Æ TConst Ì 4 µ ¾ Æ µµ 5 Ì TExp TVar Ì µ Ì 6 Ì µ 7 È Ì Æ È µ 8 Ì Ú Ú Ù ¾ Ì for every Ù ¾ Ì 9 If ³, then Ì Ì It is not straightforward to construct a non-trivial realizability model of The first non-trivial model was developed by MacQueen, Plotkin and Sethi [22], by constructing a complete metric space of types and by interpreting recursive types as the fixed points of contractive type constructors (see also [2, 8]) Proposition 310 (Soundness of ) Let Î Î Ì Æ Ì be a realizability model of If Ü ½ ½ Ü Ò Ò Å is derivable, then Å Î ¾ Ì for every and provided Ü µ ¾ Ì ( ½ ¾ Ò) Proof By induction on the derivation and by cases of the last rule used in the derivation Nevertheless, as mentioned in Introduction, unrestricted self-references allowed in cause a logical contradiction as follows (Curry s paradox): Proposition 311 Ü Üܵ Ü Üܵ is derivable for any type expression Proof Let, and as follows: Then, we can derive it as follows: Ü Ü Ü Ü (³ ) Ü Ü Ü ÜÜ Ü ÜÜ Ü ÜÜ (Á) Ü ÜÜ Ü ÜÜ Ü Üܵ Ü Üܵ () (³ ) () 7

8 4 The typing system We now define a modal typing system, which is denoted by, based on the idea discussed in Introduction First, as a preparation for introducing the syntax of type expressions, we give the one of pseudo type expressions, which are obtained by adding a unary type constructor to the one of TExp Definition 41 We define the set PTExp of pseudo type expressions as follows: PTExp TConst (type constants) TVar (type variables) PTExp PTExp (function types) PTExp (approximative types) TVarPTExp (recursive types) We assume that associates to the right as usual, and each (pseudo) type constructor associates according to the following priority: (Low) (High) For example, is the same as µ µµµ We use as an abbreviation for and use Ò to denote a (pseudo) type expression ßÞ Ð, where Ò ¼ Ò times Definition 42 (-variants) A type expression is a -variant if and only if Ѽ ½ ѽ ¾ Ѿ Ò ÑÒ for some Ò, Ñ ¼, Ñ ½, Ñ ¾,, Ñ Ò, ½, ¾,, Ò and such that ½ Ò and Ñ Ñ ½ Ñ ¾ Ñ Ò ½ Definition 43 (Properness) A pseudo type expression is proper in if and only if occurs freely only (a) in scopes of the -operator in, or (b) in a subexpression of with being a -variant In other words: 1 A type constant È is always proper in 2 A type variable is proper in if and only if 3 is always proper in 4 is proper in if and only if (a) so are both and, or (b) B is a -variant 5 is proper in if and only if so is or For example, È,, µ, and µ are proper in, and neither, nor is proper in Definition 44 (Type expressions of ) We define the set TExp of type expressions as the smallest set of pseudo type expressions that satisfies: 1 È ¾ TExp for every type constant È 2 ¾ TExp for every type variable 3 If ¾ TExp and ¾ TExp, then ¾ TExp 4 If ¾ TExp, then ¾ TExp 5 If ¾ TExp and is proper in, then ¾ TExp In other words, a type expression is a pseudo type expression such that is proper in for any of its subexpressions in the form of We denote the set of type expressions of by TExp For example, È,,,, and are type expressions of, and neither nor is a type expression of We also use to denote type expressions of, and define other notations such as Ì Î µ and ½ ½ Ò Ò similarly to the case of Definition 45 Let be a type expression We define µ, the height of, and Ö µ, the rank of, as follows: È µ µ ¼ µ µ ½ µ ÑÜ µ µµ ½ µ µ ½ Ö È µ Ö µ Ö µ ¼ ¼ Ö µ ÑÜ Ö µ Ö µµ ½ Ö µ Ö µ ½ ( is a -variant) (otherwise) 8

9 Proposition 46 If is proper in, then Ö µ Ö µ for every Proof By straightforward induction on µ, and by cases on the form of Proposition 47 1 If and are proper in, then so is 2 If is proper in, then so is for every Proof By straightforward induction on µ, and by cases on the form of Definition 48 Let be be a type expression We define sets Ì Î µ and Ì Î µ of type variables as follows: Ì Î È µ Ì Î µ Ì Î µ Ì Î µ Ì Î µ Ì Î ( is a -variant) µ Ì Î µ Ì Î µ (otherwise) Ì Î µ Ì Î µ Ì Î µµ ( ¾ Ì Î µ) Ì Î µ ( ¾ Ì Î µ) The set Ì Î µ (Ì Î µ) consists of the type variables that have free positive (negative) occurrences in, where we ignore any subexpression of whenever is a -variant Note that Ì Î µ Ì Î µ Proposition 49 1 If is a -variant, then so is 2 If is a -variant, then (a) is also a -variant, or (b) ¾ Ì Î µ and is a -variant Proof By straightforward induction on µ, and by cases on the form of Proposition If ¾ Ì Î µ, and is not a -variant, then ¾ Ì Î µ 2 If ¾ Ì Î µ and ¾ Ì Î µ Ì Î µ, then ¾ Ì Î µ Proof By straightforward induction on µ, and by cases of the form of Use Proposition 492 for part 1 in case that for some and Note that ¾ Ì Î µ implies that is not a -variant Proposition If ¾ Ì Î µ and ¾ Ì Î µ, then ¾ Ì Î µ 2 If ¾ Ì Î µ and ¾ Ì Î µ, then ¾ Ì Î µ 3 If ¾ Ì Î µ and ¾ Ì Î µ Ì Î µ, then ¾ Ì Î µ 4 If ¾ Ì Î µ and ¾ Ì Î µ Ì Î µ, then ¾ Ì Î µ Proof By simultaneous induction on µ Definition 412 Let be a type variable, and a type expression The positive -depth Ô µ, the negative -depth Ô µ, the positive -depth Ô µ and the negative -depth Ô µ of in are defined as follows: Ô È µ ½ Ô µ ¼ ( ) ½ ( ) Ô µ ½ Ô µ Ô µ ½ Ô ½ µ ÑÒ Ô µ Ô µµ (otherwise) ( is a -variant) Ô µ ÑÒ Ô µ Ô µ Ô µµ µ Ô È µ ½ Ô µ ¼ ( ) ½ ( ) 9

10 Ô µ ½ Ô µ Ô µ Ô ½ µ ÑÒ Ô µ Ô µµ ½ (otherwise) ( is a -variant) Ô µ ÑÒ Ô µ Ô µ Ô µµ µ Note that Ô µ, Ô µ ¾ ¼ ½ ¾ ½ We can easily check that «-conversions do not affect the definition of Ô µ or Ô µ We also define the -depth Ô µ and -depth Ô µ of in as follows: Proposition 413 Let Ô be Ô or Ô Ô µ ÑÒ Ô µ Ô µµ Ô µ ÑÒ Ô µ Ô µµ 1 Ô µ ½ if and only if ¾ Ì Î µ 2 Ô µ ÑÒ Ô µ Ô µ Ô µ Ô µµ 3 If, then Ô µ ÑÒ Ô µ Ô µ Ô µ Ô µ Ô µµ Proof By induction on µ, and by cases of the form of Proposition 414 is proper in if and only if Ô µ ¼ Proof By straightforward induction on µ, and by cases of the form of Proposition If Ô µ ¼, then Ì Î µ and Ì Î µ 2 Ô µ ¼ Proof By straightforward simultaneous induction on µ, and by cases of the form of 5 Equality of types Definition 51 (³) The equivalence relation ³ over TExp is defined as the smallest binary relation that satisfies: ³-reflexµ ³ ³-symmµ If ³, then ³ ³-transµ If ³ and ³, then ³ ³- µ If ³, then ³ ³-µ If ³ and ³, then ³ ³-µ ³ ³-fixµ ³ ³-uniqµ If ³ and is proper in, then ³ Note that except for ³- µ, ³-µ and ³-uniqµ, these conditions are the same as ³ Two type expressions of are equivalent modulo ³, if their (possibly infinite) type expression obtained by indefinite unfolding recursive types occurring in them are identical modulo the rule ³-µ Proposition 52 Let Ò be a non-negative integer, ½, ¾,, Ò type variables, and, ½, ¾,, Ò, ½, ¾,, Ò type expressions of If ³ for every ( ½ ¾ Ò), then ½ ½ ¾ ¾ Ò Ò ³ ½ ½ ¾ ¾ Ò Ò Proof Similar to the proof of Proposition 34 Use Proposition 472 for the case that ¼ for some and ¼ Proposition 53 Let Ò be a non-negative integer, ½, ¾,, Ò type variables, and,, ½, ¾,, Ò, ½, ¾,, Ò, type expressions of If ³ and ³ for every ( ½ ¾ Ò), then ½ ½ ¾ ¾ Ò Ò ³ ½ ½ ¾ ¾ Ò Ò 10

11 Proof Similar to the proof of Proposition 35 Use Proposition 472 for the case that the last rule is ³-fixµ or ³-uniqµ In the sequel, we use Proposition 53 in proofs without notice Proposition 54 If ³, then Ô µ Ô µ and Ô µ Ô µ Proof By induction on the derivation of ³ The only interesting case is when the last rule is ³-uniqµ Suppose that ³ There exist some and such that, ³ and is proper in By the induction hypothesis, Ô µ Ô µ and Ô µ Ô µ for every (1) Therefore, Ô µ Ô µ ÑÒ Ô µ Ô µ Ô µ Ô µµ by Proposition 4132 Since Ô µ ¼ by Proposition 414, we get Ô µ ½; and therefore, also Ô µ ½ by Propositions 4131 If, then Ô µ ½ Ô µ and Ô µ ½ Ô µ by Propositions 4131 Otherwise, ie, if, then Ô µ Ô µ (by (1)) ÑÒ Ô µ Ô µ Ô µ Ô µ Ô µµµ (by Proposition 4133) ÑÒ Ô µ Ô µ Ô µµ (since Ô µ ¼) ÑÒ Ô µ Ô µ ÑÒ Ô µ Ô µ Ô µµµ ÑÒ Ô µ Ô µ Ô µ Ô µ Ô µ Ô µµ ÑÒ Ô µ Ô µ Ô µµ (since Ô µ ¼) Ô µ (by Definition 412) Similarly, we get Ô µ ÑÒ Ô µ Ô µ Ô µ Ô µ Ô µµ in this case If Ô µ ¼, then Ô µ Ô µ as in the case of Ô Otherwise, ie, if Ô µ ¼, then ¾ Ì Î µ by Propositions 415; and therefore ¾ Ì Î µ by Propositions 4131, because we already have Ô µ Ô µ We now get Ô µ ½ Ô µ by Propositions 4131 again Proposition 55 Suppose that ³ 1 Ì Î µ Ì Î µ 2 is proper in if and only if so is Proof Obvious from Propositions 4131, 414 and 54 Definition 56 Let Ò be a non-negative integer, and ½, ¾,, Ò be type variables Let and be type expressions We define a type expression ½ ¾ Ò by ¼ ½ ¼ ¾ ¼ Ñ, where ¼ ½ ¼ ¾ ¼ Ñ are distinct type variables such that ¼ ½ ¼ ¾ ¼ Ñ ½ ¾ Ò We use to denote a type expression of the form ½ ¾ Ò Proposition 57 ³ Proof By induction on the length of Let ½ ¼ ³ ¼ µ ½ (by ³-fixµ) ³ ¼ ¼ ½ (by ind hyp) ½ ¼ µ ½ ¼ ³ ½ ¼ (by ³-fixµ) ½ ¼ 11

12 Proposition 58 1 If ³ and or is proper in, then ³ 2 If ³, ³, and is proper in, then ³ 3 ³ 4 ³ Proof For the part 1, we get ³ ³ by ³-fixµ and Proposition 53 Note that if is proper in, then so is by Proposition 55 since ³ Therefore, ³ by ³-uniqµ The part 2 is obvious by ³-uniqµ, ³-symmµ and ³-transµ For the part 3, let and show that ³ and ³ Note that is proper in by Proposition 47 For the part 4, let and show that ³ and ³ Use Proposition 57 Proposition 59 1 ³ 2 ³ Ò for every Ò ½ Proof Obvious from ³-fixµ and ³-uniqµ Proposition 510 ³ if and only if ¼ ¼ ¼ for some ¼, ¼ and ¼ such that: ³ ¼ ¼ ¼ ¼ ¼ and (2) ³ ¼ ¼ ¼ ¼ ¼ or ³ (3) Proof First, we show the if part Suppose that there exist some ¼, ¼ and ¼ such that ¼ ¼ ¼, and both (2) and (3) hold ³ µ (by Proposition 57) ¼ ¼ ³ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ (by (2), (3) and ³-µ) ¼ ¼ µ ¼ ¼ ¼ ¼ ³ ¼ ¼ ¼ (by Proposition 57) As for the only if part, we prove a more general statement: if ³ or ³, then ¼ ¼ ¼ for some ¼, ¼ and ¼ such that (2) and (3) hold The proof proceeds by induction on the derivation of ³ or ³, and by cases of the last rule used in the derivation Case: ³-µ Let Since ³ or ³ is derivable, so is ³ ¼ or ¼ ³ for some ¼ such that ¼ By the induction hypothesis, ¼ ¼ ¼ ¼ for some ¼ and ¼ such that: ³ ¼ ¼ ¼ ¼ ¼ and (4) ³ ¼ ¼ ¼ ¼ ¼ or ³ (5) We can assume that ¾ ¼ without loss of generality ³ µ (by ³-fixµ) ³ ¼ ¼ ¼ ¼ ¼ (by (4)) ³ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ (since ³ ¼ ) ¼ ¼ ¼ ¼ µ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ³ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ (by ³-fixµ) ¼ ¼ ¼ ¼ ¼ Similarly, we get ¼ ¼ ¼ ¼ ¼ or ³ from (5) 12

13 Case: ³-fixµ For some,, and, the derivation ends with ³ µ Since we can assume that ¾ without loss of generality, we get µ µ ³ µ (by ³-fixµ) µ Similarly, we get ³ µ or ³ Case: ³-uniqµ If ³, there exists some ¼ such that ¼, ³ ¼, and ¼ is proper in In this case, by the induction hypothesis, we get ¼ ¼ ¼ for some, ¼ and ¼ On the other hand, if ³, then we have ³ µ for some such that In this case, ¼ ¼ ¼ for some ¼ ¼ and ¼ by the induction hypothesis Therefore, in either case, the derivation ends with: ³ ¼ ¼ µ ³ ¼ ¼ (³-uniq) for some, and such that ¾ Let ¼ Then it suffices to show that (2) and (3) hold We can assume that ¾ without loss of generality By the induction hypothesis, ³ ¼ ¼ ¼ µ and (6) Therefore, ³ ¼ ¼ ¼ µ or ³ (7) ³ ¼ ¼ ¼ µ (by (6)) ¼ ¼ ¼ ³ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ µ ¼ ¼ ¼ ¼ ³ ¼ ¼ ¼ ¼ ¼ (by ³-fixµ) ¼ ¼ ¼ ¼ ¼ ¼ ¼ Similarly, we also get ³ ¼ ¼ ¼ ¼ or ³ Other cases are rather straightforward Proposition 511 Let È be a type constant È ³ if and only if ¼ È for some ¼ Proof Similar to the proof of Proposition 510 Proposition 512 Let ¾ ³ if and only if ¼ for some ¼ such that ¾ ¼ Proof Similar to the proof of Proposition 510 Proposition 513 ³ if and only if ¼ ¼ for some ¼ and ¼ such that ³ ¼ ¼ ¼ ¼ Proof Similar to the proof of Proposition 510 Proposition ³ if and only if ³ 2 ³ if and only if (a) ³ ³, or (b) ³ and ³ Proof If part is obvious from ³- µ and ³-µ We get only if part from Propositions 510 and 513 Proposition ³ ÒÈ Ò Ò µ for any Ò ¼ 2 ³ È 13

14 3 È ³ 4 ³ Proof Obvious from Propositions 510, 513, 511 and 512 Proposition 516 If ³, then ³ Proof Obvious from Proposition 5141 because ³ by Proposition 591 Proposition 517 If Ò ³, then (a) ³ or (b) Ò ¼ Proof Suppose that Ò ³ and Ò ¼ Since Ò is proper in, we get ³ Ò by ³-uniqµ Therefore, ³ by Proposition 592 Proposition 518 Suppose that ³ and Ñ Ò 1 If ³ ÒÈ and ³ ÑÈ, then ³ ÒÈ 2 If ³ Ò and ³ Ñ, then ³ Ò 3 If ³ Ò µ and ³ Ñ µ, then ³ Ò ¼ ¼ µ for some ¼ and ¼ such that (a) ¼ ³ ³, or (b) ¼ ³ and ¼ ³ Proof By induction on the lexicographic ordering of Ò Ö µ, and by cases of the form of Use Propositions 510, 511, 512 and 513 The induction hypothesis is used only if is in the form of ¼ or ¼ Suppose that ³ Ò and ³ Ñ, where is either È, or Case: is a type constant Since ³ Ò, we get Ò ¼ and È by Proposition 515; and therefore, ³ È Case: is a type variable Since ³, we get Ò ¼ and from ³ Ò by Proposition 515; and therefore, ³ Case: ¼ for some ¼ In this case, Ò ¼ and ¼ ³ Ò ½ by Propositions 5141 and 515 If ¼ ³, then Ò ³ ³ ³ Ñ ½ ; however, this is impossible by Propositions 5141 and 515 since Ñ ½ Ò Therefore, ¼ ³ If È or, then we get ¼ ³ Ò ½, ie, ³ Ò by the induction hypothesis Similarly, if, then we get ¼ ³ Ò ½ ¼ ¼ µ ie, ³ Ò ¼ ¼ µ, for some ¼ and ¼ such that (a) ¼ ³ ³, or (b) ¼ ³ and ¼ ³ Case: ½ ¾ for some ½ and ¾ In this case, Ò ¼ and by Proposition 515 Therefore, taking ¼ and ¼ as ¼ ½ and ¼ ¾, we get ³ Ò ¼ ¼ µ; and since Ò ³ ¼ ¼, we also get (a) ¼ ³ ³, or (b) ¼ ³ and ¼ ³, by Propositions 5142 Case: ¼ for some and ¼ We can assume ¾ Ì Î µ Since ³ ¼ ¼, we get ¼ ¼ ³ and ¼ ¼ ³ ¼ µ ³ Ò Note also that Ö ¼ ¼ µ Ö µ Therefore, if È or, then we get ³ ¼ ¼ ³ Ò by the induction hypothesis Similarly, if, then we get ³ ¼ ¼ ³ Ò ¼ ¼ µ for some ¼ and ¼ such that (a) ¼ ³ ³, or (b) ¼ ³ and ¼ ³ Proposition 519 Let ½ ¾ Ñ be distinct type variables If ½ ½ ¾ ¾ Ñ Ñ ³ and ¾ Ì Î µ (½ Ñ), then ³ Ò for some Ò ¼ Proof By induction on µ and by cases of the form of Suppose that ½ ½ ¾ ¾ Ñ Ñ ³ and ¾ Ì Î µ (½ Ñ) Case: È for some È, or for some and This case is impossible because ³ for any by Proposition 5151 Case: for some Trivial because we get from ¾ Ì Î µ 14

15 Case: ¼ for some ¼ In this case, we can get ¾ Ì Î ¼ µ, and ¼ ½ ½ ¾ ¾ Ñ Ñ ³ from ¼ ½ ½ ¾ ¾ Ñ Ñ by Proposition 516 Since ¼ µ µ, by the induction hypothesis, we get ¼ ³ Ò for some Ò; and therefore, ¼ ³ Ò ½ Case: ¼ for some and ¼ We can assume that for any (½ Ñ) From the assumption, we get ¾ Ì Î ¼ µ and ³ ½ ½ ¾ ¾ Ñ Ñ ³ ¼ ¼ ½ ½ ¾ ¾ Ñ Ñ ³ ¼ ¼ µ ½ ½ ¾ ¾ Ñ Ñ ½ ½ ¾ ¾ Ñ Ñ Since ¼ µ µ, by the induction hypothesis, we get ¼ ³ Ò ; and hence, ³ Ò ³ Ò Proposition 520 A type expression is a -variant if and only if ³ Proof The proof for the only if proceeds by straightforward induction on µ Note that Ò ½ ³ by ³-uniqµ since Ò ½ µ ³ For if part, it suffices to show the following: 1 If ³, then is a -variant 2 If ³ Ò, then is a ( Ò)-variant, where a type expression is a ( Ò)-variant if and only if Ѽ ѽ ½ Ѿ ¾ Ñ for some, Ñ ¼, Ñ ½, Ñ ¾,, Ñ, ½, ¾,, such that Ñ ¼ Ñ ½ Ñ ¾ Ñ Ò and for any (½ ) The proof proceeds by simultaneous induction on µ and by cases of the form of Case: È for some È, or for some and This case is impossible because neither ³ nor ³ Ò holds by Proposition 515 Case: for some In this case, we get ³ by Proposition 515 If ³ Ò, then we get and Ò ¼ also by Proposition 515, that is, is a ( Ò)-variant Case: ¼ for some ¼ If ³, then ¼ ³ by Proposition 516; and therefore, ¼ is a -variant by the induction hypothesis Hence, so is On the other hand, if ³ Ò, then Ò ¼ and ¼ ³ Ò ½ by Propositions 513 and 5141 Therefore, ¼ is a ( Ò ½ )-variant by the induction hypothesis, that is, is a ( Ò)-variant Case: ¼ for some and ¼ To show the first part, suppose that ³ If ¾ Ì Î ¼ µ, then we get ¼ ³ since ³ ¼ ¼ ¼ in this case Therefore, ¼ is a -variant by the induction hypothesis; and so is On the other hand, if ¾ Ì Î ¼ µ, then since ¼ ¼ ³ ³, we get ¼ ³ Ò for some Ò by Proposition 519; and hence, ¼ is a ( Ò )-variant by the induction hypothesis is thus a -variant since we get Ò ¼ from the fact that ¼ is proper in For the second part, suppose that ³ Ò, that is, ¼ ³ Ò We can assume that Since ¼ is proper in, ¼ ³ Hence, ¼ ³ Ò by Proposition 5182; and therefore, ¼ is a ( Ò)-variant by the induction hypothesis; and so is since In the sequel, we use Proposition 520 in proofs without notice Definition 521 (Canonical types) We define a set CTExp of canonical type expressions as follows: where Ò is an arbitrary non-negative integer CTExp ÒTConst ÒTVar Ò TExp TExpµ Definition 522 We define for each type expression as follows: È È µ µ (if ) (otherwise) µ (if Ò for some Ò ½) (otherwise) 15

16 Proposition 523 is a canonical type expression such that ³ Proof By induction on µ, and by cases of the form of Note that if a canonical type expression does not have a form of Ò, then is also canonical for any That is, Definition 522 can be regarded as an effective procedure for calculating a canonical type expression such that ³ from a given type expression of Proposition 524 If is a canonical form, then Proof By induction on µ, and by cases of the form of 6 Subtyping induced by the modality As mentioned in Introduction, our intended interpretation of the -modality introduces a subtyping relation into TExp We now define the subtyping relation by a set of inference rules as in [3] Definition 61 A subtyping assumption is a finite set of pairs of type variables such that any type variable appears at most once in the set We write ½ ½ ¾ ¾ Ò Ò to denote the subtyping assumption ½ ¾ Ò We use, ¼, ½, ¾, to denote subtyping assumptions, and Ì Î µ to denote the set of type variables occurring in Definition 62 () We define the derivability of subtyping judgment rules: (-assump) (-) by the following derivation ¼ -reflexµ ( ³ ¼ ) ½ ¾ ½ ¾ (-trans) (- ) ½ ¼ ¾ ¼ ½ ¾ ¼ ¼ (-) (-approx) (- ) µ (- ) -µ ¾ Ì Î µ Ì Î µ, ¾ Ì Î µ Ì Î µ, and and are proper in and, respectively Note that and ½ ¾ in the rules must be (valid) subtyping assumptions, ie, any type variable must not have more than one occurrence in them We also define a binary relation over TExp as: if and only if is derivable Most of the subtyping rules are standard The rule -µ corresponds to the Amber rule [7] The rules -µ, - µ, -approxµ, - µ and - µ reflect our intended meaning of the -modality discussed in Introduction Proposition 63 1 If is derivable, ¼ ¼ and ¼ ¼ Ì Î µ, then ¼ ¼ ¼ ¼ ¼ ¼ is also derivable without changing the height of derivation 2 If is derivable and ³, then is also derivable without changing the height of derivation 3 If is derivable, and ¼, then ¼ is also derivable without changing the height of derivation Proof By simultaneous induction on the derivation of or 16

17 Proposition 64 If and are derivable, then is also derivable Proposition 65 Let be a derivable subtyping judgment If ³, then ³ Proof By induction on the height of the derivation, and by cases of the last rule applied in the derivation Some rules are impossible as the last one by Proposition 515 Use Proposition 516 for the case of - µ Use Proposition 59 for the case of -approxµ If the last rule is -µ, then the derivation ends with: ¼ ¼ ¼ ¼ (-) for some,, ¼ and ¼ such that ¼, ¼, ¾ Ì Î ¼ µ, ¾ Ì Î ¼ µ, and ¼ and ¼ are proper in and, respectively By Proposition 632, we can get a derivation of ¼ ¼ from the one of ¼ ¼ without changing the height of derivation Since ³ ¼ and ³, we get ¼ ³ Therefore, by the induction hypothesis, ¼ ³ ; and then by ³-uniqµ, ¼ ³ Proposition 66 Let be a derivable subtyping judgment If ³ ¼, then ³ ¼ for some ¼ such that ¼ ¼ is derivable Proof Since ¼ ³ implies ³ ³ by Proposition 65, we assume that ¼ ³ The proof proceeds by induction on the derivation, and by the cases of the last rule applied in the derivation Some rules are impossible as the last one by Proposition 515 Use Proposition 5141 for the case of - µ If the last rule is -µ, then the derivation ends with: (-) for some,, and such that,, ¾ Ì Î µ, ¾ Ì Î µ, and and are proper in and, respectively Since ¼ ³, ¼ ³ and ³ ³ ¼, by considering the canonical form of ¼, we get ³ ¼ for some ¼ by Proposition 518 Therefore, by the induction hypothesis, ¼ ¼ is derivable for some ¼ such that ³ ¼ We get the derivation of ¼ ¼ by Proposition 64 On the other hand, since ¾ Ì Î µ and ¾ Ì Î µ, ¼ ³ ³ ¼ ³ ¼ ¼ Therefore, ¼ ³ ¼ by Proposition 5141 We thus get ¼ ¼ Note that ³ ¼ ³ ¼ ³ ¼ since ¾ Ì Î µ and ¾ Ì Î µ Proposition 67 Let be a derivable subtyping judgment 1 If ³ ÑÈ and ³, then ³ ÒÈ for some Ò such that Ñ Ò 2 If ³ ÒÈ, then ³ ÑÈ for some Ñ such that Ñ Ò Proof By induction on the derivation of, and by cases of the last rule applied in the derivation In case of -transµ, use Proposition 65 to apply the induction hypothesis Use Proposition 5141 for the cases - µ and -approxµ If the last rule is -µ, then the derivation ends with: ¼ ¼ ¼ ¼ (-) for some,, ¼ and ¼ such that ¼, ¼, ¾ Ì Î ¼ µ, ¾ Ì Î ¼ µ, and ¼ and ¼ are proper in and, respectively If ³ ÑÈ, then since ³ ¼ ³ ÑÈ and ¼ ³, we get ¼ ³ ÑÈ by Proposition 518; and therefore, by the induction hypothesis, ¼ ³ ÒÈ for some Ò Ñ Similarly, if ³ ÒÈ, then ¼ ³ ÑÈ for some Ñ Ò 17

18 Proposition 68 Let be a derivable subtyping judgment 1 If ³ Ñ and ³, then ³ Ò for some Ò and such that: (a) Ñ Ò, and (b) or ¾ 2 If ³ Ò, then ³ Ñ for some Ñ and such that: (a) Ñ Ò, and (b) or ¾ Proof Similar to Proposition 67 Proposition 69 Let be a derivable subtyping judgment 1 If ³ Ñ µ and ³, then there exist some Ò,, Ð, and such that: (a1) ³ Ò µ, (a2) Ñ Ò, and (a3) Ð and Ð are derivable 2 If ³ Ò µ, then there exist some Ñ,, Ð, and such that: (b1) ³ Ñ µ, (b2) Ñ Ò, (b3) Ð is derivable, and (b4) so is Ð provided ³ Note that, Ð, Ñ and Ò range over non-negative integers Proof By induction on the derivation of, and by cases of the last rule used in the derivation Proposition 518 is crucial to the case -µ For the first part of the conjecture, suppose that ³ Ñ µ and ³ Case: -assumpµ This case is impossible by Proposition 515 Case: -µ Also impossible Proposition 65, since ³ Case: -reflexµ Trivial because ³ ³ Ñ µ in this case Case: -transµ In this case, and are derivable for some We get ³ from ³ by Proposition 65 By the induction hypothesis on, there exist some Ò ¼, ¼, Ð ¼, ¼ and ¼ such that ³ Ò ¼ ¼ µ, Ñ ¼ Ò ¼, and ¼ м and м ¼ are derivable Therefore, by the induction hypothesis on, there exist some Ò, ¼¼, Ð ¼¼, and such that ³ Ò µ, Ò ¼ ¼¼ Ò, and ¼¼ м¼ ¼ and м¼ ¼ ¼¼ are derivable Taking and Ð as ¼ ¼¼ and Ð Ð ¼ Ð ¼¼, we get (a1) through (a3) Case: - µ In this case, ¼ ¼ are derivable for some ¼ and ¼ such that ¼ and ¼ We get ¼ ³ from ³ by Proposition 59, and Ñ ¼ and ¼ ³ Ñ ½ µ from ³ Ñ µ by Propositions 5141 and 515 Therefore, by the induction hypothesis, there exist some Ò ¼,, Ð, and such that: ¼ ³ Ò¼ µ, Ñ ½ Ò ¼, and Ð and Ð are derivable It then suffices to take Ò as Ò Ò ¼ ½ 18

19 Case: -µ In this case, ½ ½ and ¾ ¾ are derivable for some ½, ¾, ½ and ¾ such that ½ ¾ and ½ ¾ Since ³ Ñ µ, we get Ñ ¼ by Proposition 515, and ³ ¾ ³, or ³ ½ and ³ ¾ by Propositions 5142 In the former case, we get ¾ ³ from ¾ ¾ by Proposition 65; and hence, ½ ¾ ³ by ³-µ Therefore, taking Ò,,, and Ð as Ò ¼, ¼,, and Ð ¼, we get (a1) through (a3) in this case In the latter case, it suffices to take Ò,, Ð, and as Ò ¼, ¼, Ð ¼, ½ and ¾ Case: -approxµ Since in this case, it suffices to take Ò,, Ð, and as Ò Ñ ½, ¼, Ð ¼, and Case: - µ In this case, ½ ¾ and ½ ¾ for some ½ and ¾ Since ³ Ñ µ, we get Ñ ¼ by Proposition 515, and ³ ¾ ³, or ³ ½ and ³ ¾ by Propositions 5142 In the former case, ½ ¾ ³ ½ ³ ½ ³ by ³-µ and Proposition 59 Therefore, taking Ò,, Ð, and as Ò ¼, ¼, Ð ¼, and, we get (a1) through (a3) in this case In the latter case, it suffices to take Ò,, Ð, and as Ò ¼, ¼, Ð ½, and Case: - µ In this case, ½ ¾ and ½ ¾ µ for some ½ and ¾ Since ³ Ñ µ, we get Ñ ¼ by Proposition 515, and ³ ¾ ³, or ³ ½ and ³ ¾ by Propositions 5142 In the former case, ¾ ³ by Proposition 516, and hence, ½ ¾ µ ³ ½ µ ³ µ by ³-µ Therefore, taking Ò,, Ð, and as Ò ½, ¼, Ð ¼, and, we get (a1) through (a3) in this case In the latter case, it suffices to take Ò,, Ð, and as Ò ½, ½, Ð ¼, ½ and ¾ Case: -µ In this case, ¼ ¼ is derivable for some,, ¼ and ¼ such that: ¼ (8) ¼ (9) ¾ Ì Î µ Ì Î ¼ µ and (10) ¾ Ì Î µ Ì Î ¼ µ (11) Since ¼ is proper in, we get ¼ ³ Note that Ñ µ ³ ¼ ³ ¼ by (8) and ³-fixµ Therefore, by Proposition 518, there exist some ¼ and ¼ such that: ¼ ³ Ñ ¼ ¼ µ (12) ³ ¼ and (13) ³ ¼ or ³ ¼ ³ (14) Since we can get ¼ ³ from ³ By the induction hypothesis, there exist some Ò, ¼, Ð ¼, ¼ and ¼ such that: (a1 ¼ ) ¼ ³ Ò ¼ ¼ µ, (a2 ¼ ) Ñ ¼ Ò, and (a3 ¼ ) ¼ ¼ м ¼ and м ¼ ¼ ¼ are derivable There are two subcases as follows 19

20 Subcase: ¼ ³ Since ³ Ñ µ implies ³ by Proposition 515, we get by Proposition 492; and therefore, from (a3 ¼ ) by Propositions 65 and 516 Hence, ³ ¼ ¼ ³ (15) ¼ ³ (16) (by (9) and ³-fixµ) ³ Ò ¼ ¼ µµ (by (a1 ¼ )) ³ Ò ¼ µµ (by (16)) ³ Ò ¼ µµ (by ³-µ) ³ Ò ¼ ¼ µµ (by (15)) ³ Ò Ñ ¼ µ (by (12)) Ò Ñ ¼ (by (11)) ³ Ò µ (by (12)) Therefore, in this subcase, we get (a1) through (a3) by taking, Ð, and as ¼ Ð ¼, and Subcase: ¼ ³ In this case, obviously ¼ ³, and we get from (14) Let and be as ¼ and ¼ ³ ¼ ³ ¼ (17) (by (9) and ³-fixµ) ¼ (by (10)) ³ Ò ¼ ¼ µµ (by (a1 ¼ )) Ò µ Since ¼ ³, and since Ñ ¼ ¼ µ Ñ ¼ ¼ µ ³ ¼ ¼ ³ Ñ ¼ ¼ µ by (11) and (12), we get ¼ ³ ¼ and ¼ ³ ¼ by Proposition 514; and therefore, ¼ ¼ ³ ¼ ³ and ¼ ¼ ³ ¼ ³ by (10), (13) and (17) Hence, taking and Ð as ¼ and Ð Ð ¼, Ð and Ð are derivable, because so are ¼ Ð ¼ and Ð ¼ ¼ by (a3 ¼ ) and Proposition 64 We thus get (a1) through (a3) also in this subcase We can prove the second part of the conjecture similarly Proposition 610 Let Ò and Ñ be non-negative integers 1 Ò ÑÈ, Ò Ñ and Ò Ñ µ 2 ÒÈ Ñ and ÒÈ Ñ µ 3 Ò ÑÈ and Ò Ñ µ 4 Ò µ ÑÈ and Ò µ Ñ 5 È,, and Proof Obvious from Propositions 66, 67, 68, 69, 59 and 515 Proposition 611 If Ò is derivable and ³, then Ò ¼ Proof Straightforward from Propositions 67, 68 and 69 since Ò is also derivable and ³ 20

21 7 The typing rules We now define the typing rules of According to the intended meaning of, two new typing rules, µ and µ, are added and the E µ rule is generalized to handle types with the -modality Definition 71 (Typing rules) Typing contexts for are defined similarly to the case of Let be a mapping that assigns a type constant µ to each individual constant The typing system is defined relatively to by the following derivation rules: Ü Ü (var) µ (const) Å () Å Å Å ( ) Å () Ü Å Ü Å ( I) ½ Å Ò µ ¾ Æ Ò Å Æ Ò ½ ¾ (E) where denotes the typing context Ü ½ ½ Ü ¾ ¾ Ü Ò Ò when Ü ½ ½ Ü ¾ ¾ Ü Ò Ò The µ-rule represents the fact that every possible world Ò has its successor Ò ½ Since the interpretation of Å in the world Ò is identical to the one of Å in the world Ò ½, Å is valid whenever so is Å The Eµ-rule allows us to derive Ü Ý ÜÝ µ for every and Therefore, µ and are logically equivalent, even though not equivalent as sets of -terms Note that µ, but µ Example 72 We can derive Curry s fixed-point combinator Y in ; more precisely, the following is derivable Ü Üܵµ Ü Üܵµ µ Let a formula and a derivation as follows: (var) Then, we can derive Y as follows: Ü Ü (var) Ü Ü µ Ü Üܵ Ü Üܵ (I) Ü Üܵ (³) Ü ÜÜ Ü Ü (var) Ü Ü () (E) Ü Üܵ Ü Üܵ Ü Üܵµ Ü Üܵµ Ü Üܵµ Ü Üܵµ µ (I) We can also observe that Turing s fixed point combinator Ü ÜÜ µµ Ü ÜÜ µµ has the same type The type µ gives a concise axiomatic meaning to the fixed point combinators; it says that they can produce an element of with a given function that works as an information pump from to ; in other words, they provide the induction scheme discussed in Introduction The type thus enables us to construct recursive programs using the fixed point combinators without analyzing their computational behavior We will see some examples of such recursive programs in Section 14 () (E) (E) 21

22 8 Basic properties of The typing system enjoys some basic properties such as subject reduction property Proposition 81 If Å is derivable, then Î Å µ ÓÑ µ Proof By straightforward induction on the derivation of Å Proposition 82 Let Ü ½ ½ Ü ¾ ¾ Ü Ò Ò and ¼ Ü ½ ¼ ½ Ü ¾ ¼ ¾ Ü Ò ¼ Ò If Å is derivable, ¼, and ¼ for every (½ Ò), then ¼ Å ¼ is also derivable Lemma 83 Let ½ and ¾ be typing contexts such that ÓÑ ½ µ ÓÑ ¾ µ If ½ ¾ derivable, then so is ½ ¾ Å Å is Proof By induction on the derivation Use the property - µ-rule for the case that the last rule is Iµ Lemma 84 (Substitution lemma) If Ü Å and Æ are derivable, then so is Å ÆÜ Proof By induction on the derivation of ½ Ü Å, and by cases of the last rule Use Lemma 83 when the last rule is µ Theorem 85 (Subject reduction) If Å is derivable and Å Å ¼, then Å ¼ is derivable Proof By induction on the structure of Å Suppose that Å Å ¼ We show that Å ¼ by cases of the form of Å Most of the cases are straight forward In the case that Å Å ½ Å ¾ for some Å ½ and Å ¾, the derivation of Å must end with: Å ½ Å ¾ () zero or more µ or Å ½ Å ¾ () Å ½ Ò µ Å ¾ Ò Å ½ Å ¾ Ò zero or more µ Å ½ Å ¾ () (E) for some Ò, and such that Ò In the former case, Å ¼ is derivable by µ and µ So we concentrate on the latter case If ³, then Å ¼ is derivable by µ and µ Therefore, we also assume that ³ in the sequel Since Å ½ Å ¾ Å ¼, there are three possible cases as follows: (a) Å ½ Å ¼ ½ and Å ¼ Å ¼ ½Å ¾ for some Å ¼ ½ (b) Å ¾ Å ¼ ¾ and Å ¼ Å ½ Å ¼ ¾ for some Å ¼ ¾ (c) Å ½ Ý Ä and Å ¼ ÄÅ ¾ Ý for some Ý and Ä By the induction hypothesis, we have the derivations of Å ¼ ½ Ò µ and Å ¼ ¾ Ò for (a) and (b), respectively Therefore, we get the derivation of Å ¼ Ò by applying Eµ, and then Å ¼ by µ in these cases As for (c), since Ò µ, the derivation of Ý Ä Ò µ must end with: Ý Ä (I) Ý Ä zero or more µ Ý Ä Ò µ for some and such that Ò µ Since we now have the assumption ³, by Proposition 69, there exist some Ñ,, Ð, ¼ and ¼ such that: ³ Ñ ¼ ¼ µ, 22

23 Ñ Ò, Ð ¼ and Ð ¼ Obviously Ñ ¼ by Proposition 515; and ³ ¼ and ³ ¼ by Proposition 5142 because we get ¼ ³ from ³ and Ð ¼ Therefore, Ò Ð Ò ¼ ³ Ð Ò and (18) Ð Ò ³ Ð Ò ¼ Ò (19) On the other hand, we get a derivation of Ý Ð Ò Ä Ð Ò from the one of Ý Ä by Lemma 83 Since Å ¾ Ò is derivable, so is Å ¾ Ð Ò by (18) We so get ÄÅ ¾ Ü Ð Ò by Lemma 84, and then, ÄÅ ¾ Ü Ò by (19) Finally, we get ÄÅ ¾ Ü by applying µ 9 Interpretations of types Definition 91 Let Ì Ú be a partially ordered set We define a set Ì Úµ of infinite sequences of elements of Ì as follows: Ì Úµ Ø ¼ Ø ½ Ø ¾ Ø Ø ½ Ú Ø ¾ Ì for every We denote the -th element of Ø ¾ Ì Úµ by Ø Note that Ø starts with its 0-th element Ø ¼ We extend Ú to Ì Úµ as: Ø Ú if and only if Ø Ú for every We also define Ú, Ú, Ú,, and as follows: Ø Ú if and only if Ø Ú Ø Ú if and only if Ø Ð Ú Ð for every Ð Ø Ú if and only if Ø Ð Ú Ð for every Ð Ø if and only if Ø Ø if and only if Ø Ð Ð for every Ð Ø if and only if Ø Ð Ð for every Ð Definition 92 Let Ì Ú is a partially ordered set with the least element Ì Let Ø Ø ¼ Ø ½ Ø ¾ be an element of Ì Úµ, and Ò a non-negative integer We define an element Ø Ò of Ì Úµ as follows: Ø Ò µ Ø (if Ò) Ì (if Ò ) Definition 93 Let Ì Ú is a partially ordered set with the greatest element Ì We define an element Ì Úµ of Ì Úµ as follows: Ì Úµ µ Ì We often write instead of Ì Úµ when Ì and Ú is clear from the context Definition 94 (Interpretations of types) An interpretation of types is a tuple Ì Ú such that: (i1) Ì Ú is a partially ordered set with the least element Ì and the greatest element Ì (i2) TConst Ì Úµ (i3) Ì Úµ Ì Úµ (i4) If Ø then ص µ (i5) Ì Úµ Ì Úµ Ì Úµ (i6) If Ø ¼ Ø and ¼, then Ø Ø ¼ ¼ (t1) µ 23

Scan Scheduling Specification and Analysis

Scan Scheduling Specification and Analysis Scan Scheduling Specification and Analysis Bruno Dutertre System Design Laboratory SRI International Menlo Park, CA 94025 May 24, 2000 This work was partially funded by DARPA/AFRL under BAE System subcontract

More information

SFU CMPT Lecture: Week 8

SFU CMPT Lecture: Week 8 SFU CMPT-307 2008-2 1 Lecture: Week 8 SFU CMPT-307 2008-2 Lecture: Week 8 Ján Maňuch E-mail: jmanuch@sfu.ca Lecture on June 24, 2008, 5.30pm-8.20pm SFU CMPT-307 2008-2 2 Lecture: Week 8 Universal hashing

More information

RSA (Rivest Shamir Adleman) public key cryptosystem: Key generation: Pick two large prime Ô Õ ¾ numbers È.

RSA (Rivest Shamir Adleman) public key cryptosystem: Key generation: Pick two large prime Ô Õ ¾ numbers È. RSA (Rivest Shamir Adleman) public key cryptosystem: Key generation: Pick two large prime Ô Õ ¾ numbers È. Let Ò Ô Õ. Pick ¾ ½ ³ Òµ ½ so, that ³ Òµµ ½. Let ½ ÑÓ ³ Òµµ. Public key: Ò µ. Secret key Ò µ.

More information

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions. THREE LECTURES ON BASIC TOPOLOGY PHILIP FOTH 1. Basic notions. Let X be a set. To make a topological space out of X, one must specify a collection T of subsets of X, which are said to be open subsets of

More information

RSA (Rivest Shamir Adleman) public key cryptosystem: Key generation: Pick two large prime Ô Õ ¾ numbers È.

RSA (Rivest Shamir Adleman) public key cryptosystem: Key generation: Pick two large prime Ô Õ ¾ numbers È. RSA (Rivest Shamir Adleman) public key cryptosystem: Key generation: Pick two large prime Ô Õ ¾ numbers È. Let Ò Ô Õ. Pick ¾ ½ ³ Òµ ½ so, that ³ Òµµ ½. Let ½ ÑÓ ³ Òµµ. Public key: Ò µ. Secret key Ò µ.

More information

Response Time Analysis of Asynchronous Real-Time Systems

Response Time Analysis of Asynchronous Real-Time Systems Response Time Analysis of Asynchronous Real-Time Systems Guillem Bernat Real-Time Systems Research Group Department of Computer Science University of York York, YO10 5DD, UK Technical Report: YCS-2002-340

More information

1.3. Conditional expressions To express case distinctions like

1.3. Conditional expressions To express case distinctions like Introduction Much of the theory developed in the underlying course Logic II can be implemented in a proof assistant. In the present setting this is interesting, since we can then machine extract from a

More information

SFU CMPT Lecture: Week 9

SFU CMPT Lecture: Week 9 SFU CMPT-307 2008-2 1 Lecture: Week 9 SFU CMPT-307 2008-2 Lecture: Week 9 Ján Maňuch E-mail: jmanuch@sfu.ca Lecture on July 8, 2008, 5.30pm-8.20pm SFU CMPT-307 2008-2 2 Lecture: Week 9 Binary search trees

More information

On the Performance of Greedy Algorithms in Packet Buffering

On the Performance of Greedy Algorithms in Packet Buffering On the Performance of Greedy Algorithms in Packet Buffering Susanne Albers Ý Markus Schmidt Þ Abstract We study a basic buffer management problem that arises in network switches. Consider input ports,

More information

From Tableaux to Automata for Description Logics

From Tableaux to Automata for Description Logics Fundamenta Informaticae XX (2003) 1 33 1 IOS Press From Tableaux to Automata for Description Logics Franz Baader, Jan Hladik, and Carsten Lutz Theoretical Computer Science, TU Dresden, D-01062 Dresden,

More information

An Abstraction Algorithm for the Verification of Level-Sensitive Latch-Based Netlists

An Abstraction Algorithm for the Verification of Level-Sensitive Latch-Based Netlists An Abstraction Algorithm for the Verification of Level-Sensitive Latch-Based Netlists Jason Baumgartner ½, Tamir Heyman ¾, Vigyan Singhal, and Adnan Aziz ½ IBM Enterprise Systems Group, Austin, Texas 78758,

More information

Chapter 3: Propositional Languages

Chapter 3: Propositional Languages Chapter 3: Propositional Languages We define here a general notion of a propositional language. We show how to obtain, as specific cases, various languages for propositional classical logic and some non-classical

More information

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic 3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax

More information

Structure and Complexity in Planning with Unary Operators

Structure and Complexity in Planning with Unary Operators Structure and Complexity in Planning with Unary Operators Carmel Domshlak and Ronen I Brafman ½ Abstract In this paper we study the complexity of STRIPS planning when operators have a single effect In

More information

From Static to Dynamic Routing: Efficient Transformations of Store-and-Forward Protocols

From Static to Dynamic Routing: Efficient Transformations of Store-and-Forward Protocols From Static to Dynamic Routing: Efficient Transformations of Store-and-Forward Protocols Christian Scheideler Ý Berthold Vöcking Þ Abstract We investigate how static store-and-forward routing algorithms

More information

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

CHAPTER 8. Copyright Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS Copyright Cengage Learning. All rights reserved. SECTION 8.3 Equivalence Relations Copyright Cengage Learning. All rights reserved. The Relation Induced by a Partition 3 The Relation

More information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

A General Greedy Approximation Algorithm with Applications

A General Greedy Approximation Algorithm with Applications A General Greedy Approximation Algorithm with Applications Tong Zhang IBM T.J. Watson Research Center Yorktown Heights, NY 10598 tzhang@watson.ibm.com Abstract Greedy approximation algorithms have been

More information

Efficiency versus Convergence of Boolean Kernels for On-Line Learning Algorithms

Efficiency versus Convergence of Boolean Kernels for On-Line Learning Algorithms Efficiency versus Convergence of Boolean Kernels for On-Line Learning Algorithms Roni Khardon Tufts University Medford, MA 02155 roni@eecs.tufts.edu Dan Roth University of Illinois Urbana, IL 61801 danr@cs.uiuc.edu

More information

End-to-end bandwidth guarantees through fair local spectrum share in wireless ad-hoc networks

End-to-end bandwidth guarantees through fair local spectrum share in wireless ad-hoc networks End-to-end bandwidth guarantees through fair local spectrum share in wireless ad-hoc networks Saswati Sarkar and Leandros Tassiulas 1 Abstract Sharing the locally common spectrum among the links of the

More information

CS4215 Programming Language Implementation. Martin Henz

CS4215 Programming Language Implementation. Martin Henz CS4215 Programming Language Implementation Martin Henz Thursday 26 January, 2012 2 Chapter 4 The Language simpl In this chapter, we are exting the language epl in order to provide a more powerful programming

More information

Optimal Time Bounds for Approximate Clustering

Optimal Time Bounds for Approximate Clustering Optimal Time Bounds for Approximate Clustering Ramgopal R. Mettu C. Greg Plaxton Department of Computer Science University of Texas at Austin Austin, TX 78712, U.S.A. ramgopal, plaxton@cs.utexas.edu Abstract

More information

A New Type System for Secure Information Flow

A New Type System for Secure Information Flow A New Type System for Secure Information Flow Geoffrey Smith School of Computer Science Florida International University Miami, Florida 33199, USA smithg@cs.fiu.edu Abstract With the variables of a program

More information

Competitive Analysis of On-line Algorithms for On-demand Data Broadcast Scheduling

Competitive Analysis of On-line Algorithms for On-demand Data Broadcast Scheduling Competitive Analysis of On-line Algorithms for On-demand Data Broadcast Scheduling Weizhen Mao Department of Computer Science The College of William and Mary Williamsburg, VA 23187-8795 USA wm@cs.wm.edu

More information

CS 6110 S14 Lecture 1 Introduction 24 January 2014

CS 6110 S14 Lecture 1 Introduction 24 January 2014 CS 6110 S14 Lecture 1 Introduction 24 January 2014 1 Introduction What is a program? Is it just something that tells the computer what to do? Yes, but there is much more to it than that. The basic expressions

More information

Lecture Notes on Data Representation

Lecture Notes on Data Representation Lecture Notes on Data Representation 15-814: Types and Programming Languages Frank Pfenning Lecture 9 Tuesday, October 2, 2018 1 Introduction In this lecture we ll see our type system in action. In particular

More information

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

STABILITY AND PARADOX IN ALGORITHMIC LOGIC STABILITY AND PARADOX IN ALGORITHMIC LOGIC WAYNE AITKEN, JEFFREY A. BARRETT Abstract. Algorithmic logic is the logic of basic statements concerning algorithms and the algorithmic rules of deduction between

More information

The Typed λ Calculus and Type Inferencing in ML

The Typed λ Calculus and Type Inferencing in ML Notes on Types S. Arun-Kumar Department of Computer Science and Engineering Indian Institute of Technology New Delhi, 110016 email: sak@cse.iitd.ernet.in April 14, 2002 2 Chapter 1 The Typed λ Calculus

More information

Semantic Subtyping. Alain Frisch (ENS Paris) Giuseppe Castagna (ENS Paris) Véronique Benzaken (LRI U Paris Sud)

Semantic Subtyping.  Alain Frisch (ENS Paris) Giuseppe Castagna (ENS Paris) Véronique Benzaken (LRI U Paris Sud) Semantic Subtyping Alain Frisch (ENS Paris) Giuseppe Castagna (ENS Paris) Véronique Benzaken (LRI U Paris Sud) http://www.cduce.org/ Semantic Subtyping - Groupe de travail BD LRI p.1/28 CDuce A functional

More information

Exponentiated Gradient Algorithms for Large-margin Structured Classification

Exponentiated Gradient Algorithms for Large-margin Structured Classification Exponentiated Gradient Algorithms for Large-margin Structured Classification Peter L. Bartlett U.C.Berkeley bartlett@stat.berkeley.edu Ben Taskar Stanford University btaskar@cs.stanford.edu Michael Collins

More information

1 Introduction. 3 Syntax

1 Introduction. 3 Syntax CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,

More information

Probabilistic analysis of algorithms: What s it good for?

Probabilistic analysis of algorithms: What s it good for? Probabilistic analysis of algorithms: What s it good for? Conrado Martínez Univ. Politècnica de Catalunya, Spain February 2008 The goal Given some algorithm taking inputs from some set Á, we would like

More information

Modal Logic: Implications for Design of a Language for Distributed Computation p.1/53

Modal Logic: Implications for Design of a Language for Distributed Computation p.1/53 Modal Logic: Implications for Design of a Language for Distributed Computation Jonathan Moody (with Frank Pfenning) Department of Computer Science Carnegie Mellon University Modal Logic: Implications for

More information

Introduction to Sets and Logic (MATH 1190)

Introduction to Sets and Logic (MATH 1190) Introduction to Sets and Logic () Instructor: Email: shenlili@yorku.ca Department of Mathematics and Statistics York University Dec 4, 2014 Outline 1 2 3 4 Definition A relation R from a set A to a set

More information

Propositional Logic. Part I

Propositional Logic. Part I Part I Propositional Logic 1 Classical Logic and the Material Conditional 1.1 Introduction 1.1.1 The first purpose of this chapter is to review classical propositional logic, including semantic tableaux.

More information

Subsumption. Principle of safe substitution

Subsumption. Principle of safe substitution Recap on Subtyping Subsumption Some types are better than others, in the sense that a value of one can always safely be used where a value of the other is expected. Which can be formalized as by introducing:

More information

Constrained Types and their Expressiveness

Constrained Types and their Expressiveness Constrained Types and their Expressiveness JENS PALSBERG Massachusetts Institute of Technology and SCOTT SMITH Johns Hopkins University A constrained type consists of both a standard type and a constraint

More information

Formal Systems and their Applications

Formal Systems and their Applications Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction

More information

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation

More information

9.5 Equivalence Relations

9.5 Equivalence Relations 9.5 Equivalence Relations You know from your early study of fractions that each fraction has many equivalent forms. For example, 2, 2 4, 3 6, 2, 3 6, 5 30,... are all different ways to represent the same

More information

EXTENSIONS OF FIRST ORDER LOGIC

EXTENSIONS OF FIRST ORDER LOGIC EXTENSIONS OF FIRST ORDER LOGIC Maria Manzano University of Barcelona CAMBRIDGE UNIVERSITY PRESS Table of contents PREFACE xv CHAPTER I: STANDARD SECOND ORDER LOGIC. 1 1.- Introduction. 1 1.1. General

More information

Part III. Chapter 15: Subtyping

Part III. Chapter 15: Subtyping Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule

More information

AXIOMS FOR THE INTEGERS

AXIOMS FOR THE INTEGERS AXIOMS FOR THE INTEGERS BRIAN OSSERMAN We describe the set of axioms for the integers which we will use in the class. The axioms are almost the same as what is presented in Appendix A of the textbook,

More information

(Refer Slide Time: 4:00)

(Refer Slide Time: 4:00) Principles of Programming Languages Dr. S. Arun Kumar Department of Computer Science & Engineering Indian Institute of Technology, Delhi Lecture - 38 Meanings Let us look at abstracts namely functional

More information

Power Set of a set and Relations

Power Set of a set and Relations Power Set of a set and Relations 1 Power Set (1) Definition: The power set of a set S, denoted P(S), is the set of all subsets of S. Examples Let A={a,b,c}, P(A)={,{a},{b},{c},{a,b},{b,c},{a,c},{a,b,c}}

More information

Properly Colored Paths and Cycles in Complete Graphs

Properly Colored Paths and Cycles in Complete Graphs 011 ¼ 9 È È 15 ± 3 ¾ Sept., 011 Operations Research Transactions Vol.15 No.3 Properly Colored Paths and Cycles in Complete Graphs Wang Guanghui 1 ZHOU Shan Abstract Let K c n denote a complete graph on

More information

Typed Lambda Calculus

Typed Lambda Calculus Department of Linguistics Ohio State University Sept. 8, 2016 The Two Sides of A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a system of notation for functions

More information

MA651 Topology. Lecture 4. Topological spaces 2

MA651 Topology. Lecture 4. Topological spaces 2 MA651 Topology. Lecture 4. Topological spaces 2 This text is based on the following books: Linear Algebra and Analysis by Marc Zamansky Topology by James Dugundgji Fundamental concepts of topology by Peter

More information

Relating Strands and Multiset Rewriting for Security Protocol Analysis Revised Extended Abstract Ý

Relating Strands and Multiset Rewriting for Security Protocol Analysis Revised Extended Abstract Ý Relating Strands and Multiset Rewriting for Security Protocol Analysis Revised Extended Abstract Ý I. Cervesato ITT Industries iliano@itd.nrl.navy.mil N. Durgin, J. Mitchell Stanford University nad, jcm@cs.stanford.edu

More information

Type Systems COMP 311 Rice University Houston, Texas

Type Systems COMP 311 Rice University Houston, Texas Rice University Houston, Texas 1 Type Systems for Programming Language were invented by mathematicians before electronic computers were invented. What is a type? A meaningful subset of the set of the domain

More information

Reflection in the Chomsky Hierarchy

Reflection in the Chomsky Hierarchy Reflection in the Chomsky Hierarchy Henk Barendregt Venanzio Capretta Dexter Kozen 1 Introduction We investigate which classes of formal languages in the Chomsky hierarchy are reflexive, that is, contain

More information

Foundations of Computer Science Spring Mathematical Preliminaries

Foundations of Computer Science Spring Mathematical Preliminaries Foundations of Computer Science Spring 2017 Equivalence Relation, Recursive Definition, and Mathematical Induction Mathematical Preliminaries Mohammad Ashiqur Rahman Department of Computer Science College

More information

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings On the Relationships between Zero Forcing Numbers and Certain Graph Coverings Fatemeh Alinaghipour Taklimi, Shaun Fallat 1,, Karen Meagher 2 Department of Mathematics and Statistics, University of Regina,

More information

Database Languages and their Compilers

Database Languages and their Compilers Database Languages and their Compilers Prof. Dr. Torsten Grust Database Systems Research Group U Tübingen Winter 2010 2010 T. Grust Database Languages and their Compilers 4 Query Normalization Finally,

More information

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points MC 0 GRAPH THEORY 0// Solutions to HW # 0 points + XC points ) [CH] p.,..7. This problem introduces an important class of graphs called the hypercubes or k-cubes, Q, Q, Q, etc. I suggest that before you

More information

Directed Single Source Shortest Paths in Linear Average Case Time

Directed Single Source Shortest Paths in Linear Average Case Time Directed Single Source Shortest Paths in inear Average Case Time Ulrich Meyer MPI I 2001 1-002 May 2001 Author s Address ÍÐÖ ÅÝÖ ÅܹÈÐÒ¹ÁÒ ØØÙØ ĐÙÖ ÁÒÓÖÑØ ËØÙÐ ØÞÒÙ Û ½¾ ËÖÖĐÙÒ umeyer@mpi-sb.mpg.de www.uli-meyer.de

More information

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections p.

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections p. CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections 10.1-10.3 p. 1/106 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer

More information

Part III Chapter 15: Subtyping

Part III Chapter 15: Subtyping Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule

More information

Graphs (MTAT , 4 AP / 6 ECTS) Lectures: Fri 12-14, hall 405 Exercises: Mon 14-16, hall 315 või N 12-14, aud. 405

Graphs (MTAT , 4 AP / 6 ECTS) Lectures: Fri 12-14, hall 405 Exercises: Mon 14-16, hall 315 või N 12-14, aud. 405 Graphs (MTAT.05.080, 4 AP / 6 ECTS) Lectures: Fri 12-14, hall 405 Exercises: Mon 14-16, hall 315 või N 12-14, aud. 405 homepage: http://www.ut.ee/~peeter_l/teaching/graafid08s (contains slides) For grade:

More information

Typed Lambda Calculus for Syntacticians

Typed Lambda Calculus for Syntacticians Department of Linguistics Ohio State University January 12, 2012 The Two Sides of Typed Lambda Calculus A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a

More information

Worst-Case Utilization Bound for EDF Scheduling on Real-Time Multiprocessor Systems

Worst-Case Utilization Bound for EDF Scheduling on Real-Time Multiprocessor Systems Worst-Case Utilization Bound for EDF Scheduling on Real-Time Multiprocessor Systems J.M. López, M. García, J.L. Díaz, D.F. García University of Oviedo Department of Computer Science Campus de Viesques,

More information

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C. 219 Lemma J For all languages A, B, C the following hold i. A m A, (reflexive) ii. if A m B and B m C, then A m C, (transitive) iii. if A m B and B is Turing-recognizable, then so is A, and iv. if A m

More information

Recursive Types and Subtyping

Recursive Types and Subtyping Recursive Types and Subtyping #1 One-Slide Summary Recursive types (e.g., list) make the typed lambda calculus as powerful as the untyped lambda calculus. If is a subtype of then any expression of type

More information

3.7 Denotational Semantics

3.7 Denotational Semantics 3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam

More information

Handout 9: Imperative Programs and State

Handout 9: Imperative Programs and State 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 9: Imperative Programs and State Imperative

More information

Designing Networks Incrementally

Designing Networks Incrementally Designing Networks Incrementally Adam Meyerson Kamesh Munagala Ý Serge Plotkin Þ Abstract We consider the problem of incrementally designing a network to route demand to a single sink on an underlying

More information

3 No-Wait Job Shops with Variable Processing Times

3 No-Wait Job Shops with Variable Processing Times 3 No-Wait Job Shops with Variable Processing Times In this chapter we assume that, on top of the classical no-wait job shop setting, we are given a set of processing times for each operation. We may select

More information

The self-minor conjecture for infinite trees

The self-minor conjecture for infinite trees The self-minor conjecture for infinite trees Julian Pott Abstract We prove Seymour s self-minor conjecture for infinite trees. 1. Introduction P. D. Seymour conjectured that every infinite graph is a proper

More information

On-line multiplication in real and complex base

On-line multiplication in real and complex base On-line multiplication in real complex base Christiane Frougny LIAFA, CNRS UMR 7089 2 place Jussieu, 75251 Paris Cedex 05, France Université Paris 8 Christiane.Frougny@liafa.jussieu.fr Athasit Surarerks

More information

Faster parameterized algorithms for Minimum Fill-In

Faster parameterized algorithms for Minimum Fill-In Faster parameterized algorithms for Minimum Fill-In Hans L. Bodlaender Pinar Heggernes Yngve Villanger Technical Report UU-CS-2008-042 December 2008 Department of Information and Computing Sciences Utrecht

More information

Lecture 9: Typed Lambda Calculus

Lecture 9: Typed Lambda Calculus Advanced Topics in Programming Languages Spring Semester, 2012 Lecture 9: Typed Lambda Calculus May 8, 2012 Lecturer: Mooly Sagiv Scribe: Guy Golan Gueta and Shachar Itzhaky 1 Defining a Type System for

More information

Discrete Mathematics Lecture 4. Harper Langston New York University

Discrete Mathematics Lecture 4. Harper Langston New York University Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a

More information

Computing optimal linear layouts of trees in linear time

Computing optimal linear layouts of trees in linear time Computing optimal linear layouts of trees in linear time Konstantin Skodinis University of Passau, 94030 Passau, Germany, e-mail: skodinis@fmi.uni-passau.de Abstract. We present a linear time algorithm

More information

PHANTOM TYPES AND SUBTYPING

PHANTOM TYPES AND SUBTYPING PHANTOM TYPES AND SUBTYPING Matthew Fluet and Riccardo Pucella Department of Computer Science Cornell University ßfluet,riccardoÐ@cs.cornell.edu Abstract We investigate a technique from the literature,

More information

Lesson 4 Typed Arithmetic Typed Lambda Calculus

Lesson 4 Typed Arithmetic Typed Lambda Calculus Lesson 4 Typed Arithmetic Typed Lambda 1/28/03 Chapters 8, 9, 10 Outline Types for Arithmetic types the typing relation safety = progress + preservation The simply typed lambda calculus Function types

More information

Time-space tradeoff lower bounds for randomized computation of decision problems

Time-space tradeoff lower bounds for randomized computation of decision problems Time-space tradeoff lower bounds for randomized computation of decision problems Paul Beame Ý Computer Science and Engineering University of Washington Seattle, WA 98195-2350 beame@cs.washington.edu Xiaodong

More information

Topology and Topological Spaces

Topology and Topological Spaces Topology and Topological Spaces Mathematical spaces such as vector spaces, normed vector spaces (Banach spaces), and metric spaces are generalizations of ideas that are familiar in R or in R n. For example,

More information

Negations in Refinement Type Systems

Negations in Refinement Type Systems Negations in Refinement Type Systems T. Tsukada (U. Tokyo) 14th March 2016 Shonan, JAPAN This Talk About refinement intersection type systems that refute judgements of other type systems. Background Refinement

More information

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph. Trees 1 Introduction Trees are very special kind of (undirected) graphs. Formally speaking, a tree is a connected graph that is acyclic. 1 This definition has some drawbacks: given a graph it is not trivial

More information

Lecture Notes on Program Equivalence

Lecture Notes on Program Equivalence Lecture Notes on Program Equivalence 15-312: Foundations of Programming Languages Frank Pfenning Lecture 24 November 30, 2004 When are two programs equal? Without much reflection one might say that two

More information

arxiv:submit/ [math.co] 9 May 2011

arxiv:submit/ [math.co] 9 May 2011 arxiv:submit/0243374 [math.co] 9 May 2011 Connectivity and tree structure in finite graphs J. Carmesin R. Diestel F. Hundertmark M. Stein 6 May, 2011 Abstract We prove that, for every integer k 0, every

More information

Discharging and reducible configurations

Discharging and reducible configurations Discharging and reducible configurations Zdeněk Dvořák March 24, 2018 Suppose we want to show that graphs from some hereditary class G are k- colorable. Clearly, we can restrict our attention to graphs

More information

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np Chapter 1: Introduction Introduction Purpose of the Theory of Computation: Develop formal mathematical models of computation that reflect real-world computers. Nowadays, the Theory of Computation can be

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Operational Semantics CMSC 330 Summer 2018 1 Formal Semantics of a Prog. Lang. Mathematical description of the meaning of programs written in that language

More information

1 The language χ. Models of Computation

1 The language χ. Models of Computation Bengt Nordström, 1 2017-10-13 Department of Computing Science, Chalmers and University of Göteborg, Göteborg, Sweden 1 The language χ The main purpose of the language χ is to illustrate some basic results

More information

Comparing Data Compression in Web-based Animation Models using Kolmogorov Complexity

Comparing Data Compression in Web-based Animation Models using Kolmogorov Complexity Comparing Data Compression in Web-based Animation Models using Kolmogorov Complexity Carlos A. P. Campani, Fernando Accorsi, Paulo Blauth Menezes and Luciana Porcher Nedel Abstract In the last few years,

More information

Bootcamp. Christoph Thiele. Summer An example of a primitive universe

Bootcamp. Christoph Thiele. Summer An example of a primitive universe Bootcamp Christoph Thiele Summer 2012 0.1 An example of a primitive universe A primitive universe consists of primitive objects and primitive sets. This allows to form primitive statements as to which

More information

Math 5593 Linear Programming Lecture Notes

Math 5593 Linear Programming Lecture Notes Math 5593 Linear Programming Lecture Notes Unit II: Theory & Foundations (Convex Analysis) University of Colorado Denver, Fall 2013 Topics 1 Convex Sets 1 1.1 Basic Properties (Luenberger-Ye Appendix B.1).........................

More information

Introduction to Homotopy Type Theory

Introduction to Homotopy Type Theory Introduction to Homotopy Type Theory Lecture notes for a course at EWSCS 2017 Thorsten Altenkirch March 5, 2017 1 What is this course about? To explain what Homotopy Type Theory is, I will first talk about

More information

Module 11. Directed Graphs. Contents

Module 11. Directed Graphs. Contents Module 11 Directed Graphs Contents 11.1 Basic concepts......................... 256 Underlying graph of a digraph................ 257 Out-degrees and in-degrees.................. 258 Isomorphism..........................

More information

Runtime Behavior of Conversion Interpretation of Subtyping

Runtime Behavior of Conversion Interpretation of Subtyping Runtime Behavior of Conversion Interpretation of Subtyping Yasuhiko Minamide Institute of Information Sciences and Electronics University of Tsukuba and PRESTO, JST minamide@is.tsukuba.ac.jp Abstract.

More information

Ma/CS 6b Class 26: Art Galleries and Politicians

Ma/CS 6b Class 26: Art Galleries and Politicians Ma/CS 6b Class 26: Art Galleries and Politicians By Adam Sheffer The Art Gallery Problem Problem. We wish to place security cameras at a gallery, such that they cover it completely. Every camera can cover

More information

Formal semantics of loosely typed languages. Joep Verkoelen Vincent Driessen

Formal semantics of loosely typed languages. Joep Verkoelen Vincent Driessen Formal semantics of loosely typed languages Joep Verkoelen Vincent Driessen June, 2004 ii Contents 1 Introduction 3 2 Syntax 5 2.1 Formalities.............................. 5 2.2 Example language LooselyWhile.................

More information

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e

More information

On the Analysis of Interacting Pushdown Systems

On the Analysis of Interacting Pushdown Systems On the Analysis of Interacting Pushdown Systems Vineet Kahlon NEC Labs America, Princeton, NJ 08540, USA. ÐÓÒҹРºÓÑ Aarti Gupta NEC Labs America, Princeton, NJ 08540, USA. ÙÔØҹРºÓÑ Abstract Pushdown

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam

More information

Computer Science 236 Fall Nov. 11, 2010

Computer Science 236 Fall Nov. 11, 2010 Computer Science 26 Fall Nov 11, 2010 St George Campus University of Toronto Assignment Due Date: 2nd December, 2010 1 (10 marks) Assume that you are given a file of arbitrary length that contains student

More information

Programming Languages Fall 2014

Programming Languages Fall 2014 Programming Languages Fall 2014 Lecture 7: Simple Types and Simply-Typed Lambda Calculus Prof. Liang Huang huang@qc.cs.cuny.edu 1 Types stuck terms? how to fix it? 2 Plan First I For today, we ll go back

More information

Lower bounds and recursive methods for the problem of adjudicating conflicting claims

Lower bounds and recursive methods for the problem of adjudicating conflicting claims Lower bounds and recursive methods for the problem of adjudicating conflicting claims Diego Dominguez University of Rochester March 31, 006 Abstract For the problem of adjudicating conflicting claims,

More information