Backwards Strictness Analysis: Proved and Improved. Kei Davis. Philip Wadler. University of Glasgow. Glasgow G12 8QQ. Abstract

Size: px
Start display at page:

Download "Backwards Strictness Analysis: Proved and Improved. Kei Davis. Philip Wadler. University of Glasgow. Glasgow G12 8QQ. Abstract"

Transcription

1 Backwards Strictness Analysis: Proved and Improved Kei Davis Philip Wadler Dept. of Computing Science University of Glasgow Glasgow G12 8QQ United Kingdom Abstract Given a syntax tree representing an expression, and some information regarding that expression, a backwards analysis will involve propagating the information (with appropriate transformation) towards the leaves of the tree, to yield information about the subexpressions. Here, the information at the root will describe the required denedness of the value of the expression, with the results of the analysis describing the denedness of the values lower in the tree sucient or necessary to meet the condition at the root. In Projections for Strictness Analysis [1], such an analysis is described in which the information at each node is encoded by a special kind of function called a projection, with the results of the analysis revealing strictness information about the expression. This paper describes a more general and powerful technique, and provides proofs that both techniques meet a corresponding generalisation of the safety condition described in [1]. 1 Introduction The theory developed in [1] is prerequisite to the development in this paper. To make our presentation reasonably self-contained, this introduction includes a brief summary of much of the content of [1]. A projection is an idempotent function on domains that removes information from its argument, but does not change its type. Formally, a projection is a continuous function which for every u in its domain, u v u ( u) = u Projections form a complete lattice under the ordering v, with the identity function ID as the greatest element and BOT, dened by BOT u =? for all u, as the least. (The greatest lower bound u of two projections and is dened to be the the greatest projection less than both and ; the greatest such function will not necessarily be a projection.) In this paper, and (sometimes subscripted) will always denote projections. Consider the following projections on pairs, dened for all values u and v. F (u; v) = (u;?) S (u; v) = (?; v) Then (F t S) (u; v) = (u; v) (F u S) (u; v) = (?;?) 1

2 so F t S = ID. A projection may be interpreted as specifying a degree of required denedness of its argument by regarding that part of its argument which is mapped to? as not needed, and that part left unchanged as needed. Suppose that f is a function from pairs to pairs, and that we are only concerned with the rst component of the result of some application of f. Then that instance of f may be safely replaced by F f. Here the composition with F serves to make explicit the requirement (or lack thereof) on the result of f; f is said to be evaluated in context F (the terms context and projection will be used interchangably.) The context in which a function is evaluated may allow its argument to be less dened than in the general case. For example, suppose that f (u; v) = (v; u): Then for f in context F it is safe to apply S to its argument, that is, F f = F f S: If for projections and we have f = f, we write f : ). It is easy to show that f : ) i f v f : Here may be thought of as a conservative estimate of what information may be discarded from the argument of f without aecting the result, assuming some amount of information to be discarded from the result. Note that is is not uniquely determined by f and, since, for example, for any f and, f : ) ID. So far we have shown how projections might be used to specify how much of an argument to a function is sucient in a particular context, but not how much of the argument is necessary, that is, in what part of its argument a function is strict. We wish additionally to encode in a projection the information that a value must have some minimum degree of denedness, that is, that some part of the value must be more dened than?. To specify necessity with projections we extend our domains by the addition of a new element that we will call?. We will interpret u =?to mean that requires a value more dened than u. All functions will be strict in?, that is, that f?=?for all f. Simple strictness is dened with the projection STR, where STR maps? to?, but acts as the identity on all other values. Since STR is a projection we must have STR? v?; since?6=?, it must be that?<?. Thus?is a new bottom element to be added to every domain D; this new domain is just D lifted, written D?. Every function f : D 1! D2 is extended to a function in D1?! D 2? by making f strict in?. We can use STR to dene strictness: Another useful projection is ABS, dened by f : STR ) STR i f is strict: ABS?=? ABS u =?; u 6=? If f makes no use of its argument, then f : STR ) ABS. Also, for all f, f : ABS ) ABS. The least projection FAIL is dened by FAIL u =?; all u Since every function is strict in?, we have that for all f, f : FAIL ) FAIL.

3 For projection, STR u will be called the strict part of ; if is equal to its strict part then will be called strict. The nonstrict form of is t ABS. We need only consider strictness analysis in a strict context, since for all f and, if f : ( u STR) ) then f : ( t ABS) ) ( t ABS) The discussion so far generalises to functions of several arguments, but the notation f : ) is no longer adequate since we will want to consider separate projections to be applied to each of the arguments of f. We dene an operator & to be the same as t except strict in?. That is u & v = u t v; u 6=?and v 6=? =? ; u =?or v =? Each of the operators t and & distributes over the another. Other useful projections are those that require constructor values. For any sum-ofproducts type with constructors c1; : : :; c m, any strict projection on that type can be expressed as the least upper bound of projections P1; : : :; P m, where P i (c j v1 : : : v aj ) =?; i 6= j However, we will restrict our treatment to projections of the form C i 1 : : : mi where C i 1 : : : ai (c j v1 : : : v aj ) = c j (1 v1) : : : ( aj c aj ); i = j =? ; i 6= j and the lub's of sets of these projections. For each type, this restricted set of projections forms a complete lattice, and any element can be expressed as FAIL or F m i=1 C i i;1 : : : i;ai : For all such projection functions C, (C 1 : : : a ) t (C 1 : : : a) v C (1 t 1) : : : ( a t a ) (C 1 : : : a ) & (C 1 : : : a) = C (1 & 1) : : : ( a & a ) and if any of the i is FAIL then C 1 : : : a is FAIL. Also, (C i 1 : : : ai ) & (C j 1 : : : a j ) = FAIL; i 6= j (C i 1 : : : ai ) u (C j 1 : : : a j ) = FAIL; i 6= j As an aside, this restriction excludes exactly those projections that encode an interdependence between values comprising a product type. An example is the projection on pairs of integers dened by P (1; 2) = (1; 2) P (2; 1) = (2; 1) P (x; y) =?; otherwise Finally, we will call unary functions from projections to projections projection transformers.

4 2 Expressions and Programs The analysis will be for a rst-order functional language. The abstract syntax for this language is as follows. Abstract Syntax x 2 Var c 2 Constr f 2 Fv p 2 Pfv e 2 Exp d 2 Dfns e ::= Variables Constructors Function variables Strict primitive function variables Expressions Sets of function denitions x j c e1 : : : e n j f e1 : : : e n j p e1 : : : e n j case e0 of c1 x1;1 : : : x1;a 1. c m x m;1 : : : x m;am ) e1 ) e m d ::= ff i x1 : : : x ni = e i j 1 i ng Nullary primitive functions and nullary constructors will provide constants in the language. The following semantics is given for this language. Semantic Domains Val = Bool + P n i=1(c i Val a i ) fc i j 1 i ng a set of constructors, c i has arity a i LVal = Val? domain for strictness analysis Fun = S 1 i=0 (LVal i! LVal) rst order functions Fenv = Fv! Fun function variable environment Venv = Var! LVal bound variable environment Semantic Functions E E dfns C P :: Exp! Venv! Fenv! LVal :: Dfns! Fenv :: Constr! Fun :: Pfv! Fun In the following and in the rest of the paper, the z will be used as shorthand for z1; : : :; z k, and [x=y] for [x i =y i j 1 i k], where k is implicit from the context. Extension of variable environments is denoted by juxtaposition, for example [x=y] or 12. For reasons to be made clear later, we require that if?is in the range of, then E [e] =?. Assuming that?is not in the range of, E is dened as follows.

5 E [x] = [x] E [c e1 : : : e n ] = C [c] (E [e1 ] ) : : : (E [e n ] ) E [p e1 : : : e n ] = P [p] (E [e1 ] ) : : : (E [e n ] ) E [f e1 : : : e n ] = [f ] (E [e1 ] ) : : : (E [e n ] ) E [case e0 of c1 x1;1 : : : x1;a 1 ) e1. c m x m;1 : : : x m;am ) e m ] = E [e i ] [(sel i;1 v)=x i;1; : : : ; (sel i;ai v)=x i;ai ] ; if isc i v (1 i n) =? ; otherwise where v = E [e0 ] E dfns [ff i x1 : : : x ni = e i j 1 i ng] = x (:[(y1 : : :y ni :E [e i ] [y=x] )=f i j 1 i n]) The function sel i;j for each i and j is the projection from the product type formed by the constructor c i onto its j th component, and isc i, for each i, is the discriminator that for an argument of a sum type for which one of the summands is the product type formed by the constructor c i, yields true if its argument projected onto that product type is not?, and yields false otherwise. Since every function (including the conditional) is strict in?, the least xed point of any recursive function is the constant function returning?. To avoid this we require that x in the denition of E dfns yield the least xed point (a function environment) such that each function in its range yields? rather than?whenever its arguments are all not equal to?. 3 The Semantic Function B Let e be an expression, be a function environment, be a projection transformer, and x be a variable. Then is safe for x with respect to e at if for all projections and variable environments, (E [e] ) v E [e] ([ ([x])=x]) Roughly, this states that is safe for x with respect to e at if, in the evaluation of e, using ([x]) in place of [x] gives at least as dened a result as applying to the value of e. If e were the body of the denition of the function f, and x the name of its only argument, then this condition would be exactly the same as 8:f : )

6 We consider some examples. :ID is safe for x with respect to every expression e. :FAIL is safe for x with respect to no expression e. :ABS is safe for x with respect to every expression e in which x is not free. : is safe for x with respect to x. The rst example states that it is always safe to leave the value of a variable unchanged. For the second example it is helpful to refer to the denition of safety above. The variable environment on the right-hand side of the inequality will always map x to?, so the value of the right-hand side will always be?. However, we can always choose and such that the left-hand side is at least?. The third example states that it is always safe to map variables not present in the expression to?. The fourth is easily interpreted. Our goal is to give another semantics B for expressions that yields such a. Whereas E maps an expression e to a value (an element of LVal), we expect B to map the same expression e to a projection transformer that, with respect to a given variable, is safe for e. We will carry further the idea of replacing occurrences of LVal in the type of E by the type of projection transformers to give the type of B. The variable environment for B will map variables to projection transformers, and the function environment for B will map variables to functions from projection transformers to projection transformers. Just as the function environment for E is dened in terms of E applied to a set of function denitions, the function environment for B will be analogously dened in terms of B applied to the same set of function denitions. This is summarised in the following. Semantic Domains Proj LVal! LVal projections Ptran = Proj! Proj projection transformers Ptfun = S 1 i=0 (Ptran i! Ptran) rst order functions on projection transformers Bfenv = Fv! Ptfun function variable environment Bvenv = Var! Ptran bound variable environment Semantic Functions B B dfns C B P B :: Exp! Bvenv! Bfenv! Ptran :: Prog! Bfenv :: Constr! Ptfun :: Pfv! Ptfun Before giving the denition of B, we make precise the condition that B should satisfy. Let x be a variable and e be an expression with free variables z. In the term E [e], the variable environment maps variables to values. In the corresponding term B [e], the variable environment maps each variable z i to a projection transformer that is safe for x with respect to z i. (As was shown in the examples above, if x = z i, then : is safe, otherwise :ABS is safe.) For such a, we would intend that B [e] be safe for x with respect to e. This is in fact a special case of what we require of B we generalise by requiring to map each variable z i to a projection transformer i that is safe for x with respect to a given expression e i (instead of just z i ), and requiring that B [e] be safe for x with respect to e[e=z] (instead of e[z=z], that is, e.)

7 More precisely, for all projections, expressions e with free variables z, variables x, expressions e and projection transformers such that i is safe for x with respect to e i at for each i, we require that B [e] [=z] be safe for x with respect to e[e=z] at, where for some set of function denitions d, = B dfns [d] and = E dfns [d]. This is the safety condition for B. Given such a B, then for the denition f x1 : : : x n = e dene f B by then f B = 1 : : : n : B [e] [1=x1; : : :; n =x n ] f B (:ABS) : : : (:ABS) (:) (:ABS) : : : (:ABS) is safe for x j, where (:) above is in the j th position: we reason as follows. Let the x i be the subexpressions e i of e as above. For x i 6= x j, (:ABS) is safe for x j with respect to x i, and (:) is safe for x j with respect to x j. Rules for B As shown in the in- We introduce another operator to simplify the denition of B. troduction, it is safe to set B [e] ( t ABS) = ABS t (B[e] ( u STR)) B [e] FAIL = FAIL B [e] ABS = ABS Let be strict and not FAIL, and dene by FAIL = FAIL ABS = ABS (ABS t ) = ABS t = Now the three previous statements may be summarised by the statement that it is always safe to set B [e] = B [e] ( u STR) In the denition of B this rule will be implicit, and arguments like here will be assumed to be strict and not FAIL. The same assumption will be made of all projection transformers, so that, for example, :ABS really means : ABS. We will assume that is the result of applying B dfns to some set of function denitions. We will require that for all in the range of, = ( u STR) for all projections, and that & = ( & ) for all projections and. A projection transformer with these properties will be called well behaved. Later we will show that B is well behaved if the elements of the range of its argument are; in practice this assumption poses no restriction since these elements will be such well behaved projection transformers as :ABS or :, or the results of applying B to these. For the sake of brevity, ABS will denote the environment that maps all variables to :ABS, and for all variables x, x will denote the environment that maps x to : and

8 all other variables to :ABS. B [x] = [x] B [c e1 : : : e n ] = C B [c] (B [e1 ] ) : : : (B [e n ] ) B [p e1 : : : e n ] = P B [p] (B [e1 ] ) : : : (B [e n ] ) B [f e1 : : : e n ] = [f ] (B [e1 ] ) : : : (B [e n ] ) B [case e0 of c1 x1;1 : : : x1;a 1 ) e1. c m x m;1 : : : x m;am ) e m ] = : F m i=1 ( B [e i ] [(:ABS)=x i;j j 1 j a i ] & B [e0 ] (C i (B [e i ] xi;1 ) : : : (B [e i ] xi;ai ))) B dfns [ff i x i;1 : : : x i;ni = e i j 1 i ng] = x ( :[(y1 : : : y ni :B [e i ] [y=x] )=f i j 1 i n]) For strict primitive functions p of arity n, dene P B [p] 1 : : : n = :& n i=1 B [e i ] STR For n = 0, this reduces to :abs. For a constructor c i of arity a i belonging to a sum type of constructors fc i j 1 i mg, dene C B [c] 1 : : : n ( F m j=1 C j j;1 : : : j;aj ) = & ai j=1 B [e j ] i;j Here any of the C j j;1 : : : j;aj, for 1 j m, may be taken to be FAIL. If C i i;1 : : : i;ai is taken to be FAIL, then the result is FAIL. 4 Examples We illustrate the application of the method with a simple example. Let head xs = case xs of y : ys ) y We will assume that is implicit in every lambda abstraction. Then head B = B [case xs of y : ys ) y ] [=xs] [] = : B [xs ] [=xs] [] (CONS (B [y ] y [] ) (B [y ] ys [] ) & B [y ] [=xs; (:ABS)=y; (:ABS)=ys] [] = : (CONS ( ) ( ABS)) = : (CONS ABS)

9 To determine a projection transformer safe for xs with respect to head xs, apply apply head B to (:). Simplifying and removing the lambda-abstraction gives the following. head B (:) = CONS ABS CONS ABS Thus, for example, for head xs in context STR, it is safe to evaluate xs in context head B (:) STR = CONS STR ABS, that is, to require that xs have the value cons x y where x 6=?. Dening tail in an analogous way, we have tail B = : (CONS ABS ). Then the strictness of the expression head (tail xs) with respect to xs is given by Then B [head (tail xs)] [(:)=xs] [head B =head; tail B =tail] = head B (tail B (:)) = :(CONS ABS (CONS ABS)) Next we consider the analysis of a recursive function. Let last B last xs = case xs of y : ys ) case ys of [] ) y z : zs ) last ys = (CONS ( t last B (:ABS)) (NIL t (last B (:) & CONS ABS ABS)))) Here the denition of last B is recursive. Assuming that the domains of projections in which we are working are nite, then the domains of projection transformers and functions from projection transformers to projection transformers are also nite, so such equations may be solved by the usual xedpoint iteration. The construction of such domains is discussed in [1]. In this case we have, for example, last B (:) STR = CONS (STR t ABS) (NIL t (last B (:) STR)) = CONS ID NIL t CONS ID (CONS ID NIL) t CONS ID (CONS ID (CONS ID NIL)) t : : : 5 Safety of B The argument of B maps syntactic objects (function variables) to semantic values: the values given by applying B to the bodies of the (syntactic) denitions of the functions associated with the function variables. We can imagine, however, eliminating function variables from any given expression e to which B is applied by repeated substitution of function variables in e by the bodies of the corresponding functions. In general this process will generate innite `expressions'. This idea can be made sensible by dening a domain Ex

10 of expressions, and redening B in the obvious way, Ex = Var + Pfv Ex : : : Ex + Constr Ex : : : Ex + case Ex of Constr Var : : : Var B 0. Constr Var : : : Var ) Ex ) Ex :: Ex! Bvenv! Proj! Proj An obvious question is whether B [e] has the same value as B 0 [e 0 ], where e 0 is the result of eliminating function variables from e by (possibly innitely) substituting the function denitions from which is derived. The question is explored by Stoy in [2] under the name of syntactic recursion. We state without further justication that the values are the same, as are those produced by E and the analogously redened E 0. This fact will simplify proofs about certain properties of B by allowing the proofs to be cast in terms of B 0 and E A Property of & The following is a useful property of &. Proposition. For all e,,,, and, let = B [e], then ( ) & ( ) = ( & ) Proof. This proof uses the following scheme. Let P be the predicate on expressions P (e) = 8; ; ; :( ) & ( ) = ( & ) where = B [e] The predicate P is recast in terms of B 0. The new predicate P 0 is shown to hold for? Ex, and that for all elements e of Ex dierent from? Ex, P 0 (e) is implied by P 0 holding for all (immediate) subexpressions of e, so that, therefore, P 0 holds for all elements of Ex. From this we conclude that P holds for all elements of Exp and function environments. case? Ex : (B 0 [? Ex ] ) & (B 0 [? Ex ] ) =? Proj &? Proj =? Proj case x : = B 0 [? Ex ] ( & ) B 0 [x] & B 0 [x] = [x] & [x] = [x] ( & ) = B 0 [x] ( & )

11 case p : B 0 [p] & B 0 [p] = (:ABS) & (:ABS) = ABS = (:ABS) ( & ) case p e1 : : : e n : = B 0 [p] ( & ) (B 0 [p e1 : : : e n ] ) & (B 0 [p e1 : : : e n ] ) = (& n i=1 B 0 [e i ] STR) & (& n i=1 B 0 [e i ] STR) = (& n i=1 B 0 [e i ] STR) case c i e1 : : : e ai : = B 0 [p e1 : : : e n ] ( & ) B [c i e1 : : : e ai ] ( 1 t F m j=1 C j j;1 : : : j;nj ) & B [c i e1 : : : e ai ] (2 t F m j=1 C j j;1 : : : j;nj ) = (& ai j=1 B [e j ] i;j ) & (& ni j=1 B [e j ] i;j ) = & ai j=1 (B [e j ] i;j ) & B [e j ] i;j ) f by the induction hypothesis g = & ai j=1 (B [e j ] ( i;j & i;j )) = B [c i e1 : : : e ai ] (1 t 2 t F m j=1 C j ( j;1 & j;1) : : : ( j;nj & j;aj )) case case : : : : B 0 [case : : : ] & B 0 [case : : : ] = F m i=1 ( B 0 [e i ] [(:ABS)=x i;j j 1 j a i ] (1) & B 0 [e0 ] (C i (B 0 [e i ] vi;1 ) : : : (B 0 [e i ] vi;ai ))) & F m i=1 ( B 0 [e i ] [(:ABS)=x i;j j 1 j a i ] & B 0 [e0 ] (C i (B 0 [e i ] vi;1 ) : : : (B 0 [e i ] vi;ai ))) Let and Then i = B 0 [e i ] [(:ABS)=x i;j j 1 j a i ] 0;i = :B 0 [e0 ] (C i (B 0 [e i ] vi;1 ) : : : (B 0 [e i ] vi;ai )); 1 i m: (1) = ( F m i=1( i & 0;i )) & ( F m i=1( i & 0;i )) = F m i=1 F m j=1( i & 0;i & j & 0;j ) (2)

12 Using the induction hypothesis we have that i & i = i ( & ) and 0;i & 0;j = FAIL; i 6= j. So (2) = F m i=1 ( i ( & ) & 0;i ( & )) 5.2 The Substitution Rule Proposition. B [e0[e=z]] v B [e0 ] [(:ABS)=z] & & k i=1 B [e0 ] ABS [B[e i ] =z i ] = B [e0 ] [(:ABS)=z] & & k i=1 B [e i ] (B [e0 ] zi ) Proof. The assertion can be established by repeated application of the simpler rule following. B [e0[e=z]] v B [e0 ] [(:ABS)=z] & B [e0 ] ABS [B [e] =z] The proof is by induction on e0. = B [e0 ] [(:ABS)=z] & B [e] (B [e0 ] z ) case? Ex : B 0 [? Ex [e=z]] = B 0 [? Ex ] =? Proj = B 0 [? Ex ] [(:ABS)=z] & B 0 [? Ex ] ABS [B [e] =z] = B 0 [? Ex ] [(:ABS)=z] & B 0 [e] (B [? Ex ] z )

13 case x; x 6= z: B 0 [x[e=z]] = B 0 [x] = [x] = [x] & ABS (1) = B 0 [x] [(:ABS)=z] & B 0 [x] ABS [B 0 [e] =z] and (1) = B 0 [x] [(:ABS)=z] & B 0 [e] (B 0 [x] z ) case z: B 0 [z[e=z]] = B 0 [e] = ABS & B 0 [e] (1) = B 0 [z ] [(:ABS)=z] & B 0 [z ] ABS [B 0 [e] =z] and case p: (straightforward) (1) = B 0 [z ] [(:ABS)=z] & B 0 [e] (B 0 [z ] z ) case p e1 : : : e n : (straightforward) case c e1 : : : e n : (straightforward) case case : : :: B 0 [(case : : : )[e=z]] = B 0 [case e0[e=z] of c1 x1;1 : : : x1;a 1 ) e1[e=z]. c m x m;1 : : : x m;am ) e m [e=z]] = F m i=1 ( B0 [e i [e=z]] [(:ABS)=x i;j j 1 j a i ] & B 0 [e0[e=z]] (C i (B 0 [e i [e=z]] xi;1 ) : : : (B 0 [e i [e=z]] xi;ai ))) = F m i=1 ( B0 [e i [e=z]] [(:ABS)=x i;j j 1 j a i ] & B 0 [e0[e=z]] (C i (B 0 [e i ] xi;1 ) : : : (B 0 [e i ] xi;ai ))) (1) We have assumed that the x i;j ; 1 i m; 1 j a i, are not free in e, to avoid unintended variable capture. Since B 0 [e] y = (:ABS) for every expression e and variable y if y

14 is not free in e, each subterm B 0 [e i [e=z]] xi;j above is equal to B 0 [e i ] xi;j ; this justies the last equality. Writing i for C i (B 0 [e i ] xi;1 ) : : : (B 0 [e i ] xi;ai ), we have by the induction hypothesis Writing the last expression is (1) v F m i=1 ( B 0 [e i ] [(:ABS)=x i;j j 1 j a i ][(:ABS)=z] & B 0 [e i ] ABS [B 0 [e] =z] & B 0 [e0 ] [(:ABS)=z] i & B 0 [e0 ] ABS [B 0 [e] =z] i ) i for B 0 [e i ] [(:ABS)=x i;j j 1 j a i ][(:ABS)=z]; 1 i m 0 for B 0 [e0 ] [(:ABS)=z] i for B 0 [e i ] ABS [B 0 [e] =z]; 1 i m 0 for B 0 [e0 ] ABS [B 0 [e] =z] F m i=1 ( i & i & 0 i & 0 i ) v F m i=1f n j=1 ( i & i & 0 j & 0 j ) = ( F m i=1 ( i & 0 i )) & ( F n i=1 ( i & 0 i )) = ( F m i=1 ( B 0 [e i ] [(:ABS)=x i;j j 1 j a i ][(:ABS)=z] & B 0 [e0 ] [(:ABS)=z] i )) & ( F m i=1 ( B 0 [e i ] ABS [B 0 [e] =z] & B 0 [e0 ] ABS [B 0 [e] =z] i )) (1) = (B 0 [case : : : ] [(:ABS)=z] ) & (B 0 [case : : : ] ABS [B 0 [e] =z] ) = B 0 [(case : : : )[e=z]] Also, f by the induction hypothesis g (1) = ( F m i=1 (B 0 [e i ] [(:ABS)=x i;j j 1 j a i ][(:ABS)=z] ) & (B 0 [e0 ] [(:ABS)=z] i )) & ( F m i=1 (B 0 [e0 ] (B 0 [e i ] z ) & (B 0 [e0 ] (B 0 [e i ] i )) = ( F m i=1 (B 0 [e i ] ABS [(:ABS)=z] ) & (B 0 [e0 ] [(:ABS)=z] i )) & ( F m i=1 (B0 [e0 ] ((B 0 [e i ] z ) & (B 0 [e i ] i )))) 5.3 Proof of Safety = (B 0 [case : : : ] [(:ABS)=z] ) & (B 0 [e] (B 0 [case : : : ] z )) Proposition. B satises its safety condition, that is, for all projections, expressions e with free variables z, variables x, expressions e and projection transformers such that i is safe for x with respect to e i for each i, 1 i k, and = B [e] [=z], we have (E [e[e=z]] ) v E [e[e=z]] ([ ([x])=x])

15 Proof. Again, the proof is in terms of B 0 and E 0, by syntactic recursion on the expression e. The symbols LHS and RHS will be used to stand for instances of the left-hand and right-hand sides, respectively, of the above inequality. case? Ex : LHS = (E 0 [? Ex [e=z]] ) =? =? v RHS case z i ; 1 i k : (E 0 [z i [e=z]] ) = (E 0 [e i ] ) f by the assumption that i is safe for x with respect to e i g v E 0 [e i ] ([ i ([x])=x]) f = i = B 0 [z i ] [=z] g = E 0 [e i ] ([ ([x])=x]) case p : (E 0 [p[e=z]] ) = (E 0 [p] ) v E 0 [p] [(:ABS) ([x])=x] = E 0 [p] [ ([x])=x] case p w1 : : : w n : LHS = (E 0 [(p w1 : : : w m )[e=z]] ) = (E 0 [p (w1[e=z]) : : : (w m [e=z])] ) = (E 0 [p y1 : : : y m ] [E 0 [w i [e=z]] =y i j 1 i m]) f since p is strict g v E 0 [p y1 : : : y m ] [STR (E 0 [w i [e=z]] )=y i j 1 i m](1) Let i = B 0 [w i [=z]] ; 1 i m. By the induction hypothesis, each i is safe for x with respect to w i [e=z], so (1) v E 0 [p y1 : : : y m ] E 0 [w i [e=z]] [ i STR ([x])=x]=y i j 1 i m] (2)

16 If i STR ([x]) =?for any i, then by the denition of E 0 we have that this last term is equal to?. Suppose then that i STR ([x]) =?for no i. Then for any j, So, by monotonicity, case c w1 : : : w a : ([x]) = B 0 [p w1 : : : w m ] [=z] ([x]) = & m i=1 ( i STR) ([x]) = F m i=1 ( i STR) ([x]) w j STR ([x]) (2) v E 0 [p y1 : : : y m ] E 0 [w i [e=z]] [ ([x])=x]=y i j 1 i m] = RHS LHS = (E 0 [(c w1 : : : w n )[e=z]] ) If (1) 6=?, then can be expressed as = (C [c] (E 0 [w1[e=z]] ) : : : (E 0 [w n [e=z]] )) (1) = ( F m i=1 C i i;1 : : : i;ai ) and C i matches c for some i. Let this C i be denoted by C, a i by a, and i;j by j for 1 j a i. Then (1) = C [c] (1 (E 0 [w1[e=z]] )) : : : ( a (E 0 [w a [e=z]] )) (2) Let i = B 0 [w i ] [=z]; 1 i a. By the induction hypothesis, i is safe for x with respect to w i [e=z] for each i, so (2) v C [c] (E 0 [w1[e=z]] [1 1 ([x])=x]) : : : (E 0 [w a [e=z]] [1 a ([x])=x]) (3) If i i ([x]) =?for some i, then (3) =?v RHS. Otherwise, for any j, So, for = & a i=1 ( i i ), j j ([x]) v F n i=1 i i ([x]) = & n i=1 i i ([x]) (3) v C [c] (E 0 [w1[e=z]] [ ([x])=x]) : : : (E 0 [w n [e=z]] [ ([x])=x]) And by monotonicity we have v B 0 [c e1 : : : e n ] [=z]

17 The case rule We can derive the case rule without reference to the induction hypothesis. Consider the left-hand side of the inequality we wish to show, and the denition of E 0. We may assume that either e0[e=z] has been reduced to head-normal form, or that is has no such form. If it has no such normal form, or if that form does not match one of patterns, then the left-hand side of the inequality is?, and the inequality is satised for any value of the right-hand side. Assuming that e0[e=z] is in head-normal form, we have for some i, Now is certainly safe if = B [case c i e i;1 : : : e i;ai of c1 x1;1 : : : x1;a 1 ) e1. c m x m;1 : : : x m;am ) e m ] (1) w B 0 [e i [e i;1=x i;1 : : : e i;ai =x i;ai ]] (2) By denition, 6 A (1) = F m j=1 ( B 0 [e j ] [(:ABS)=x i;j j 1 j a i ] & B 0 [c j e j;1 : : : e j;aj ] (C i (B 0 [e j ] xj;1 ) : : : (B 0 [e j ] xj;ai )) = (B 0 [e i ] [(:ABS)=x i;j j 1 j a i ] ) & (& ai j=1 B 0 [e j ] xi;j ) f by the substitution rule g = (2) The analysis described in [1] may be recast in terms with the same functionality as B. We will call the analysis in this form A. The analysis in [1] gives separate rules for if and case, such that the rule for if gives a weaker analysis than for the semantically equivalent case expression. We choose therefore to ignore the if rule altogether. The rules for A are exactly the same as for B except that we require that the variable environment for A map no more than a single variable to a value dierent from :ABS. The rules for A may be derived from the rules for B by replacing occurrences of B on the left-hand sides of the rules by A, those on the right-hand sides by A 0, and adding the rule A 0 [e] [=z] = & n i=1 A[e] ABS [ i =z i ] We wish to show that A gives a weaker analysis than B, in the sense that B [e] v A[e] for all appropriate values of e; ; ; and, from which the safety of A is immediate. In fact we show a more general result. By monotonicity of & we have (B [e] 1 ) & (B [e] 2 ) v B [e] ( 1 & 2) where 1 & 2 is dened for 1 and 2 having the same domain, and for every element z of this domain, ( 1 & 2)[z ] = 1 [z ] & 2 [z ]

18 The weakness of A relative to B results from its considering function arguments separately. This may be demonstrated by encapsulating a case expression in a function denition. Suppose that we have the function denition f x y z = case x of true ) y false ) z and analyse strictness with respect to y in the call f x y y. We have f A (:ABS) (:) (:) STR = ID f B (:ABS) (:) (:) STR = STR that is, B shows the call to be strict in y, but A does not. 7 Conclusion The weakness of A relative to B results from the consideration of function arguments individually, rather than jointly as in B. This is exemplied by the if example. Just as for forwards strictness analysis, we may construct a lattice of approximations between A and B (see [3].) In the forwards analysis, the real strength of the computationally dicult analysis (the one corresponding to B) only becomes apparent for higher-order analyses we anticipate the same for backwards analysis. Extension of the backwards analysis to the higher-order case seems to be the next logical step in the development. More information and background on backwards analysis may be found in [4, 5, 6, 7, 8, 9]. References [1] Wadler, P., and Hughes, R.J.M., Projections for Strictness Analysis. Report 35, Programming Methodology Group, Department of Computer Sciences, Chalmers University of Technology and University of Goteborg, Goteborg, Sweden. [2] Stoy, Joseph E. Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. The MIT Press, Cambridge, Massachusetts, [3] Davis, K. \Trading accuracy for eciency in forwards strictness analysis." Unpublished manuscript, [4] Hughes, R.J.M. \Strictness detection in non-at domains." In Proceedings of the Workshop on Programs a Data Objects (Copenhagen). H. Ganzinger and N. Jones, eds. LNCS 217. Springer-Verlag, Berlin, 1985 [5] Hughes, R.J.M. Backwards Analysis of Functional Programs. Departmental Research Report CSC/87/R3, Department of Computing Science, University of Glasgow, [6] Hughes, R.J.M. \Analysing strictness by abstract interpretation of continuations." Chapter 4 of Abramsky, S. and Hankin, C. (eds.). Abstract Interpretation of Declarative Languages. Ellis-Horwood, [7] Hughes, R.J.M. \Compile-time analysis of functional programs." In Proc. Year of Programming Summer School on Declarative Programming, (Austin, Texas), 1987, David Turner (ed.), Addison-Wesley 1989.

19 [8] Hughes, R.J.M. \Projections for polymorphic strictness analysis." [9] Hughes, R.J.M. and Ferguson, A. \An iterative powerdomain construction." In Draft Proceedings of the 1989 Glasgow Workshop on Functional Programming (Fraserburgh, Scotland)

Higher-Order Chaotic Iteration Sequences

Higher-Order Chaotic Iteration Sequences Higher-Order Chaotic Iteration Sequences Mads Rosendahl DIKU, University of Copenhagen Universitetsparken 1, DK-2100 Copenhagen Ø, Denmark E-mail rose@diku.dk 1993 Abstract Chaotic iteration sequences

More information

Compositionality in SLD-derivations and their abstractions Marco Comini, Giorgio Levi and Maria Chiara Meo Dipartimento di Informatica, Universita di

Compositionality in SLD-derivations and their abstractions Marco Comini, Giorgio Levi and Maria Chiara Meo Dipartimento di Informatica, Universita di Compositionality in SLD-derivations and their abstractions Marco Comini Giorgio Levi and Maria Chiara Meo Dipartimento di Informatica Universita di Pisa Corso Italia 40 56125 Pisa Italy fcomini levi meog@di.unipi.it

More information

Electronic Notes in Theoretical Computer Science 18 (1998) URL: 8 pages Towards characterizing bisim

Electronic Notes in Theoretical Computer Science 18 (1998) URL:   8 pages Towards characterizing bisim Electronic Notes in Theoretical Computer Science 18 (1998) URL: http://www.elsevier.nl/locate/entcs/volume18.html 8 pages Towards characterizing bisimilarity of value-passing processes with context-free

More information

Transformation Rules for Locally Stratied Constraint Logic Programs

Transformation Rules for Locally Stratied Constraint Logic Programs Transformation Rules for Locally Stratied Constraint Logic Programs Fabio Fioravanti 1, Alberto Pettorossi 2, Maurizio Proietti 3 (1) Dipartimento di Informatica, Universit dell'aquila, L'Aquila, Italy

More information

Programming Languages and Types

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

More information

Every formula evaluates to either \true" or \false." To say that the value of (x = y) is true is to say that the value of the term x is the same as th

Every formula evaluates to either \true or \false. To say that the value of (x = y) is true is to say that the value of the term x is the same as th A Quick and Dirty Sketch of a Toy Logic J Strother Moore January 9, 2001 Abstract For the purposes of this paper, a \logic" consists of a syntax, a set of axioms and some rules of inference. We dene a

More information

Logic Part I: Classical Logic and Its Semantics

Logic Part I: Classical Logic and Its Semantics Logic Part I: Classical Logic and Its Semantics Max Schäfer Formosan Summer School on Logic, Language, and Computation 2007 July 2, 2007 1 / 51 Principles of Classical Logic classical logic seeks to model

More information

From Constructibility and Absoluteness to Computability and Domain Independence

From Constructibility and Absoluteness to Computability and Domain Independence From Constructibility and Absoluteness to Computability and Domain Independence Arnon Avron School of Computer Science Tel Aviv University, Tel Aviv 69978, Israel aa@math.tau.ac.il Abstract. Gödel s main

More information

Preface These notes were prepared on the occasion of giving a guest lecture in David Harel's class on Advanced Topics in Computability. David's reques

Preface These notes were prepared on the occasion of giving a guest lecture in David Harel's class on Advanced Topics in Computability. David's reques Two Lectures on Advanced Topics in Computability Oded Goldreich Department of Computer Science Weizmann Institute of Science Rehovot, Israel. oded@wisdom.weizmann.ac.il Spring 2002 Abstract This text consists

More information

Functional Database Query Languages as. Typed Lambda Calculi of Fixed Order. Gerd G. Hillebrand and Paris C. Kanellakis

Functional Database Query Languages as. Typed Lambda Calculi of Fixed Order. Gerd G. Hillebrand and Paris C. Kanellakis Functional Database Query Languages as Typed Lambda Calculi of Fixed Order Gerd G. Hillebrand and Paris C. Kanellakis Department of Computer Science Brown University Providence, Rhode Island 02912 CS-94-26

More information

Principles of Program Analysis: A Sampler of Approaches

Principles of Program Analysis: A Sampler of Approaches Principles of Program Analysis: A Sampler of Approaches Transparencies based on Chapter 1 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis Springer Verlag

More information

Splitting a Default Theory. Hudson Turner. University of Texas at Austin.

Splitting a Default Theory. Hudson Turner. University of Texas at Austin. Splitting a Default Theory Hudson Turner Department of Computer Sciences University of Texas at Austin Austin, TX 7872-88, USA hudson@cs.utexas.edu Abstract This paper presents mathematical results that

More information

Behavioural theories and the proof of. LIENS, C.N.R.S. U.R.A & Ecole Normale Superieure, 45 Rue d'ulm, F{75230 Paris Cedex 05, France

Behavioural theories and the proof of. LIENS, C.N.R.S. U.R.A & Ecole Normale Superieure, 45 Rue d'ulm, F{75230 Paris Cedex 05, France Behavioural theories and the proof of behavioural properties Michel Bidoit a and Rolf Hennicker b b a LIENS, C.N.R.S. U.R.A. 1327 & Ecole Normale Superieure, 45 Rue d'ulm, F{75230 Paris Cedex 05, France

More information

When Will Deforestation Stop? A. B. Ferguson and Philip Wadler. Abstract

When Will Deforestation Stop? A. B. Ferguson and Philip Wadler. Abstract When Will Deforestation Stop? A. B. Ferguson and Philip Wadler Abstract A compositional style of programming is often advocated by functional programmers. However, there is a certain eciency penalty involved

More information

Lifting to non-integral idempotents

Lifting to non-integral idempotents Journal of Pure and Applied Algebra 162 (2001) 359 366 www.elsevier.com/locate/jpaa Lifting to non-integral idempotents Georey R. Robinson School of Mathematics and Statistics, University of Birmingham,

More information

Notes on Iterated Expectations Stephen Morris February 2002

Notes on Iterated Expectations Stephen Morris February 2002 Notes on Iterated Expectations Stephen Morris February 2002 1. Introduction Consider the following sequence of numbers. Individual 1's expectation of random variable X; individual 2's expectation of individual

More information

Principles of Program Analysis: Control Flow Analysis

Principles of Program Analysis: Control Flow Analysis Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag

More information

A note on fuzzy predicate logic. Petr H jek 1. Academy of Sciences of the Czech Republic

A note on fuzzy predicate logic. Petr H jek 1. Academy of Sciences of the Czech Republic A note on fuzzy predicate logic Petr H jek 1 Institute of Computer Science, Academy of Sciences of the Czech Republic Pod vod renskou v 2, 182 07 Prague. Abstract. Recent development of mathematical fuzzy

More information

Predicate Logic. x. x + 0 = x. Predicate logic over integer expressions: a language of logical assertions, for example. Why discuss predicate logic?

Predicate Logic. x. x + 0 = x. Predicate logic over integer expressions: a language of logical assertions, for example. Why discuss predicate logic? Predicate Logic Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic? It is an example of a simple language It has simple denotational

More information

Injectivity of Composite Functions

Injectivity of Composite Functions Injectivity of Composite Functions Kim S. Larsen Michael I. Schwartzbach Computer Science Department, Aarhus University Ny Munkegade, 8000 Aarhus C, Denmark Present address: Department of Mathematics and

More information

Parametric Polymorphism and Operational Improvement

Parametric Polymorphism and Operational Improvement Parametric Polymorphism and Operational Improvement JENNIFER HACKETT, University of Nottingham, UK GRAHAM HUTTON, University of Nottingham, UK Parametricity, in both operational and denotational forms,

More information

Depending on equations

Depending on equations Depending on equations A proof-relevant framework for unification in dependent type theory Jesper Cockx DistriNet KU Leuven 3 September 2017 Unification for dependent types Unification is used for many

More information

The syntactic guard condition of Coq

The syntactic guard condition of Coq The syntactic guard condition of Coq Bruno Barras February 2, 2010 Overview 1 Theory Basic criterion Extensions 2 Algorithm Efficiency 3 Discussion 4 Attic A short history of the syntactic guard criterion

More information

every symbol we can dene inside which of its arguments reduction is allowed or not. This kind of rewriting is called context-sensitive rewriting. It i

every symbol we can dene inside which of its arguments reduction is allowed or not. This kind of rewriting is called context-sensitive rewriting. It i Termination of context-sensitive rewriting H. Zantema Utrecht University, Department of Computer Science, P.O. box 80.089, 3508 TB Utrecht, The Netherlands e-mail: hansz@cs.ruu.nl Abstract Context-sensitive

More information

Beyond First-Order Logic

Beyond First-Order Logic Beyond First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Beyond First-Order Logic MFES 2008/09 1 / 37 FOL

More information

ON FIRST-ORDER CONS-FREE TERM REWRITING AND PTIME

ON FIRST-ORDER CONS-FREE TERM REWRITING AND PTIME ON FIRST-ORDER CONS-FREE TERM REWRITING AND PTIME CYNTHIA KOP Department of Computer Science, Copenhagen University e-mail address: kop@diku.dk Abstract. In this paper, we prove that (first-order) cons-free

More information

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and 7 RC Simulates RA. We now show that DRC (and hence TRC) is at least as expressive as RA. That is, given an RA expression E that mentions at most C, there is an equivalent DRC expression E that mentions

More information

2 RODNEY G. DOWNEY STEFFEN LEMPP Theorem. For any incomplete r.e. degree w, there is an incomplete r.e. degree a > w such that there is no r.e. degree

2 RODNEY G. DOWNEY STEFFEN LEMPP Theorem. For any incomplete r.e. degree w, there is an incomplete r.e. degree a > w such that there is no r.e. degree THERE IS NO PLUS-CAPPING DEGREE Rodney G. Downey Steffen Lempp Department of Mathematics, Victoria University of Wellington, Wellington, New Zealand downey@math.vuw.ac.nz Department of Mathematics, University

More information

1 CHAPTER 1 INTRODUCTION 1.1 Background One branch of the study of descriptive complexity aims at characterizing complexity classes according to the l

1 CHAPTER 1 INTRODUCTION 1.1 Background One branch of the study of descriptive complexity aims at characterizing complexity classes according to the l viii CONTENTS ABSTRACT IN ENGLISH ABSTRACT IN TAMIL LIST OF TABLES LIST OF FIGURES iii v ix x 1 INTRODUCTION 1 1.1 Background : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 1.2 Preliminaries

More information

Syntax: form ::= A: lin j E: lin ::= 3 lin j lin ^ lin j :lin j bool lin lin is a temporal formula dened over a global sequence. bool is true in g if

Syntax: form ::= A: lin j E: lin ::= 3 lin j lin ^ lin j :lin j bool lin lin is a temporal formula dened over a global sequence. bool is true in g if Introduction 1 Goals of the lecture: Weak Conjunctive Predicates Logic for global predicates Weak conjunctive algorithm References: Garg and Waldecker 94 Syntax: form ::= A: lin j E: lin ::= 3 lin j lin

More information

Computing the acceptability semantics. London SW7 2BZ, UK, Nicosia P.O. Box 537, Cyprus,

Computing the acceptability semantics. London SW7 2BZ, UK, Nicosia P.O. Box 537, Cyprus, Computing the acceptability semantics Francesca Toni 1 and Antonios C. Kakas 2 1 Department of Computing, Imperial College, 180 Queen's Gate, London SW7 2BZ, UK, ft@doc.ic.ac.uk 2 Department of Computer

More information

The Independence of Peano's Fourth Axiom from. Martin-Lof's Type Theory without Universes. Jan M. Smith. Department of Computer Science

The Independence of Peano's Fourth Axiom from. Martin-Lof's Type Theory without Universes. Jan M. Smith. Department of Computer Science The Independence of Peano's Fourth Axiom from Martin-Lof's Type Theory without Universes Jan M. Smith Department of Computer Science University of Goteborg/Chalmers S-412 96 Goteborg Sweden March 1987

More information

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P. First-Order Logic Syntax The alphabet of a first-order language is organised into the following categories. Logical connectives:,,,,, and. Auxiliary symbols:.,,, ( and ). Variables: we assume a countable

More information

The rest of the paper is organized as follows: in Section 2 we prove undecidability of the existential-universal ( 2 ) part of the theory of an AC ide

The rest of the paper is organized as follows: in Section 2 we prove undecidability of the existential-universal ( 2 ) part of the theory of an AC ide Undecidability of the 9 8 part of the theory of ground term algebra modulo an AC symbol Jerzy Marcinkowski jma@tcs.uni.wroc.pl Institute of Computer Science University of Wroc law, ul. Przesmyckiego 20

More information

Mathematical Foundations of Programming. Nicolai Kraus. Draft of February 15, 2018

Mathematical Foundations of Programming. Nicolai Kraus. Draft of February 15, 2018 Very short lecture notes: Mathematical Foundations of Programming University of Nottingham, Computer Science, module code G54FOP, Spring 2018 Nicolai Kraus Draft of February 15, 2018 What is this? This

More information

Abstract Interpretation from a Topological Perspective

Abstract Interpretation from a Topological Perspective (-: / 1 Abstract Interpretation from a Topological Perspective David Schmidt Kansas State University www.cis.ksu.edu/ schmidt Motivation and overview of results (-: / 2 (-: / 3 Topology studies convergent

More information

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes These notes form a brief summary of what has been covered during the lectures. All the definitions must be memorized and understood. Statements

More information

A shrinking lemma for random forbidding context languages

A shrinking lemma for random forbidding context languages Theoretical Computer Science 237 (2000) 149 158 www.elsevier.com/locate/tcs A shrinking lemma for random forbidding context languages Andries van der Walt a, Sigrid Ewert b; a Department of Mathematics,

More information

As a rst step, we concentrate in this paper on the second problem and we abstract from the problem of synchronisation. We therefore dene a denotationa

As a rst step, we concentrate in this paper on the second problem and we abstract from the problem of synchronisation. We therefore dene a denotationa Probabilistic Concurrent Constraint Programming: Towards a Fully Abstract Model Alessandra Di Pierro and Herbert Wiklicky fadp,herbertg@cs.city.ac.uk City University, Northampton Square, London EC1V OHB

More information

AST rewriting. Part I: Specifying Transformations. Imperative object programs. The need for path queries. fromentry, paths, toexit.

AST rewriting. Part I: Specifying Transformations. Imperative object programs. The need for path queries. fromentry, paths, toexit. Part I: Specifying Transformations Oege de Moor Ganesh Sittampalam Programming Tools Group, Oxford focus AST rewriting To apply rule: rewrite(pat 0, pat 1 ) Match: focus = φ(pat 0 ) Replace: focus := φ(pat

More information

Vector Space Basics. 1 Abstract Vector Spaces. 1. (commutativity of vector addition) u + v = v + u. 2. (associativity of vector addition)

Vector Space Basics. 1 Abstract Vector Spaces. 1. (commutativity of vector addition) u + v = v + u. 2. (associativity of vector addition) Vector Space Basics (Remark: these notes are highly formal and may be a useful reference to some students however I am also posting Ray Heitmann's notes to Canvas for students interested in a direct computational

More information

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC) University of Science and Technology of China (USTC) 09/26/2011 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?

More information

Proofs and computations

Proofs and computations (j.w.w. Kenji Miyamoto) Mathematisches Institut, LMU, München Leeds University, 7. March 2012 Formalization and extraction One can extract from a (constructive) proof of a formula with computational content

More information

form, but that fails as soon as one has an object greater than every natural number. Induction in the < form frequently goes under the fancy name \tra

form, but that fails as soon as one has an object greater than every natural number. Induction in the < form frequently goes under the fancy name \tra Transnite Ordinals and Their Notations: For The Uninitiated Version 1.1 Hilbert Levitz Department of Computer Science Florida State University levitz@cs.fsu.edu Intoduction This is supposed to be a primer

More information

Lecture Notes on Combinatory Modal Logic

Lecture Notes on Combinatory Modal Logic Lecture Notes on Combinatory Modal Logic 15-816: Modal Logic Frank Pfenning Lecture 9 February 16, 2010 1 Introduction The connection between proofs and program so far has been through a proof term assignment

More information

In a second part, we concentrate on interval models similar to the traditional ITL models presented in [, 5]. By making various assumptions about time

In a second part, we concentrate on interval models similar to the traditional ITL models presented in [, 5]. By making various assumptions about time Complete Proof Systems for First Order Interval Temporal Logic Bruno Dutertre Department of Computer Science Royal Holloway, University of London Egham, Surrey TW0 0EX, United Kingdom Abstract Dierent

More information

Proof techniques (section 2.1)

Proof techniques (section 2.1) CHAPTER 1 Proof techniques (section 2.1) What we have seen so far: 1.1. Theorems and Informal proofs Argument: P 1 P n Q Syntax: how it's written Semantic: meaning in a given interpretation Valid argument:

More information

Linear Algebra (part 1) : Vector Spaces (by Evan Dummit, 2017, v. 1.07) 1.1 The Formal Denition of a Vector Space

Linear Algebra (part 1) : Vector Spaces (by Evan Dummit, 2017, v. 1.07) 1.1 The Formal Denition of a Vector Space Linear Algebra (part 1) : Vector Spaces (by Evan Dummit, 2017, v. 1.07) Contents 1 Vector Spaces 1 1.1 The Formal Denition of a Vector Space.................................. 1 1.2 Subspaces...................................................

More information

EXTENDED ABSTRACT. 2;4 fax: , 3;5 fax: Abstract

EXTENDED ABSTRACT. 2;4 fax: , 3;5 fax: Abstract 1 Syntactic denitions of undened: EXTENDED ABSTRACT on dening the undened Zena Ariola 1, Richard Kennaway 2, Jan Willem Klop 3, Ronan Sleep 4 and Fer-Jan de Vries 5 1 Computer and Information Science Department,

More information

{},{a},{a,c} {},{c} {c,d}

{},{a},{a,c} {},{c} {c,d} Modular verication of Argos Programs Agathe Merceron 1 and G. Michele Pinna 2 1 Basser Department of Computer Science, University of Sydney Madsen Building F09, NSW 2006, Australia agathe@staff.cs.su.oz.au

More information

Notes on Inductive Sets and Induction

Notes on Inductive Sets and Induction Notes on Inductive Sets and Induction Finite Automata Theory and Formal Languages TMV027/DIT21 Ana Bove, March 15th 2018 Contents 1 Induction over the Natural Numbers 2 1.1 Mathematical (Simple) Induction........................

More information

1 Introduction A general problem that arises in dierent areas of computer science is the following combination problem: given two structures or theori

1 Introduction A general problem that arises in dierent areas of computer science is the following combination problem: given two structures or theori Combining Unication- and Disunication Algorithms Tractable and Intractable Instances Klaus U. Schulz CIS, University of Munich Oettingenstr. 67 80538 Munchen, Germany e-mail: schulz@cis.uni-muenchen.de

More information

Proof Methods for Corecursive Programs. 1. Introduction. Jeremy Gibbons. Graham Hutton

Proof Methods for Corecursive Programs. 1. Introduction. Jeremy Gibbons. Graham Hutton Fundamenta Informaticae XX (2005) 1 14 1 IOS Press Proof Methods for Corecursive Programs Jeremy Gibbons Oxford University Computing Laboratory, UK Graham Hutton School of Computer Science and IT, University

More information

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

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

More information

Design of abstract domains using first-order logic

Design of abstract domains using first-order logic Centrum voor Wiskunde en Informatica REPORTRAPPORT Design of abstract domains using first-order logic E. Marchiori Computer Science/Department of Interactive Systems CS-R9633 1996 Report CS-R9633 ISSN

More information

is a model, supported model or stable model, respectively, of P. The check can be implemented to run in linear time in the size of the program. Since

is a model, supported model or stable model, respectively, of P. The check can be implemented to run in linear time in the size of the program. Since Fixed-parameter complexity of semantics for logic programs Zbigniew Lonc? and Miros law Truszczynski?? Department of Computer Science, University of Kentucky Lexington KY 40506-0046, USA flonc, mirekg@cs.engr.uky.edu

More information

Knowledge Representation and Reasoning in Modal Higher-order Logic

Knowledge Representation and Reasoning in Modal Higher-order Logic Knowledge Representation and Reasoning in Modal Higher-order Logic J.W. Lloyd Computer Sciences Laboratory College of Engineering and Computer Science The Australian National University August 23, 2007

More information

1) Totality of agents is (partially) ordered, with the intended meaning that t 1 v t 2 intuitively means that \Perception of the agent A t2 is sharper

1) Totality of agents is (partially) ordered, with the intended meaning that t 1 v t 2 intuitively means that \Perception of the agent A t2 is sharper On reaching consensus by groups of intelligent agents Helena Rasiowa and Wiktor Marek y Abstract We study the problem of reaching the consensus by a group of fully communicating, intelligent agents. Firstly,

More information

1 Introduction It will be convenient to use the inx operators a b and a b to stand for maximum (least upper bound) and minimum (greatest lower bound)

1 Introduction It will be convenient to use the inx operators a b and a b to stand for maximum (least upper bound) and minimum (greatest lower bound) Cycle times and xed points of min-max functions Jeremy Gunawardena, Department of Computer Science, Stanford University, Stanford, CA 94305, USA. jeremy@cs.stanford.edu October 11, 1993 to appear in the

More information

Decidability of Existence and Construction of a Complement of a given function

Decidability of Existence and Construction of a Complement of a given function Decidability of Existence and Construction of a Complement of a given function Ka.Shrinivaasan, Chennai Mathematical Institute (CMI) (shrinivas@cmi.ac.in) April 28, 2011 Abstract This article denes a complement

More information

Predicative Semantics of Loops Theodore S. Norvell Faculty of Engineering Memorial University of Newfoundland St. John's NF A1B 3X5 Canada

Predicative Semantics of Loops Theodore S. Norvell Faculty of Engineering Memorial University of Newfoundland St. John's NF A1B 3X5 Canada Predicative Semantics of Loops Theodore S. Norvell Faculty of Engineering Memorial University of Newfoundland St. John's NF A1B 3X5 Canada theo@engr.mun.ca www.engr.mun.ca/theo/ Abstract A predicative

More information

TR : Binding Modalities

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

More information

Non-elementary Lower Bound for Propositional Duration. Calculus. A. Rabinovich. Department of Computer Science. Tel Aviv University

Non-elementary Lower Bound for Propositional Duration. Calculus. A. Rabinovich. Department of Computer Science. Tel Aviv University Non-elementary Lower Bound for Propositional Duration Calculus A. Rabinovich Department of Computer Science Tel Aviv University Tel Aviv 69978, Israel 1 Introduction The Duration Calculus (DC) [5] is a

More information

Degradable Agreement in the Presence of. Byzantine Faults. Nitin H. Vaidya. Technical Report #

Degradable Agreement in the Presence of. Byzantine Faults. Nitin H. Vaidya. Technical Report # Degradable Agreement in the Presence of Byzantine Faults Nitin H. Vaidya Technical Report # 92-020 Abstract Consider a system consisting of a sender that wants to send a value to certain receivers. Byzantine

More information

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf PREDICATE LOGIC Schaum's outline chapter 4 Rosen chapter 1 September 11, 2018 margarita.spitsakova@ttu.ee ICY0001: Lecture 2 September 11, 2018 1 / 25 Contents 1 Predicates and quantiers 2 Logical equivalences

More information

Static Program Analysis

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

More information

Operationally-Based Theories of Program Equivalence

Operationally-Based Theories of Program Equivalence Operationally-Based Theories of Program Equivalence Andrew Pitts Contents 1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : 241 2 Contextual Equivalence : : : : : : : : : : : : : :

More information

Relations to first order logic

Relations to first order logic An Introduction to Description Logic IV Relations to first order logic Marco Cerami Palacký University in Olomouc Department of Computer Science Olomouc, Czech Republic Olomouc, November 6 th 2014 Marco

More information

Logic for Computational Effects: work in progress

Logic for Computational Effects: work in progress 1 Logic for Computational Effects: work in progress Gordon Plotkin and John Power School of Informatics University of Edinburgh King s Buildings Mayfield Road Edinburgh EH9 3JZ Scotland gdp@inf.ed.ac.uk,

More information

Spurious Chaotic Solutions of Dierential. Equations. Sigitas Keras. September Department of Applied Mathematics and Theoretical Physics

Spurious Chaotic Solutions of Dierential. Equations. Sigitas Keras. September Department of Applied Mathematics and Theoretical Physics UNIVERSITY OF CAMBRIDGE Numerical Analysis Reports Spurious Chaotic Solutions of Dierential Equations Sigitas Keras DAMTP 994/NA6 September 994 Department of Applied Mathematics and Theoretical Physics

More information

The Intensional Implementation Technique for Chain. Datalog Programs. P.O. BOX 1186, Ioannina, Greece, A. Paraskevi Attikis, Greece

The Intensional Implementation Technique for Chain. Datalog Programs. P.O. BOX 1186, Ioannina, Greece, A. Paraskevi Attikis, Greece The Intensional Implementation Technique for Chain Datalog Programs P. Rondogiannis 1 and M. Gergatsoulis 2 1 Dept. of Computer Science, University of Ioannina, P.O. BOX 1186, 45110 Ioannina, Greece, e

More information

DALI: An Untyped CBV Operational Semantics and Equational Theory. for Datatypes with Binders (Technical Development)

DALI: An Untyped CBV Operational Semantics and Equational Theory. for Datatypes with Binders (Technical Development) DALI: An Untyped CBV Operational Semantics and Equational Theory for Datatypes with Binders (Technical Development) Emir Pasalic, Tim Sheard?, Walid Taha?? Oregon Graduate Institute and Chalmers University

More information

Basic Propositional Logic. Inductive Theory of the Natural Numbers. Conjunction. Equivalence. Negation and Inequivalence. Implication.

Basic Propositional Logic. Inductive Theory of the Natural Numbers. Conjunction. Equivalence. Negation and Inequivalence. Implication. McMaster University COMPSCI&SFWRENG 2DM3 Dept. of Computing and Software Theorem List 4 Dr. W. Kahl 2017-12-09 The names listed here are precisely the names used in the preloaded material you are already

More information

An Extended Relational Algebra for Declarative Programming *

An Extended Relational Algebra for Declarative Programming * An Extended Relational Algebra for Declarative Programming * Jesús M. Almendros-Jiménez Dpto. de Lenguajes y Computación. Universidad de Almería. jalmen@ual.es Resumen Relational algebra is a well-known

More information

Lecture 2: Syntax. January 24, 2018

Lecture 2: Syntax. January 24, 2018 Lecture 2: Syntax January 24, 2018 We now review the basic definitions of first-order logic in more detail. Recall that a language consists of a collection of symbols {P i }, each of which has some specified

More information

for Propositional Temporal Logic with Since and Until Y. S. Ramakrishna, L. E. Moser, L. K. Dillon, P. M. Melliar-Smith, G. Kutty

for Propositional Temporal Logic with Since and Until Y. S. Ramakrishna, L. E. Moser, L. K. Dillon, P. M. Melliar-Smith, G. Kutty An Automata-Theoretic Decision Procedure for Propositional Temporal Logic with Since and Until Y. S. Ramakrishna, L. E. Moser, L. K. Dillon, P. M. Melliar-Smith, G. Kutty Department of Electrical and Computer

More information

Note that neither ; nor are syntactic constituents of content models. It is not hard to see that the languages denoted by content models are exactly t

Note that neither ; nor are syntactic constituents of content models. It is not hard to see that the languages denoted by content models are exactly t Unambiguity of Extended Regular Expressions in SGML Document Grammars Anne Bruggemann-Klein Abstract In the Standard Generalized Markup Language (SGML), document types are dened by context-free grammars

More information

Predicates and Predicate Transformers for. Systems 1. Ratnesh Kumar. Department of Electrical Engineering. University of Kentucky

Predicates and Predicate Transformers for. Systems 1. Ratnesh Kumar. Department of Electrical Engineering. University of Kentucky Predicates and Predicate Transformers for Supervisory Control of Discrete Event Dynamical Systems 1 Ratnesh Kumar Department of Electrical Engineering University of Kentucy Lexington, KY 40506-0046 Vijay

More information

Yet Another Proof of the Strong Equivalence Between Propositional Theories and Logic Programs

Yet Another Proof of the Strong Equivalence Between Propositional Theories and Logic Programs Yet Another Proof of the Strong Equivalence Between Propositional Theories and Logic Programs Joohyung Lee and Ravi Palla School of Computing and Informatics Arizona State University, Tempe, AZ, USA {joolee,

More information

Discrete Probability Refresher

Discrete Probability Refresher ECE 1502 Information Theory Discrete Probability Refresher F. R. Kschischang Dept. of Electrical and Computer Engineering University of Toronto January 13, 1999 revised January 11, 2006 Probability theory

More information

Metainduction in Operational Set Theory

Metainduction in Operational Set Theory Metainduction in Operational Set Theory Luis E. Sanchis Department of Electrical Engineering and Computer Science Syracuse University Syracuse, NY 13244-4100 Sanchis@top.cis.syr.edu http://www.cis.syr.edu/

More information

The Dierential Lambda-Calculus

The Dierential Lambda-Calculus The Dierential Lambda-Calculus Thomas Ehrhard and Laurent Regnier Institut de Mathématiques de Luminy, C.N.R.S. U.P.R. 9016 ehrhard@iml.univ-mrs.fr and regnier@iml.univ-mrs.fr July 17, 2003 Abstract We

More information

Consistency of a Programming Logic for a Version of PCF Using Domain Theory

Consistency of a Programming Logic for a Version of PCF Using Domain Theory Consistency of a Programming Logic for a Version of PCF Using Domain Theory Andrés Sicard-Ramírez EAFIT University Logic and Computation Seminar EAFIT University 5 April, 3 May 2013 A Core Functional Programming

More information

Computation of Floating Mode Delay in Combinational Circuits: Theory and Algorithms. Kurt Keutzer. Synopsys. Abstract

Computation of Floating Mode Delay in Combinational Circuits: Theory and Algorithms. Kurt Keutzer. Synopsys. Abstract Computation of Floating Mode Delay in Combinational Circuits: Theory and Algorithms Srinivas Devadas MIT Cambridge, MA Kurt Keutzer Synopsys Mountain View, CA Sharad Malik Princeton University Princeton,

More information

The nite submodel property and ω-categorical expansions of pregeometries

The nite submodel property and ω-categorical expansions of pregeometries The nite submodel property and ω-categorical expansions of pregeometries Marko Djordjevi bstract We prove, by a probabilistic argument, that a class of ω-categorical structures, on which algebraic closure

More information

Multitape Ordinal Machines and Primitive Recursion

Multitape Ordinal Machines and Primitive Recursion Multitape Ordinal Machines and Primitive Recursion Bernhard Irrgang and Benjamin Seyerth University of Bonn, Mathematical Institute Beringstraÿe 1, D-53115 Bonn, Germany irrgang@math.uni-bonn.de, benjamin.seyfferth@gmx.de

More information

Limitations of OCAML records

Limitations of OCAML records Limitations of OCAML records The record types must be declared before they are used; a label e can belong to only one record type (otherwise fun x x.e) would have several incompatible types; we cannot

More information

Program Analysis Part I : Sequential Programs

Program Analysis Part I : Sequential Programs Program Analysis Part I : Sequential Programs IN5170/IN9170 Models of concurrency Program Analysis, lecture 5 Fall 2018 26. 9. 2018 2 / 44 Program correctness Is my program correct? Central question for

More information

Automated Reasoning Lecture 5: First-Order Logic

Automated Reasoning Lecture 5: First-Order Logic Automated Reasoning Lecture 5: First-Order Logic Jacques Fleuriot jdf@inf.ac.uk Recap Over the last three lectures, we have looked at: Propositional logic, semantics and proof systems Doing propositional

More information

LEBESGUE INTEGRATION. Introduction

LEBESGUE INTEGRATION. Introduction LEBESGUE INTEGATION EYE SJAMAA Supplementary notes Math 414, Spring 25 Introduction The following heuristic argument is at the basis of the denition of the Lebesgue integral. This argument will be imprecise,

More information

Automated Reasoning Lecture 17: Inductive Proof (in Isabelle)

Automated Reasoning Lecture 17: Inductive Proof (in Isabelle) Automated Reasoning Lecture 17: Inductive Proof (in Isabelle) Jacques Fleuriot jdf@inf.ed.ac.uk Recap Previously: Unification and Rewriting This time: Proof by Induction (in Isabelle) Proof by Mathematical

More information

2 THE COMPUTABLY ENUMERABLE SUPERSETS OF AN R-MAXIMAL SET The structure of E has been the subject of much investigation over the past fty- ve years, s

2 THE COMPUTABLY ENUMERABLE SUPERSETS OF AN R-MAXIMAL SET The structure of E has been the subject of much investigation over the past fty- ve years, s ON THE FILTER OF COMPUTABLY ENUMERABLE SUPERSETS OF AN R-MAXIMAL SET Steffen Lempp Andre Nies D. Reed Solomon Department of Mathematics University of Wisconsin Madison, WI 53706-1388 USA Department of

More information

Taming Selective Strictness

Taming Selective Strictness Taming Selective Strictness Daniel Seidel and Janis Voigtländer Technische Universität Dresden, 01062 Dresden, Germany {seideld,voigt}@tcs.inf.tu-dresden.de Abstract: Free theorems establish interesting

More information

Polynomial Space. The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem

Polynomial Space. The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem Polynomial Space The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem 1 Polynomial-Space-Bounded TM s A TM M is said to be polyspacebounded if there is a polynomial

More information

CS156: The Calculus of Computation

CS156: The Calculus of Computation Page 1 of 31 CS156: The Calculus of Computation Zohar Manna Winter 2010 Chapter 3: First-Order Theories Page 2 of 31 First-Order Theories I First-order theory T consists of Signature Σ T - set of constant,

More information

Introduction to Arti Intelligence

Introduction to Arti Intelligence Introduction to Arti Intelligence cial Lecture 4: Constraint satisfaction problems 1 / 48 Constraint satisfaction problems: Today Exploiting the representation of a state to accelerate search. Backtracking.

More information

Applied Mathematics &Optimization

Applied Mathematics &Optimization Appl Math Optim 29: 211-222 (1994) Applied Mathematics &Optimization c 1994 Springer-Verlag New Yor Inc. An Algorithm for Finding the Chebyshev Center of a Convex Polyhedron 1 N.D.Botin and V.L.Turova-Botina

More information

Proof Techniques (Review of Math 271)

Proof Techniques (Review of Math 271) Chapter 2 Proof Techniques (Review of Math 271) 2.1 Overview This chapter reviews proof techniques that were probably introduced in Math 271 and that may also have been used in a different way in Phil

More information

THE LANGUAGE OF FIRST-ORDER LOGIC (FOL) Sec2 Sec1(1-16)

THE LANGUAGE OF FIRST-ORDER LOGIC (FOL) Sec2 Sec1(1-16) THE LANGUAGE OF FIRST-ORDER LOGIC (FOL) Sec2 Sec1(1-16) FOL: A language to formulate knowledge Logic is the study of entailment relationslanguages, truth conditions and rules of inference. FOL or Predicate

More information