Computational Semantics, Type Theory, and Functional Programming


 Christopher McDonald
 1 years ago
 Views:
Transcription
1 Computational Semantics, Type Theory, and Functional Programming I Converting Montague Grammarians into Programmers Jan van Eijck CWI and ILLC, Amsterdam, UilOTS, Utrecht LOLA7 Tutorial, Pecs August 2002
2 Summary Functional Expressions and Types Type Theory, Type Polymorphism [Hin97] Functional Programming Representing Semantic Knowledge in Type Theory Building a Montague Fragment [Mon73] Datastructures for Syntax Semantic Interpretation
3 Functional Expressions and Types According to Frege, the meaning of John arrived can be represented by a function argument expression Aj where A denotes a function and j an argument to that function. The expression A does not reveal that it is supposed to combine with an individual term to form a formula (an expression denoting a truth value). One way to make this explicit is by means of lambda notation. The function expression of this example is then written as (λx.ax). It is also possible to be even more explicit, and write λx.(ax) :: e t to indicate the type of the expression, or even: (λx e.a e t x) e t.
4 Definition of Types The set of types over e, t is given by the following BNF rule: T ::= e t (T T ). The basic type e is the type of expressions denoting individual objects (or entities). The basic type t is the type of formulas (of expressions which denote truth values). Complex types are the types of functions. For example, (e t) or e t is the type of functions from entities to truth values. In general: T 1 T 2 is the type of expressions denoting functions from denotations of T 1 expressions to denotations of T 2 expressions.
5 Picturing a Type Hierarchy The types e and t are given. Individual objects or entities are objects taken from some domain of discussion D, so e type expressions denote objects in D. The truth values are {0, 1}, so type t expression denotes values in {0, 1}. For complex types we use recursion. This gives: D e = D, D t = {0, 1}, D A B = D B D A. Here D B D A denotes the set of all functions from D A to D B.
6 A function with range {0, 1} is called a characteristic function, because it characterizes a set (namely, the set of those things which get mapped to 1). If T is some arbitrary type, then any member of D T t is a characteristic function. The members of D e t, for instance, characterize subsets of the domain of individuals D e. As another example, consider D (e t) t. According to the type definition this is the domain of functions D t D e t, i.e., the functions in {0, 1} D e t. These functions characterize sets of subsets of the domain of individuals D e.
7 Types of Relations As a next example, consider the domain D e (e t). Assume for simplicity that D e is the set {a, b, c}. Then we have: D e (e t) = D e t D e = (D D e t ) De = ({0, 1} {a,b,c} ) {a,b,c}. Example element of D e (e t) : a b c a 1 b 0 c 0 a 0 b 1 c 1 a 0 b 0 c 1
8 The elements of D e (e t) can in fact be regarded as functional encodings of twoplaced relations R on D e, for a function in D e (e t) maps every element d of D e to (the characteristic function of) the set of those elements of D e that are Rrelated to d.
9 Types for Propositional Functions Note that D t t has precisely four members, namely: identity negation constant 1 constant The elements of D t (t t) are functions from the set of truth values to the functions in D t t, i.e., to the set of four functions pictured above. As an example, here is the function which maps 1 to the constant 1 function, and 0 to the identity: ( ) ( )
10 We can view this as a two step version of the semantic operation of taking a disjunction. If the truth value of its first argument is 1, then the disjunction becomes true, and the truth value of the second argument does not matter (hence the constant 1 function). 1 ( If the truth value of the first argument is 0, then the truth value of the disjunction as a whole is determined by the truth value of the second argument (hence the identity function). 0 ( ) )
11 Types in Haskell In this section we take a brief look at how types appear in the functional programming language Haskell [HFP96, JH + 99, Bir98, DvE02]. For Haskell, see: The text inside the boxes is literal Haskell code. For convenience we collect the code of this tuturial in a module. The present module is called LOLA1. module LOLA1 where import Domain import Model
12 In Haskell, the type for truthvalues is called Bool. Thus, the type for the constant function that maps all truth values to 1 is Bool > Bool. The truth value 1 appears in Haskell as True, the truth value 0 as False. The definitions of the constant True and the constant False function in Haskell run as follows: c1 :: Bool > Bool c1 _ = True c0 :: Bool > Bool c0 _ = False The definitions consist of a type declaration and a value specification. Whatever argument you feed c1, the result will be True. Whatever argument you give c0, the result will be False. The underscore is used for any value whatsoever.
13 An equivalent specification of these functions runs as follows: c1 :: Bool > Bool c1 = \ p > True c0 :: Bool > Bool c0 = \ p > False The function in Bool > Bool that swaps the two truth values is predefined in Haskell as not. The identity function is predefined in Haskell as id. This function has the peculiarity that it has polymorphic type: it can be used as the identity for any type for which individuation makes sense.
14 In Haskell, the disjunction function will have type Bool > Bool > Bool This type is read as Bool > (Bool > Bool). Implementation of disj, in terms of c1 and id: disj :: Bool > Bool > Bool disj True = c1 disj False = id Alternative: disj :: Bool > Bool > Bool disj = \ p > if p then c1 else id
15 Type Polymorphism The id function: id :: a > a id x = x A function for arity reduction: self :: (a > a > b) > a > b self f x = f x x This gives: LOLA1> self (<=) 3 True
16 Properties, Relations The polymorphic type of a property is a > Bool. Examples: (>= 0), (<> x), even. The polymorphic type of a relation is a > b > Bool. The polymorphic type of a relation over a single type is a > a > Bool. Examples: (<), (<=), (==).
17 List Types Examples of list types: [Int] is the type of lists of integers, [Char] is the type of lists of characters, or strings, [Bool] is the type of lists of Booleans, and so on. If a is a type, [a] is the type of lists over a. Note that [a] is a polymorphic type. [] is the empty list (of any type). (x:xs) is the prototypical nonempty list. The head of (x:xs) is x, the tail is xs.
18 List Comprehension List comprehension is the list counterpart of set comprehension: {x x A, P (x)} LOLA1> [ n n < [0..20], n mod 7 == 1 ] [1,8,15] LOLA1> [ 2^n n < [0..10] ] [1,2,4,8,16,32,64,128,256,512,1024] LOLA1> [ w ++ w w < ["ab","cd","eef"] ] ["abab","cdcd","eefeef"]
19 The map Function The function map takes a function and a list and returns a list containing the results of applying the function to the individual list members. If f is a function of type a > b and xs is a list of type [a], then map f xs will return a list of type [b]. map :: (a > b) > [a] > [b] map f [] = [] map f (x:xs) = (f x) : map f xs E.g., map (^2) [1..9] will produce the list of squares: [1, 4, 9, 16, 25, 36, 49, 64, 81]
20 The filter Function The filter function takes a property and a list, and returns the sublist of all list elements satisfying the property. filter :: (a > Bool) > [a] > [a] filter p [] = [] filter p (x:xs) p x = x : filter p xs otherwise = filter p xs LOLA1> filter even [1..10] [2,4,6,8,10]
21 Function Composition For the composition f. g to make sense, the result type of g should equal the argument type of f, i.e., if f :: a > b then g :: c > a. Under this typing, the type of f. g is c > b. Thus, the operator (.) that composes two functions has the following type and definition: (.) :: (a > b) > (c > a) > c > b (f. g) x = f (g x)
22 A Domain of Entities To illustrate the type e, we construct a small example domain of entities consisting of individuals A,..., M, by declaring a datatype Entity. module Domain where data Entity = A B C D E F G H I J K L M deriving (Eq,Bounded,Enum,Show) The stuff about deriving (Eq,Bounded,Enum,Show) is there to enable us to do equality tests on entities (Eq), to refer to A as the minimum element and M as the maximum element (Bounded), to enumerate the elements (Enum), and to display the elements on the screen (Show).
23 Because Entity is a bounded and enumerable type, we can put all of its elements in a finite list: entities :: [Entity] entities = [minbound..maxbound] This gives: CompSem1> entities [A,B,C,D,E,F,G,H,I,J,K,L,M]
24 r :: Entity > Entity > Bool r A A = True r A _ = False r B B = True r B C = True r B _ = False r C C = True r = False
25 This gives: LOLA1> r A B False LOLA1> r A A True
26 Using lambda abstraction, we can select sublists of a list that satisfy some property we are interested in. Suppose we are interested in the property of being related by r to the element B. This property can be expressed using λ abstraction as λx.(rb)x. In Haskell, this same property is expressed as (\ x > r B x). Using a property to create a sublist is done by means of the filter operation. Here is how we use filter to find the list of entities satisfying the property: LOLA1> filter (\ x > r B x) entities [B,C] With negation, we can express the complement of this property. This gives: LOLA1> filter (\ x > not (r B x)) entities [A,D,E,F,G,H,I,J,K,L,M]
27 Here is how disj is used to express the property of being either related to a or to b: LOLA1> filter (\ x > disj (r A x) (r B x)) entities [A,B,C] Haskell has a predefined infix operator that serves the same purpose as disj. Instead of the above, we could have used the following: LOLA1> filter (\ x > (r A x) (r B x)) entities [A,B,C] Similarly, Haskell has a predefined infix operator && for conjunction.
28 The Language of Typed Logic and Its Semantics Assume that we have constants and variables available for all types in the type hierarchy. Then the language of typed logic over these is defined as follows. type ::= e t (type type) expression ::= constanttype variabletype (λ variabletype 1.expressiontype 2 )type 1 type 2 (expressiontype 1 type 2 expressiontype 1 )type 2 For an expression of the form (E 1 E 2 ) to be welltyped the types have to match. The type of the resulting expression is fully determined by the types of the components. Similarly, the type of a lambda expression (λv.e) is fully determined by the types of v and E.
29 Often we leave out the type information. The definition of the language then looks like this: expression ::= constant variable (λ variable.expression) (expression expression)
30 Models for Typed Logic A model M for a typed logic over e, t consists of a domain dom (M) = D e together with an interpretation function int (M) = I which maps every constant of the language to a function of the appropriate type in the domain hierarchy based on D e. A variable assignment s for typed logic maps every variable of the language to a function of the appropriate type in the domain hierarchy. The semantics for the language is given by defining a function [.] M s which maps every expression of the language to a function of the appropriate type.
31 [constant] M s = I(constant). [variable] M s = s(variable). [(λv T1.E T2 )] M s = h where h is the function given by h : d D T1 [E ] M s(v d) D T 2. [(E 1 E 2 )] M s = [E 1 ] M s ([E 2 ] M s ).
32 Assume that (((Gc)b)a) expresses that a gives b to c. What do the following expressions say: 1. (λx.(((gc)b)x)). giving b to c 2. (λx.(((gc)x)a)). being a present of a to c 3. (λx.(((gx)b)a)). receiving b from a 4. (λx.(((gx)b)x)). giving b to oneself.
33 Assume that (((Gc)b)a) expresses that a gives b to c. What do the following expressions say: 1. (λx.(λy.(((gx)b)y))). giving b 2. (λx.(λy.(((gy)b)x))). receiving b.
34 Logical Constants of Predicate Logic The logical constants of predicate logic can be viewed as constants of typed logic, as follows. is a constant of type t t with the following interpretation. [ ] = h, where h is the function in {0, 1} {0,1} which maps 0 to 1 and vice versa. and are constants of type t t t with the following interpretations. [ ] = h, where h is the function in ({0, 1} {0,1} ) {0,1} which maps 1 to {(1, 1), (0, 0)} and 0 to {(1, 0), (0, 0)}. [ ] = h, where h is the function in ({0, 1} {0,1} ) {0,1} which maps 1 to {(1, 1), (0, 1)} and 0 to {(1, 1), (0, 0)}.
35 not not True not False :: Bool > Bool = False = True (&&) :: Bool > Bool > Bool False && x = False True && x = x ( ) :: Bool > Bool > Bool False x = x True x = True
36 Quantifiers of Predicate Logic The quantifiers and are constants of type (e t) t, with the following interpretations. [ ] = h, where h is the function in {0, 1} D e t which maps the function that characterizes D e to 1 and every other characteristic function to 0. [ ] = h, where h is the function in {0, 1} D e t which maps the function that characterizes to 0 and every other characteristic function to 1.
37 Second Order and Polymorphic Quantification It is possible to add constants for quantification over different types. E.g., to express second order quantification (i.e., quantification over properties of things), one would need quantifier constants of type ((e t) t) t. The general (polymorphic) type of quantification is (T t) t.
38 Haskell implementation of quantification: any, all :: (a > Bool) > [a] > Bool any p = or. map p all p = and. map p Definition of forall and exists for bounded enumerable domains, in terms of these: forall, exists :: (Enum a, Bounded a) => (a > Bool) > Bool forall = \ p > all p [minbound..maxbound] exists = \ p > any p [minbound..maxbound]
39 What is the type of binary generalized quantifiers such as Q (λx.p x)(λx.qx) Q (λx.p x)(λx.qx) Q M (λx.p x)(λx.qx) ( all P are Q ) ( some P are Q ) ( most P are Q ) (e t) (e t) t.
40 Implementation of binary generalized quantifiers: every, some, no :: (Entity > Bool) > (Entity > Bool) > Bool every = \ p q > all q (filter p entities) some = \ p q > any q (filter p entities) no = \ p q > not (some p q)
41 most :: (Entity > Bool) > (Entity > Bool) > Bool most = \ p q > length (filter (\ x > p x && q x) entities) > length (filter (\ x > p x && not (q x)) entities)
42 The P is Q is true just in case 1. there is exactly one P, 2. that P is Q.
43 singleton :: [a] > Bool singleton [x] = True singleton _ = False the :: (Entity > Bool) > (Entity > Bool) > Bool the = \ p q > singleton (filter p entities) && q (head (filter p entities))
44 Typed Logic and Predicate Logic With the constants,,,, added, the language of typed logic contains ordinary predicate logic as a proper fragment. Here are some example expressions of typed logic, with their predicate logical counterparts: ( (P x)) (( (P x))(qy)) ( (λx.p x)) ( (λx.( (λy.((ry)x))))) P x P x Qy xp x x yrxy Note the order of the arguments in ((Ry)x) versus Rxy.
45 Curry and Uncurry The conversion of a function of type (a,b) > c to one of type a > b > c is called currying (named after Haskell Curry). curry is predefined in Haskell: curry :: ((a,b) > c) > (a > b > c) curry f x y = f (x,y) The conversion of a function of type a > b > c to one of type (a,b) > c is called uncurrying, uncurry :: (a > b > c) > ((a,b) > c) uncurry f p = f (fst p) (snd p)
46 LOLA1> r B C True LOLA1> (uncurry r) (B,C) True As we also want the arguments in the other order, what we need is: 1. first flip the arguments, 2. next uncurry the function. inv2 :: (a > b > c) > ((b,a) > c) inv2 = uncurry. flip LOLA1> inv2 r (C,B) True
47 For the converse operation, we combine curry with flip, as follows: flip. curry. LOLA1> (flip. curry. inv2) r B C True
48 Conversion for Three Placed Relations For threeplaced relations, we need to convert from and too triples, and for that appropriate definitions are needed for selecting the first, second or third element from a triple. e1 e1 (x,y,z) e2 e2 (x,y,z) e3 e3 (x,y,z) :: (a,b,c) > a = x :: (a,b,c) > b = y :: (a,b,c) > c = z inv3 :: (a > b > c > d) > ((c,b,a) > d) inv3 f t = f (e3 t) (e2 t) (e1 t)
49 Here is a definition of a threeplaced relation in Haskell: g :: Entity > Entity > Entity > Bool g D x y = r x y g E x y = not (r x y) g _ = False This gives: LOLA1> g E B C False LOLA1> g E C B True LOLA1> inv3 g (B,C,E) True LOLA1>
50 Assume R is a typed logical constant of type e (e t) which is interpreted as the twoplaced relation of respect between individuals. Then ((Rb)a) expresses that a respects b. In abbreviated notation this becomes R(a, b). Now λx. yr(x, y) is abbreviated notation for respecting someone, and λx. yr(x, y) for being respected by someone. If G(a, b, c) is shorthand for a gives b to c, then λx. y zg(x, y, z) expresses giving something to someone, and λx. yg(x, b, y) expresses giving b to someone. Finally, λx. yg(y, b, x) expresses receiving b from someone. Assume G(x, y, z), which is short for (((Gz)y)x), means that x gives y to z. Use this to find a typed logic expression for receiving something from someone. λx. y zg(y, z, x).
51 Suppose we want to translate Anne gave Claire the book, which has syntactic structure [ S [ NP Anne ][ V P [ T V [ DT V gave][ NP Claire ]][ NP the book ]]] in a compositional way, using λzyx.g(x, y, z) as translation for give. Translating all the combinations of phrases as function argument combination, we arrive at the following translation of the sentence. 1 (((λzyx.g(x, y, z)c)b)a). This does indeed express what we want, but in a rather roundabout way. We would like to reduce this expression to G(a, b, c).
52 Reducing Expressions of Typed Logic To reduce expression (1) to its simplest form, three steps of socalled β conversion are needed. During β conversion of an expression consisting of a functor expression λv.e followed by an argument expression A, basically the following happens: The prefix λv. is removed, the argument expression A is removed, and finally the argument expression A is substituted in E for all free occurrences of v. The free occurrences of v in E are precisely the occurrences which were bound by λv in λv.e. Here is the proviso. In some cases, the substitution process described above cannot be applied without further ado, because it will result in unintended capturing of variables within the argument expression A.
53 Consider expression (2): 2 ((λx.(λy.((ry)x)))y). In this expression, y is bound in the functional part (λx.(λy.((ry)x))) but free in the argument part y. Reducing (2) by β conversion according to the recipe given above would result in (λy.((ry)y)), with capture of the argument y at the place where it is substituted for x. This problem can be avoided by performing β conversion on an alphabetic variant of the original expression, say on (3). 3 ((λx.(λz.((rz)x)))y).
54 Another example where α conversion (i.e., switching to an alphabetic variant) is necessary before β conversion to prevent unintended capture of free variables is the expression (4). 4 ((λp. x((ax) p))(bx)). In (4), p is a variable of type t, and x one of type e. Variable x is bound inside the functional part (λp. x((ax) p)) but free in the argument part (Bx). Substituting (Bx) for p in the function expression would cause x to be captured, with failure to preserve the original meaning. Again, the problem is avoided if β conversion is performed on an alphabetic variant of the original expression, say on (5). 5 ((λp. z((az) p))(bx)). Performing β reduction on (5) yields z.((ax) (Bx)), with the argument of B still free, as it should be.
55 Freedom, Bondage, Substitution Variable v is free in expression E if the following holds (we use for the relation of being syntactically identical, i.e. for being the same expression): v E, E (E 1 E 2 ), and v is free in E 1 or v is free in E 2, E (λx.e 1 ), and v x, and v is free in E 1. Examples of free occurrences of x: (λx.(p x)), ((λx.(p x))x), (λx.((rx)x)), ((λx.((rx)x))x), ((λy.((rx)y))x).
56 Which occurrences of x are free in ((λy. x((rx)y))x)? Bear in mind that x((rx)y) is shorthand for ( (λx.((rx)y))). ((λy. x((rx)y))x).
57 Substitution of y for x in (λy.(p x)): (λy.(p x))[x := y]. The function (λy.(p x)) is the function yielding (P x) for any argument, i.e., the constant (P x) function. It is easy to get this substitution wrong: (λy.(p x))[x := y] (λy.(p x)[x := y]) (λy.(p y)). This is a completely different function, namely the function that assigns to argument a the result of applying P to a. By doing an appropriate renaming, we get the correct result: (λy.(p x))[x := y] (λz.(p x)[y := z][x := y]) (λz.(p x)[x := y]) (λz.(p y)).
58 Substitution of s for free occurrences of v in E, with notation E[v := s]. If E v then E[v := s] s, if E x v (i.e., E is a variable different from v), then E[x := s] x, if E c (i.e., E is a constant), then E[x := s] c, if E (E 1 E 2 ) then E[v := s] (E 1 [v := s] E 2 [v := s]), if E (λx.e 1 ), then if v x then E[v := s] E, if v x then there are two cases: 1. if x is not free in s or v is not free in E then E[v := s] (λx.e 1 [v := s]), 2. if x is free in s and v is free in E then E[v := s] (λy.e 1 [x := y][v := s]), for some y which is not free in s and not free in E 1.
59 Reduction Reduction comes in three flavours: β reduction, α reduction and η β α reduction, with corresponding arrows, and. η Beta reduction: ((λv.e)s) β E[v := s]. Condition: v and s are of the same type (otherwise the expression to be reduced is not welltyped). Alpha reduction: (λv.e) α (λx.e[v := x]). Conditions: v and x are of the same type, and x is not free in E. Eta reduction: ((λv.e)v) η E.
60 The real work takes place during β reduction. The α reduction rule serves only to state in an explicit fashion that λ calculations are insensitive to switches to alphabetic variants. Whether one uses λx to bind occurrences of x or λy to bind occurrences of y is immaterial, just like it is immaterial in the case of predicate logic whether one writes xp x or yp y. The η reduction rule makes a principle explicit that we have used implicitly all the time: if (P j) expresses that John is present, then both P and (λx.(p x)) express the property of being present. This is so η because ((λx.(p x))x) (P x), so P and (λx.(p x)) give the same result when applied to argument x, i.e., they express the same function.
61 Applying β reduction to (((λzyx.g(x, y, z)c)b)a), or in unabbreviated notation ((((λz.(λy.(λx.(((gz)y)x))))c)b)a), gives: ((((λz.(λy.(λx.(((gz)y)x))))c)b)a) β (((λy.(λx.(((gc)y)x)))b)a) β ((λx.(((gc)b)x))a) β (((Gc)b)a).
62 To be fully precise we have to state explicitly that expressions can be reduced in context. The following principles express this: β E E β (F E) (F E ) β E E β (λv.e) (λv.e ) Here F is assumed to have the appropriate type. β E E β (EF ) (E F ) These principles allow β reductions at arbitrary depth within expressions.
63 Reduce the following expressions to their simplest forms: 1. ((λy.(λx.(y x)))p ). λx.(p x). 2. (((λy.(λx.(y x)))p )y). (P y). 3. ((λp.(λq. x(p x Qx)))A). (λq. x(ax Qx)). 4. (((λp.(λq. x(p x Qx)))A)B). x(ax Bx). 5. ((λp.(λq. x(p x Qx)))(λy.((λx.((Ry)x))j))). (λq. x((λz.((rj)z)x) Qx)) (λq. x(((rj)x) Qx)).
64 Confluence Property In the statement of the following property, we write E E for E reduces in a number of α, β, η steps to E. Confluence property (or: ChurchRosser property): For all expressions E, E 1, E 2 of typed logic: if E E 1 and E E 2 then there is an expression F with E 1 F and E 2 F.
65 Normal Form Property An expression of the form ((λv.e)s) is called a βredex (for: β reducible expression). E[v := s] is called the contractum of ((λv.e)s). An expression that does not contain any redexes is called a normal form. Normal form property: Every expression of typed logic can be reduced to a normal form. Combining the confluence property and the normal form property we get that the normal forms of an expression E are identical modulo α conversion. That is to say, all normal forms of E are alphabetic variants of one another.
66 The normal form property holds thanks to the restrictions imposed by the typing discipline. Untyped lambda calculus lacks this property. In untyped lambda calculus it is allowed to apply expressions to themselves. In typed lambda calculus this is forbidden, because (xx) cannot be consistently typed. In untyped lambda calculus, expressions like (λx.(xx)) are wellformed. It is easy to see that does not have a normal form. ((λx.(xx))(λx.(xx)))
67 Misleading Form and Logical Form The metamorphosis of β conversion is relevant for an enlightened view on the historical misleading form thesis for natural language. The predicate logical translations of natural language sentences with quantified expressions did not seem to follow the linguistic structure. In the logical translations, the quantified expressions seemed to have disappeared. Using expressions of typed logic it is quite simple to analyse John smiled and Noone smiled along the same lines: The subject NPs get the translations: λp.p j and λp. x.((person x) (P x)).
68 Representing a Model for Predicate Logic in Haskell All we need to specify a first order model in Haskell is a domain of entities and suitable interpretations of proper names and predicates. The domain of entities was given above as Entity. module Model where import Domain
69 Interpretation for proper names: ann, mary, bill, johnny :: Entity ann = A mary = M bill = B johnny = J
70 man,boy,woman,person,thing,house :: Entity > Bool man x = x == B x == D x == J woman x = x == A x == C x == M boy x = x == J person x = man x woman x thing x = not (person x) house x = x == H cat x = x == K mouse x = x == I
71 laugh,cry,curse,smile,old,young :: Entity > Bool laugh x = x == M x == C x == B x == D x == J cry x = x == B x == D curse x = x == J x == A smile x = x == M x == B x == I x == K young x = x == J old x = x == B x == D
72 Meanings for twoplaced predicates, represented as (Entity,Entity) > Bool. love,respect,hate,own :: (Entity,Entity) > Bool love (x,y) = (x == B && (y == M y == A)) (woman x && (y == J y == B)) respect (x,y) = person x && person y x == F x == I hate (x,y) = ((x == B x == J) && thing y) (x == I && y == K) own (x,y) = (x ==A && y == E) (x == M && (y == K y == H))
73 Montague Grammar: Datastructures for Syntax data S = S NP VP deriving (Eq,Show) data NP = Ann Mary Bill Johnny NP1 DET CN NP2 DET RCN deriving (Eq,Show) data DET = Every Some No The Most deriving (Eq,Show) data CN = Man Woman Boy Person Thing House Cat Mouse deriving (Eq,Show)
74 data RCN = CN1 CN VP CN2 CN NP TV deriving (Eq,Show) data VP = Laughed Smiled VP1 TV NP deriving (Eq,Show) data TV = Loved Respected Hated Owned deriving (Eq,Show)
75 Semantic Interpretation We define for every syntactic category an interpretation function of the appropriate type. Sentences: ints :: S > Bool ints (S np vp) = (intnp np) (intvp vp)
76 Noun Phrases: intnp :: NP > (Entity > Bool) > Bool intnp Ann = \ p > p ann intnp Mary = \ p > p mary intnp Bill = \ p > p bill intnp Johnny = \ p > p johnny intnp (NP1 det cn) = (intdet det) (intcn cn) intnp (NP2 det rcn) = (intdet det) (intrcn rcn)
77 For the interpretation of verb phrases we invoke the information encoded in our first order model. intvp :: VP > Entity > Bool intvp Laughed = laugh intvp Smiled = smile For the interpretation of complex VPs, we have to find a way to make reference to the property of standing into the TV relation to the subject of the sentence. intvp (VP1 tv np) = \ subj > intnp np (\ obj > inttv tv obj subj)
78 TVs: link up with model information. inttv :: TV > Entity > Entity > Bool inttv Loved = (flip. curry) love inttv Respected = (flip. curry) respect inttv Hated = (flip. curry) hate inttv Owned = (flip. curry) own
79 The interpreation of CNs is similar to that of VPs. intcn :: CN > Entity > Bool intcn Man = man intcn Boy = boy intcn Woman = woman intcn Person = person intcn Thing = thing intcn House = house
80 Determiners: use the logical constants defined above. intdet :: DET > (Entity > Bool) > (Entity > Bool) > Bool intdet Every = every intdet Some = some intdet No = no intdet The = the
81 Interpretation of relativised common nouns of the form That CN VP: check whether an entity has both the CN and the VP property: intrcn :: RCN > Entity > Bool intrcn (CN1 cn vp) = \ e > ((intcn cn e) && (intvp vp e)) Interpretation of relativised common nouns of the form That CN NP TV : check whether an entity has both the CN property as the property of being the object of NP TV. intrcn (CN2 cn np tv) = \e > ((intcn cn e) && (intnp np (inttv tv e)))
82 Testing it Out LOLA1> ints (S (NP1 The Boy) Smiled) False LOLA1> ints (S (NP1 The Boy) Laughed) True LOLA1> ints (S (NP1 Some Man) Laughed) True LOLA1> ints (S (NP1 No Man) Laughed) False LOLA1> ints (S (NP1 Some Man) (VP1 Loved (NP1 Some Woman))) True
83 Further Issues Syntax: if there is time. Quantifyingin: application of NP denotations to PROabstractions. Intensionality: add a type w for worlds, and build the type hierarchy over t, e, w. Flexible typing Anaphoric linking: classical variable binding is not enough... Next Lecture: The Dynamic Turn
84 References [Bir98] R. Bird. Introduction to Functional Programming Using Haskell. Prentice Hall, [DvE02] K. Doets and J. van Eijck. Reasoning, computation and representation using Haskell. Draft Textbook. Available from [HFP96] P. Hudak, J. Fasel, and J. Peterson. A gentle introduction to Haskell. Technical report, Yale University, Available from the Haskell homepage: [Hin97] J. Roger Hindley. Basic Simple Type Theory. Cambridge University Press, [JH + 99] S. Peyton Jones, J. Hughes, et al. Report on the programming
85 language Haskell 98. Available from the Haskell homepage: [Mon73] R. Montague. The proper treatment of quantification in ordinary English. In J. Hintikka e.a., editor, Approaches to Natural Language, pages Reidel, 1973.
Predicate Calculus. There are certain arguments that seem to be perfectly logical, yet they cannot be expressed by using propositional calculus.
Predicate Calculus (Alternative names: predicate logic, first order logic, elementary logic, restricted predicate calculus, restricted functional calculus, relational calculus, theory of quantification,
More informationPredicate Logic Review
Predicate Logic Review UC Berkeley, Philosophy 142, Spring 2016 John MacFarlane 1 Grammar A term is an individual constant or a variable. An individual constant is a lowercase letter from the beginning
More informationDeterministic Discrete Modeling
Deterministic Discrete Modeling Formal Semantics of Firewalls in Isabelle/HOL Cornelius Diekmann, M.Sc. Dr. Heiko Niedermayer Prof. Dr.Ing. Georg Carle Lehrstuhl für Netzarchitekturen und Netzdienste
More information2. The Language of Firstorder Logic
2. The Language of Firstorder Logic KR & R Brachman & Levesque 2005 17 Declarative language Before building system before there can be learning, reasoning, planning, explanation... need to be able to
More informationChapter 7: Functional Programming Languages
Chapter 7: Functional Programming Languages Aarne Ranta Slides for the book Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, 2012. Fun: a language
More informationMathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson
Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement
More informationCHAPTER 7 GENERAL PROOF SYSTEMS
CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes
More information3. Predicates and Quantifiers
3. PREDICATES AND QUANTIFIERS 45 3. Predicates and Quantifiers 3.1. Predicates and Quantifiers. Definition 3.1.1. A predicate or propositional function is a description of the property (or properties)
More informationPredicate Logic. For example, consider the following argument:
Predicate Logic The analysis of compound statements covers key aspects of human reasoning but does not capture many important, and common, instances of reasoning that are also logically valid. For example,
More informationIntroduction to Predicate Logic. Ling324 Reading: Meaning and Grammar, pg
Introduction to Predicate Logic Ling324 Reading: Meaning and Grammar, pg. 113141 Usefulness of Predicate Logic for Natural Language Semantics While in propositional logic, we can only talk about sentences
More information(LMCS, p. 317) V.1. First Order Logic. This is the most powerful, most expressive logic that we will examine.
(LMCS, p. 317) V.1 First Order Logic This is the most powerful, most expressive logic that we will examine. Our version of firstorder logic will use the following symbols: variables connectives (,,,,
More informationType Classes with Functional Dependencies
Appears in Proceedings of the 9th European Symposium on Programming, ESOP 2000, Berlin, Germany, March 2000, SpringerVerlag LNCS 1782. Type Classes with Functional Dependencies Mark P. Jones Department
More informationDiscrete Mathematics, Chapter : Predicate Logic
Discrete Mathematics, Chapter 1.41.5: Predicate Logic Richard Mayr University of Edinburgh, UK Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapter 1.41.5 1 / 23 Outline 1 Predicates
More informationPredicate Logic. Example: All men are mortal. Socrates is a man. Socrates is mortal.
Predicate Logic Example: All men are mortal. Socrates is a man. Socrates is mortal. Note: We need logic laws that work for statements involving quantities like some and all. In English, the predicate is
More informationThe compositional semantics of same
The compositional semantics of same Mike Solomon Amherst College Abstract Barker (2007) proposes the first strictly compositional semantic analysis of internal same. I show that Barker s analysis fails
More informationSJÄLVSTÄNDIGA ARBETEN I MATEMATIK
SJÄLVSTÄNDIGA ARBETEN I MATEMATIK MATEMATISKA INSTITUTIONEN, STOCKHOLMS UNIVERSITET Automated Theorem Proving av Tom Everitt 2010  No 8 MATEMATISKA INSTITUTIONEN, STOCKHOLMS UNIVERSITET, 106 91 STOCKHOLM
More informationSemantics and Generative Grammar. Quantificational DPs, Part 3: Covert Movement vs. Type Shifting 1
Quantificational DPs, Part 3: Covert Movement vs. Type Shifting 1 1. Introduction Thus far, we ve considered two competing analyses of sentences like those in (1). (1) Sentences Where a Quantificational
More informationFormal Engineering for Industrial Software Development
Shaoying Liu Formal Engineering for Industrial Software Development Using the SOFL Method With 90 Figures and 30 Tables Springer Contents Introduction 1 1.1 Software Life Cycle... 2 1.2 The Problem 4 1.3
More informationPredicate logic is an Extension of sentence logic. Several new vocabulary items are found in predicate logic.
Atomic Sentences of Predicate Logic Predicate Logic and Sentence Logic Predicate logic is an Extension of sentence logic. All items of the vocabulary of sentence logic are items of the vocabulary of predicate
More informationCMCS 312: Programming Languages Lecture 3: Lambda Calculus (Syntax, Substitution, Beta Reduction) Acar & Ahmed 17 January 2008
CMCS 312: Programming Languages Lecture 3: Lambda Calculus (Syntax, Substitution, Beta Reduction) Acar & Ahmed 17 January 2008 Contents 1 Announcements 1 2 Introduction 1 3 Abstract Syntax 1 4 Bound and
More information1.4 Predicates and Quantifiers
Can we express the following statement in propositional logic? Every computer has a CPU No 1 Can we express the following statement in propositional logic? No Every computer has a CPU Let's see the new
More informationParametric Domaintheoretic models of Linear Abadi & Plotkin Logic
Parametric Domaintheoretic models of Linear Abadi & Plotkin Logic Lars Birkedal Rasmus Ejlers Møgelberg Rasmus Lerchedahl Petersen IT University Technical Report Series TR007 ISSN 600 600 February 00
More informationFunctional Programming. Functional Programming Languages. Chapter 14. Introduction
Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The
More informationParaphrasing controlled English texts
Paraphrasing controlled English texts Kaarel Kaljurand Institute of Computational Linguistics, University of Zurich kaljurand@gmail.com Abstract. We discuss paraphrasing controlled English texts, by defining
More informationThe Syntax of Predicate Logic
The Syntax of Predicate Logic LX 502 Semantics I October 11, 2008 1. Below the SentenceLevel In Propositional Logic, atomic propositions correspond to simple sentences in the object language. Since atomic
More informationPREDICATE LOGIC. 1 Basic Concepts. Jorma K. Mattila LUT, Department of Mathematics and Physics
PREDICATE LOGIC Jorma K. Mattila LUT, Department of Mathematics and Physics 1 Basic Concepts In predicate logic the formalism of propositional logic is extended and is made it more finely build than propositional
More informationPOLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful
POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/
More informationRegular Expressions and Automata using Haskell
Regular Expressions and Automata using Haskell Simon Thompson Computing Laboratory University of Kent at Canterbury January 2000 Contents 1 Introduction 2 2 Regular Expressions 2 3 Matching regular expressions
More informationThe Clean programming language. Group 25, Jingui Li, Daren Tuzi
The Clean programming language Group 25, Jingui Li, Daren Tuzi The Clean programming language Overview The Clean programming language first appeared in 1987 and is still being further developed. It was
More informationCorrespondence analysis for strong threevalued logic
Correspondence analysis for strong threevalued logic A. Tamminga abstract. I apply Kooi and Tamminga s (2012) idea of correspondence analysis for manyvalued logics to strong threevalued logic (K 3 ).
More informationWe will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.
LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.
More informationSoftware Engineering
Software Engineering Lecture 04: The B Specification Method Peter Thiemann University of Freiburg, Germany SS 2013 Peter Thiemann (Univ. Freiburg) Software Engineering SWT 1 / 50 The B specification method
More informationChapter 15 Functional Programming Languages
Chapter 15 Functional Programming Languages Introduction  The design of the imperative languages is based directly on the von Neumann architecture Efficiency (at least at first) is the primary concern,
More informationSounds Like Like. Peter Lasersohn. University of Rochester. Abstract: It is argued that the verb sound is ambiguous between
Sounds Like Like Peter Lasersohn University of Rochester Abstract: It is argued that the verb sound is ambiguous between one reading where it denotes a twoplace relation between individuals and properties,
More informationRemarks on NonFregean Logic
STUDIES IN LOGIC, GRAMMAR AND RHETORIC 10 (23) 2007 Remarks on NonFregean Logic Mieczys law Omy la Institute of Philosophy University of Warsaw Poland m.omyla@uw.edu.pl 1 Introduction In 1966 famous Polish
More information4 Domain Relational Calculus
4 Domain Relational Calculus We now present two relational calculi that we will compare to RA. First, what is the difference between an algebra and a calculus? The usual story is that the algebra RA is
More informationLogic in Computer Science: Logic Gates
Logic in Computer Science: Logic Gates Lila Kari The University of Western Ontario Logic in Computer Science: Logic Gates CS2209, Applied Logic for Computer Science 1 / 49 Logic and bit operations Computers
More informationSentence Semantics. General Linguistics Jennifer Spenader, February 2006 (Most slides: Petra Hendriks)
Sentence Semantics General Linguistics Jennifer Spenader, February 2006 (Most slides: Petra Hendriks) Data to be analyzed (1) Maria slaapt. (2) Jan slaapt. (3) Maria slaapt en Jan slaapt. (4) Iedereen
More informationML for the Working Programmer
ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming
More informationIntroducing Functions
Functions 1 Introducing Functions A function f from a set A to a set B, written f : A B, is a relation f A B such that every element of A is related to one element of B; in logical notation 1. (a, b 1
More informationTheory of Computation Lecture Notes
Theory of Computation Lecture Notes Abhijat Vichare August 2005 Contents 1 Introduction 2 What is Computation? 3 The λ Calculus 3.1 Conversions: 3.2 The calculus in use 3.3 Few Important Theorems 3.4 Worked
More informationFrom Logic to Montague Grammar: Some Formal and Conceptual Foundations of Semantic Theory
From Logic to Montague Grammar: Some Formal and Conceptual Foundations of Semantic Theory Syllabus Linguistics 720 Tuesday, Thursday 2:30 3:45 Room: Dickinson 110 Course Instructor: Seth Cable Course Mentor:
More informationFoundations of mathematics
Foundations of mathematics 1. First foundations of mathematics 1.1. Introduction to the foundations of mathematics Mathematics, theories and foundations Sylvain Poirier http://settheory.net/ Mathematics
More informationSummary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)
Summary Summary Last Lecture sequent calculus Automated Reasoning Georg Moser Institute of Computer Science @ UIBK Winter 013 (Normalisation and Strong Normalisation) let Π be a proof in minimal logic
More information! " # The Logic of Descriptions. Logics for Data and Knowledge Representation. Terminology. Overview. Three Basic Features. Some History on DLs
,!0((,.+#$),%$(&.& *,2($)%&2.'3&%!&, Logics for Data and Knowledge Representation Alessandro Agostini agostini@dit.unitn.it University of Trento Fausto Giunchiglia fausto@dit.unitn.it The Logic of Descriptions!$%&'()*$#)
More informationA Knowledgebased System for Translating FOL Formulas into NL Sentences
A Knowledgebased System for Translating FOL Formulas into NL Sentences Aikaterini Mpagouli, Ioannis Hatzilygeroudis University of Patras, School of Engineering Department of Computer Engineering & Informatics,
More informationChapter 5 Parser Combinators
Part II Chapter 5 Parser Combinators 5.1 The type of parsers 5.2 Elementary parsers 5.3 Grammars 5.4 Parser combinators 5.5 Parser transformers 5.6 Matching parentheses 5.7 More parser combinators 5.8
More informationHaskell Programming With Tests, and Some Alloy
Haskell Programming With Tests, and Some Alloy Jan van Eijck jve@cwi.nl Master SE, 2010 Abstract How to write a program in Haskell, and how to use the Haskell testing tools... QuickCheck is a tool written
More information2. Methods of Proof Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try.
2. METHODS OF PROOF 69 2. Methods of Proof 2.1. Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try. Trivial Proof: If we know q is true then
More informationThe Classes P and NP
The Classes P and NP We now shift gears slightly and restrict our attention to the examination of two families of problems which are very important to computer scientists. These families constitute the
More information3(vi) B. Answer: False. 3(vii) B. Answer: True
Mathematics 0N1 Solutions 1 1. Write the following sets in list form. 1(i) The set of letters in the word banana. {a, b, n}. 1(ii) {x : x 2 + 3x 10 = 0}. 3(iv) C A. True 3(v) B = {e, e, f, c}. True 3(vi)
More informationPredicate Logic. M.A.Galán, TDBA64, VT03
Predicate Logic 1 Introduction There are certain arguments that seem to be perfectly logical, yet they cannot be specified by using propositional logic. All cats have tails. Tom is a cat. From these two
More informationSemantics for the Predicate Calculus: Part I
Semantics for the Predicate Calculus: Part I (Version 0.3, revised 6:15pm, April 14, 2005. Please report typos to hhalvors@princeton.edu.) The study of formal logic is based on the fact that the validity
More informationThe Foundations: Logic and Proofs. Chapter 1, Part III: Proofs
The Foundations: Logic and Proofs Chapter 1, Part III: Proofs Rules of Inference Section 1.6 Section Summary Valid Arguments Inference Rules for Propositional Logic Using Rules of Inference to Build Arguments
More informationThe countdown problem
JFP 12 (6): 609 616, November 2002. c 2002 Cambridge University Press DOI: 10.1017/S0956796801004300 Printed in the United Kingdom 609 F U N C T I O N A L P E A R L The countdown problem GRAHAM HUTTON
More informationObjectOriented Software Specification in Programming Language Design and Implementation
ObjectOriented Software Specification in Programming Language Design and Implementation Barrett R. Bryant and Viswanathan Vaidyanathan Department of Computer and Information Sciences University of Alabama
More informationPredicate logic. Logic in computer science. Logic in Computer Science (lecture) PART II. first order logic
PART II. Predicate logic first order logic Logic in computer science Seminar: INGK401K5; INHK401; INJK401K4 University of Debrecen, Faculty of Informatics kadek.tamas@inf.unideb.hu 1 / 19 Alphabets Logical
More informationRalf Hinze Generic Programs and Proofs
Ralf Hinze Generic Programs and Proofs Bonn, 2000 Für Anja, Lisa und Florian Brief contents 1 Introduction 1 2 Background 15 3 Generic programs 53 4 Generic proofs 87 5 Examples 107 6 Generic Haskell 147
More informationMoving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an objectoriented language. This document describes some of the differences between objectoriented programming in Scheme (which we hope you
More informationApplications of Methods of Proof
CHAPTER 4 Applications of Methods of Proof 1. Set Operations 1.1. Set Operations. The settheoretic operations, intersection, union, and complementation, defined in Chapter 1.1 Introduction to Sets are
More informationSemantics and Generative Grammar. Common Nouns and Adjectives in Predicate Position 1
Common Nouns and Adjectives in Predicate Position 1 (1) The Lexicon of Our System at Present a. Proper Names: [[ Barack ]] = Barack b. Intransitive Verbs: [[ smokes ]] = [ λx : x D e. IF x smokes THEN
More informationFunctional Programming
FP 2005 1.1 3 Functional Programming WOLFRAM KAHL kahl@mcmaster.ca Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling
More informationOverview. Elements of Programming Languages. Advanced constructs. Motivating inner class example
Overview Elements of Programming Languages Lecture 12: Objectoriented functional programming James Cheney University of Edinburgh November 6, 2015 We ve now covered: basics of functional and imperative
More informationIntroduction to Programming (in C++) Data types and visibility. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC
Introduction to Programming (in C++) Data types and visibility Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC Outline Data types Type conversion Visibility Introduction to
More informationSets. A set is a collection of (mathematical) objects, with the collection treated as a single mathematical object.
Sets 1 Sets Informally: A set is a collection of (mathematical) objects, with the collection treated as a single mathematical object. Examples: real numbers, complex numbers, C integers, All students in
More informationINTRODUCTORY SET THEORY
M.Sc. program in mathematics INTRODUCTORY SET THEORY Katalin Károlyi Department of Applied Analysis, Eötvös Loránd University H1088 Budapest, Múzeum krt. 68. CONTENTS 1. SETS Set, equal sets, subset,
More informationStatic Typing for ObjectOriented Programming
Science of Computer Programming 23(1):19 53, 1994. Static Typing for ObjectOriented Programming Jens Palsberg palsberg@daimi.aau.dk Michael I. Schwartzbach mis@daimi.aau.dk Computer Science Department
More informationPropositional Logic. A proposition is a declarative sentence (a sentence that declares a fact) that is either true or false, but not both.
irst Order Logic Propositional Logic A proposition is a declarative sentence (a sentence that declares a fact) that is either true or false, but not both. Are the following sentences propositions? oronto
More informationChapter 7. Functions and onto. 7.1 Functions
Chapter 7 Functions and onto This chapter covers functions, including function composition and what it means for a function to be onto. In the process, we ll see what happens when two dissimilar quantifiers
More informationComplexity of HigherOrder Queries
Complexity of HigherOrder Queries Huy Vu Oxford University Computing Laboratory Parks Road, Oxford, UK huy.vu@comlab.ox.ac.uk Michael Benedikt Oxford University Computing Laboratory Parks Road, Oxford,
More informationSoftware Verification and Testing. Lecture Notes: Z I
Software Verification and Testing Lecture Notes: Z I Motivation so far: we have seen that properties of software systems can be specified using firstorder logic, set theory and the relational calculus
More informationScalable Automated Symbolic Analysis of Administrative RoleBased Access Control Policies by SMT solving
Scalable Automated Symbolic Analysis of Administrative RoleBased Access Control Policies by SMT solving Alessandro Armando 1,2 and Silvio Ranise 2, 1 DIST, Università degli Studi di Genova, Italia 2 Security
More informationInf1A: Deterministic Finite State Machines
Lecture 2 InfA: Deterministic Finite State Machines 2. Introduction In this lecture we will focus a little more on deterministic Finite State Machines. Also, we will be mostly concerned with Finite State
More information[Refer Slide Time: 05:10]
Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture
More information3. Mathematical Induction
3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)
More informationType Theory & Functional Programming
Type Theory & Functional Programming Simon Thompson Computing Laboratory, University of Kent March 1999 c Simon Thompson, 1999 Not to be reproduced i ii To my parents Preface Constructive Type theory has
More informationAnatomy of Programming Languages. William R. Cook
Anatomy of Programming Languages William R. Cook Copyright (C) 2013 2 Chapter 1 Preliminaries Preface What? This document is a series of notes about programming languages, originally written for students
More informationProgramming Languages in Artificial Intelligence
Programming Languages in Artificial Intelligence Günter Neumann, German Research Center for Artificial Intelligence (LT Lab, DFKI) I. AI programming languages II. Functional programming III. Functional
More informationRelations: their uses in programming and computational specifications
PEPS Relations, 15 December 2008 1/27 Relations: their uses in programming and computational specifications Dale Miller INRIA  Saclay & LIX, Ecole Polytechnique 1. Logic and computation Outline 2. Comparing
More informationProgramming Language Rankings. Lecture 15: Type Inference, polymorphism & Type Classes. Top Combined. Tiobe Index. CSC 131! Fall, 2014!
Programming Language Rankings Lecture 15: Type Inference, polymorphism & Type Classes CSC 131 Fall, 2014 Kim Bruce Top Combined Tiobe Index 1. JavaScript (+1) 2. Java (1) 3. PHP 4. C# (+2) 5. Python (1)
More informationDeterministic Finite Automata
1 Deterministic Finite Automata Definition: A deterministic finite automaton (DFA) consists of 1. a finite set of states (often denoted Q) 2. a finite set Σ of symbols (alphabet) 3. a transition function
More informationCHAPTER 2. Logic. 1. Logic Definitions. Notation: Variables are used to represent propositions. The most common variables used are p, q, and r.
CHAPTER 2 Logic 1. Logic Definitions 1.1. Propositions. Definition 1.1.1. A proposition is a declarative sentence that is either true (denoted either T or 1) or false (denoted either F or 0). Notation:
More informationProgramming Fundamentals. Lesson 20 Sections
Programming Fundamentals Lesson 20 Sections Today, we will Study sections, in Haskell. Sections are another class of expressions that represent functions. A section is a binary operation where one of the
More informationThe design recipe. Programs as communication. Some goals for software design. Readings: HtDP, sections 15
The design recipe Readings: HtDP, sections 15 (ordering of topics is different in lectures, different examples will be used) Survival and Style Guides CS 135 Winter 2016 02: The design recipe 1 Programs
More informationLecture 4  Sets, Relations, Functions 1
Lecture 4 Sets, Relations, Functions Pat Place Carnegie Mellon University Models of Software Systems 17651 Fall 1999 Lecture 4  Sets, Relations, Functions 1 The Story So Far Formal Systems > Syntax»
More informationHandout #1: Mathematical Reasoning
Math 101 Rumbos Spring 2010 1 Handout #1: Mathematical Reasoning 1 Propositional Logic A proposition is a mathematical statement that it is either true or false; that is, a statement whose certainty or
More informationSimulationBased Security with Inexhaustible Interactive Turing Machines
SimulationBased Security with Inexhaustible Interactive Turing Machines Ralf Küsters Institut für Informatik ChristianAlbrechtsUniversität zu Kiel 24098 Kiel, Germany kuesters@ti.informatik.unikiel.de
More informationData Analysis 1. SET08104 Database Systems. Copyright @ Napier University
Data Analysis 1 SET08104 Database Systems Copyright @ Napier University Entity Relationship Modelling Overview Database Analysis Life Cycle Components of an Entity Relationship Diagram What is a relationship?
More informationBasic Concepts of Set Theory, Functions and Relations
March 1, 2006 p. 1 Basic Concepts of Set Theory, Functions and Relations 1. Basic Concepts of Set Theory...1 1.1. Sets and elements...1 1.2. Specification of sets...2 1.3. Identity and cardinality...3
More informationLights and Darks of the StarFree Star
Lights and Darks of the StarFree Star Edward Ochmański & Krystyna Stawikowska Nicolaus Copernicus University, Toruń, Poland Introduction: star may destroy recognizability In (finitely generated) trace
More informationSettheoretic Foundation of Parametric Polymorphism and Subtyping
Settheoretic Foundation of Parametric Polymorphism and Subtyping Giuseppe Castagna 1 Zhiwu Xu 1,2 1 CNRS, Laboratoire Preuves, Programmes et Systèmes, Univ Paris Diderot, Sorbonne Paris Cité, Paris, France.
More informationLikewise, we have contradictions: formulas that can only be false, e.g. (p p).
CHAPTER 4. STATEMENT LOGIC 59 The rightmost column of this truth table contains instances of T and instances of F. Notice that there are no degrees of contingency. If both values are possible, the formula
More informationLanguage. Johann Eder. Universitat Klagenfurt. Institut fur Informatik. Universiatsstr. 65. A9020 Klagenfurt / AUSTRIA
PLOP: A Polymorphic Logic Database Programming Language Johann Eder Universitat Klagenfurt Institut fur Informatik Universiatsstr. 65 A9020 Klagenfurt / AUSTRIA February 12, 1993 Extended Abstract The
More informationLambda Abstraction (Chierchia & McConnellGinet Chapter 7)
Lambda Abstraction (Chierchia & McConnellGinet Chapter 7) Lambda calculus was invented by Alonzo Church in the 1940s and 50s. In 1957 John McCarthy designed the programming language LISP, based on the
More informationAppendix B: Alloy Language Reference B.1 Lexical Issues
Appendix B: Alloy Language Reference B.1 Lexical Issues The permitted characters are the printing characters of the ASCII character set, with the exception of backslash \ backquote ` and, of the ASCII
More informationChapter 3. Cartesian Products and Relations. 3.1 Cartesian Products
Chapter 3 Cartesian Products and Relations The material in this chapter is the first real encounter with abstraction. Relations are very general thing they are a special type of subset. After introducing
More informationLecture 17 : Equivalence and Order Relations DRAFT
CS/Math 240: Introduction to Discrete Mathematics 3/31/2011 Lecture 17 : Equivalence and Order Relations Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last lecture we introduced the notion
More informationCOMPUTER SCIENCE TRIPOS
CST.98.5.1 COMPUTER SCIENCE TRIPOS Part IB Wednesday 3 June 1998 1.30 to 4.30 Paper 5 Answer five questions. No more than two questions from any one section are to be answered. Submit the answers in five
More informationA Propositional Dynamic Logic for CCS Programs
A Propositional Dynamic Logic for CCS Programs Mario R. F. Benevides and L. Menasché Schechter {mario,luis}@cos.ufrj.br Abstract This work presents a Propositional Dynamic Logic in which the programs are
More informationThe programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
More information