Computational Semantics, Type Theory, and Functional Programming


 Christopher McDonald
 3 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 informationInduction and Recursion
Induction and Recursion Jan van Eijck June 3, 2003 Abstract A very important proof method that is not covered by the recipes from Chapter 3 is the method of proof by Mathematical Induction. Roughly speaking,
More information+ addition  subtraction and unary minus * multiplication / division mod modulo
Chapter 4 Basic types We examine in this chapter the Caml basic types. 4.1 Numbers Caml Light provides two numeric types: integers (type int) and floatingpoint numbers (type float). Integers are limited
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 informationCS 2336 Discrete Mathematics
CS 2336 Discrete Mathematics Lecture 2 Logic: Predicate Calculus 1 Outline Predicates Quantifiers Binding Applications Logical Equivalences 2 Predicates In mathematics arguments, we will often see sentences
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 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 informationChapter 1. Logic and Proof
Chapter 1. Logic and Proof 1.1 Remark: A little over 100 years ago, it was found that some mathematical proofs contained paradoxes, and these paradoxes could be used to prove statements that were known
More informationTruth Conditional Meaning of Sentences. Ling324 Reading: Meaning and Grammar, pg
Truth Conditional Meaning of Sentences Ling324 Reading: Meaning and Grammar, pg. 6987 Meaning of Sentences A sentence can be true or false in a given situation or circumstance. (1) The pope talked to
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 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 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 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 information4. FIRSTORDER LOGIC
4. FIRSTORDER LOGIC Contents 4.1: Splitting the atom: names, predicates and relations 4.2: Structures 4.3: Quantification:, 4.4: Syntax 4.5: Semantics 4.6: De Morgan s laws for and 4.7: Truth trees for
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 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 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 informationA Scope Freezing Effect with Negated Quantifiers Chris Collins September 2016
A Scope Freezing Effect with Negated Quantifiers Chris Collins September 2016 Abstract: I document a scope freezing effect found with negated quantifiers (distinct from the scope freezing effect discussed
More informationHigherOrder Logic. Specification and Verification with HigherOrder Logic
HigherOrder Logic Specification and Verification with HigherOrder Logic Arnd PoetzschHeffter Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern Sommersemester 2010
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 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 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 informationValid formulas, games and network protocols
Valid formulas, games and network protocols JeanLouis Krivine & Yves Legrandgérard Paris VII University, CNRS November 14, 2007 Introduction We describe a remarkable relation between a fundamental notion
More information9.1: Predicates and Quantifiers
9.1: Predicates and Quantifiers Expressive Limitations of Statement Logic Many intuitively valid arguments in ordinary language cannot be represented as valid in statement logic. For example: This house
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 informationComputational Linguistics: Syntax I
Computational Linguistics: Syntax I Raffaella Bernardi KRDB, Free University of BozenBolzano P.zza Domenicani, Room: 2.28, email: bernardi@inf.unibz.it Contents 1 Syntax...................................................
More informationPredicate Logic. Lucia Moura. Winter Predicates and Quantifiers Nested Quantifiers Using Predicate Calculus
Predicate Logic Winter 2010 Predicates A Predicate is a declarative sentence whose true/false value depends on one or more variables. The statement x is greater than 3 has two parts: the subject: x is
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 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 informationMath 3000 Running Glossary
Math 3000 Running Glossary Last Updated on: July 15, 2014 The definition of items marked with a must be known precisely. Chapter 1: 1. A set: A collection of objects called elements. 2. The empty set (
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 informationThe Haskell Road to Logic, Math and Programming. Kees Doets and Jan van Eijck
The Haskell Road to Logic, Math and Programming Kees Doets and Jan van Eijck March 4, 2004 Contents Preface v 1 Getting Started 1 1.1 Starting up the Haskell Interpreter................. 2 1.2 Implementing
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 informationInference Rules and Proof Methods
Inference Rules and Proof Methods Winter 2010 Introduction Rules of Inference and Formal Proofs Proofs in mathematics are valid arguments that establish the truth of mathematical statements. An argument
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 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 informationPropositional Logic. 1. Semantics and Propositions. LX Semantics September 19, 2008
Propositional Logic LX 502  Semantics September 19, 2008 1. Semantics and Propositions Natural language is used to communicate information about the world, typically between a speaker and an addressee.
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 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 informationBasic syntax of quantification in English
Basic syntax of quantifiion in English Jeff peaks phil 43916 eptember 15, 2014 1 The problem posed by quantified sentences.................... 1 2 Basic syntactic egories for quantifiion in English..............
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 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 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 information2. Propositional Equivalences
2. PROPOSITIONAL EQUIVALENCES 33 2. Propositional Equivalences 2.1. Tautology/Contradiction/Contingency. Definition 2.1.1. A tautology is a proposition that is always true. Example 2.1.1. p p Definition
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 informationMATH 433 Applied Algebra Lecture 13: Examples of groups.
MATH 433 Applied Algebra Lecture 13: Examples of groups. Abstract groups Definition. A group is a set G, together with a binary operation, that satisfies the following axioms: (G1: closure) for all elements
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 informationCS532, Winter 2010 Lecture Notes: FirstOrder Logic: Syntax and Semantics
CS532, Winter 2010 Lecture Notes: FirstOrder Logic: Syntax and Semantics Dr Alan Fern, afern@csorstedu January 8, 2010 1 Limits of Propositional Logic Propositional logic assumes that the world or system
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 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 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 informationINTRODUCTION TO PROOFS: HOMEWORK SOLUTIONS
INTRODUCTION TO PROOFS: HOMEWORK SOLUTIONS STEVEN HEILMAN Contents 1. Homework 1 1 2. Homework 2 6 3. Homework 3 10 4. Homework 4 16 5. Homework 5 19 6. Homework 6 21 7. Homework 7 25 8. Homework 8 28
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 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 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 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 informationPredicates and Quantifiers. Niloufar Shafiei
Predicates and Quantifiers Niloufar Shafiei Review Proposition: 1. It is a sentence that declares a fact. 2. It is either true or false, but not both. Examples: 2 + 1 = 3. True Proposition Toronto is the
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 informationThe Predicate Calculus in AI
Last time, we: The Predicate Calculus in AI Motivated the use of Logic as a representational language for AI (Can derive new facts syntactically  simply by pushing symbols around) Described propositional
More informationProblems on Discrete Mathematics 1
Problems on Discrete Mathematics 1 ChungChih Li Kishan Mehrotra 3 L A TEX at July 18, 007 1 No part of this book can be reproduced without permission from the authors Illinois State University, Normal,
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 informationMATH REVIEW KIT. Reproduced with permission of the Certified General Accountant Association of Canada.
MATH REVIEW KIT Reproduced with permission of the Certified General Accountant Association of Canada. Copyright 00 by the Certified General Accountant Association of Canada and the UBC Real Estate Division.
More informationRelational Query Languages
Relational Query Languages Universidad de Concepción, 2014 (Slides adapted from Loreto Bravo, who adapted from Werner Nutt who adapted them from Thomas Eiter and Leonid Libkin) Bases de Datos II 1 Queries
More informationLing 130 Notes: English syntax
Ling 130 Notes: English syntax Sophia A. Malamud March 13, 2014 1 Introduction: syntactic composition A formal language is a set of strings  finite sequences of minimal units (words/morphemes, for natural
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 informationUnit 5: Recursion Part 3. Application of Recursion to Languages. Grammar. Engineering 4892: Data Structures. June 14, 2011
Unit 5: Recursion Part 3 1 Application of Recursion to Languages Engineering 4892: Data Structures 1 Application of Recursion to Linked Lists Faculty of Engineering & Applied Science Memorial University
More informationClassical Information and Bits
p. 1/24 Classical Information and Bits The simplest variable that can carry information is the bit, which can take only two values, 0 or 1. Any ensemble, description, or set of discrete values can be quantified
More informationCS 341 Homework 9 Languages That Are and Are Not Regular
CS 341 Homework 9 Languages That Are and Are Not Regular 1. Show that the following are not regular. (a) L = {ww R : w {a, b}*} (b) L = {ww : w {a, b}*} (c) L = {ww' : w {a, b}*}, where w' stands for w
More informationarxiv:cs/ v1 [cs.cl] 17 May 2002
A VariableFree Dynamic Semantics Chungchieh Shan Harvard University arxiv:cs/0205027v1 [cs.cl] 17 May 2002 I propose a variablefree treatment of dynamic semantics. By dynamic semantics I mean analyses
More informationPredicate Logic. PHI 201 Introductory Logic Spring 2011
Predicate Logic PHI 201 Introductory Logic Spring 2011 This is a summary of definitions in Predicate Logic from the text The Logic Book by Bergmann et al. 1 The Language PLE Vocabulary The vocabulary of
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 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 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 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 informationPhil 2440 Chapter 5: Predicate Logic Symbolizations
Phil 2440 Chapter 5: Predicate Logic Symbolizations To discuss today: Atomic sentences in predicate logic Quantifiers Some important kinds of sentences Wellformed formulas About the predicate calculus
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 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 informationSchool of Informatics, University of Edinburgh
CS1Ah Lecture Note 5 Java Expressions Many Java statements can contain expressions, which are program phrases that tell how to compute a data value. Expressions can involve arithmetic calculation and method
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 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 informationSection 7.1 FirstOrder Predicate Calculus predicate Existential Quantifier Universal Quantifier.
Section 7.1 FirstOrder Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially or universally. A predicate describes a
More informationINTRODUCTION TO LOGIC Lecture 4 The Syntax of Predicate Logic Dr. James Studd. SubjectPredicate form. Designators/Constants. is a tortoise Predicate
Introduction INTRODUCTION TO LOGIC Lecture 4 The Syntax of Predicate Logic Dr. James Studd I counsel you, dear friend, in sum, That first you take collegium logicum. Your spirit s then well broken in for
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 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 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 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 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 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 informationIntroduction to Predicate Calculus
Introduction to Predicate Calculus 1 Motivation Last time, we discuss the need for a representation language that was declarative, expressively adequate, unambiguous, contextindependent, and compositional.
More informationSets and functions. {x R : x > 0}.
Sets and functions 1 Sets The language of sets and functions pervades mathematics, and most of the important operations in mathematics turn out to be functions or to be expressible in terms of functions.
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 informationCSI 2101 Discrete Structures Winter 2012
CSI 2101 Discrete Structures Winter 2012 Prof. Lucia Moura University of Ottawa Homework Assignment #1 (100 points, weight 5%) Due: Thursday Feb 9, at 1:00 p.m. (in lecture); assignments with lateness
More informationDISCRETE MATH: LECTURE 4
DISCRETE MATH: LECTURE 4 DR. DANIEL FREEMAN 1. Chapter 3.1 Predicates and Quantified Statements I A predicate is a sentence that contains a finite number of variables and becomes a statement when specific
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 informationPlural Type Quantification Proceedings of the Amsterdam Colloquium 1999
Plural Type Quantification Proceedings of the Amsterdam Colloquium 1999 Yoad Winter Technion This paper introduces some of the main components of a novel type theoretical semantics for quantification with
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 information