1 / 34

Formal Semantics: Functions and Lambda Notation

This text explores the concept of semantic types in formal semantics, including the use of lambda notation to represent functions. It discusses the general rules of semantic composition and demonstrates how these rules can be applied to interpret sentences. The notation of lambda functions is introduced as a more concise and convenient way to represent semantic functions.

sanmiguel
Download Presentation

Formal Semantics: Functions and Lambda Notation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CAS LX 502 9a. Formal semantics Functions and lambda notation

  2. Semantic type • The entire semantics that we are creating here depends on two types of things, individuals and truth values. • We can label individuals as being of type “e” (traditional, think “entity”), and truth values as being of type “t”. • In these terms, names like Bond are of type <e>, and sentences like Bond is hungry are of type <t>.

  3. A formal systemof semantic types • <e> is a basic type. • <t> is a basic type. • If a and b are types, <a,b> is a type. • <a,b> is a function that takes something of type a and returns something of type b. • <e,t> is a type. <<e,t>,<e,<e,t>>> is a type. • <e,t,e> is not, nor is <<e,t>>.

  4. Functions • A function transforms one thing into another. • We can define the squaring function as a function that takes a number and gives back that number multiplied with itself • Square(n) = nn • This is a function from numbers to numbers. It takes a number, it gives back a number.

  5. Functions • A function doesn’t need to give back the same kind of thing it gets. Usually, the thing it gives back depends on the thing it gets, but it doesn’t need to be of the same type. • Change-machine($n-bill) = 4 n quarters. • This is a function from bills to quarters.

  6. <e,t> functions • An intransitive verb like is boring can be viewed as a function from individuals to truth values. Given an individual x, it will return trueif x is boring, or false if x is not boring. • Boring(x) = true if x is boring; false otherwise. • This is a function from individuals (type <e>) to truth values (type <t>). That is, it has type <e,t>.

  7. Generalizing our semantics • By using this idea that the semantic value of a node in our sentence structure can be a function, we can greatly simplify our semantic rules, basically down to two general rules, and then the lexical rules that tell us specifically what things like is hungry or Bond mean. S VP N Bond Vi is hungry

  8. Generalizing our semantics S • M=<U,F> • [Bond]M = F(Bond) = Bond • Type: <e> • [is hungry]M = F(is hungry) = the function f such that, given an individual x, it returns true if x is hungry in M, false otherwise. • Type: <e,t> VP N Bond Vi Bond is hungry The function f such that,given an individual x,it returns true if x is hungry in M,false otherwise

  9. Generalizing our semantics S • Pass-Up:[ba]M = [a]M • What this says is that if a node b contains nothing else but a node a, then the semantic value of b is going to be exactly the same as the semantic value of a. • So [N]M = [Bond]M = Bond. • [VP]M = [Vi]M = [is hungry]M. VP N Bond Vi Bond is hungry The function f such that,given an individual x,it returns true if x is hungry in M,false otherwise

  10. The function f such that,given an individual x,it returns true if x is hungry in M,false otherwise Generalizing our semantics Bond S • Functional application:[ga b ]M = [b]M ( [a]M ) or [a]M ( [b]M ) whichever is defined • What this says if a node b contains two things, one being a function that takes the other as an argument, the result will be whatever the function returns given that argument. • [N]M is type <e> • [VP]M is type <e,t> • So [S]M is type <t>. VP N Bond Vi Bond is hungry The function f such that,given an individual x,it returns true if x is hungry in M,false otherwise

  11. The function f such that,given an individual x,it returns true if x is hungry in M,false otherwise Generalizing our semantics Bond S • Functional application:[ga b ]M = [b]M ( [a]M ) or [a]M ( [b]M ) whichever is defined • [S]M = [S N VP]M = [VP]M ( [N]M ) • [VP]M is the function such that given an individual x, it returns true if x is hungry in M, false otherwise. • [N]M is the individual Bond. VP N Bond Vi Bond is hungry The function f such that,given an individual x,it returns true if x is hungry in M,false otherwise

  12. The function f such that,given an individual x,it returns true if x is hungry in M,false otherwise Generalizing our semantics Bond S • Functional application:[ga b ]M = [b]M ( [a]M ) or [a]M ( [b]M ) whichever is defined • [S]M = [S N VP]M = [VP]M ( [N]M ) • So, [S]M is true if Bond is hungry in M, false otherwise. VP N Bond Vi Bond is hungry The function f such that,given an individual x,it returns true if x is hungry in M,false otherwise

  13. Writing functions • So, if we think of everything in terms of functions and arguments, then these two rules, Functional applicationand Pass-up, will be the only semantic rules we need. • So far, our notation for writing functions is clunky. • [is boring]M = that function f such that, given an individual x, f returns true if x is boring in M, and false otherwise. • It would be nice if we could write that function directly somehow.

  14. Enter the l • Happily, there is a way to write functions like this directly, using lambda notation. • The structure of a function written in lambda notation is:argument [ return value ] • So, for [is boring]M, we can write this: • x [ x is boring in M ] • This is the function such that, given an individual x, returns true if x is boring in M and false otherwise.

  15. argument [ return value ] • x [ x is boring in M ] • The idea here is that x is boring in Mis either true (if x is boring in M) or false (if x is not boring in M), and so whatever truth value x is boring in M has will be what this function returns. • This is a function of type <e,t>.

  16. argument [ return value ] • Change-machine($n-bill) = 4 n quarters. • Change-machine =  $n-bill [ 4 n quarters ] • Square = n [ nn ] • Not very complicated, just a short way to write “that function f such that, given argument, returns return value.”

  17. value argument [ return value ] • Square = n [ nn ] • Square(3) = 3  3 = 9 • Square(4) = 4  4 = 16. • To evaluate a function, we take the value and substitute it in for the argument within the return value. If we give it a 3, and the argument is n, then we replace all of the ns with 3s and evaluate the return value.

  18. value argument [ return value ] • Strictly speaking, there’s an intermediate step, which is written like so: • Square = n [ nn ] • Square(3) = 3 n [ nn ] = 3  3 = 9 • Square(4) = 4 n [ nn ] = 4  4 = 16. • What value argument [ return value ] means is: Replace every instance of argument within return value with value, then evaluate return value. • This operation goes by the name lambda conversion.

  19. value argument [ return value ] • One last piece of terminology: Instances of argument within return value are said to be variablesthat bound by the lambda operator. • Triple = n [ 3 n ] Lambda operator Bound variable

  20. Like, totally. • Transitive verbs, such as like, are ultimately relations between individuals. • Yet, our syntax produces structures like this, where VP has only likes and Loren in it. • We know that [S]M needs to be a truth value, it needs to be of type <t>. • We know that [N]M is an individual (Bond), type <e>. • Given the way Functional Application works, [VP]M needs to be a function of type <e,t>. S VP N Vt N Bond likes Loren

  21. Like, totally. • What we want [VP]M to be is a function that is true of all Loren-likers, such that the whole sentence will be true if Bond is a Loren-liker. • So, what is [VP]M? Well, that too has two parts. We know that it needs to be of type <e,t>. We know that one component (N) is an individual of type <e>. So we need [Vt] to be something that takes an individual, type <e>, and returns a predicate, type <e,t>. • That is, [Vt] must be type <e,<e,t>>. S VP N Vt N Bond likes Loren

  22. Like, totally. • If [Vt] is of type <e,<e,t>>, it is a function that takes an individual and returns a function, specifically a function from individuals to truth values. • The particular function we need it to return is the one that is true of Loren-likers. • So, how do we write that? • Well, argument [ return value ] S VP N Vt N Bond likes Loren

  23. Like, totally. • What we’re aiming for is something that will work out to: • x [ x is a Loren-liker in M ] • But we want to derive x is a Loren-liker in M from like and Loren. (That is, from [Vt]M and [N]M). We know what [N]M is, it’s Loren. So, what’s [Vt]M ? • [like]M =  y [ x [ x likes y in M ] ] S VP N Vt N Bond likes Loren

  24. Like, totally. Bond • [like]M =  y [ x [ x likes y in M ] ] • That is, [like]M is the function that, given an individual y, returns the function that, given an individual x, is true if x likes y in M. • So, what is [VP]M ? Well, it contains Vt and N, and [Vt]M is a function of type <e,<e,t>> that takes an argument of type <e>. [N]M is of type <e>. So, [VP]M = [Vt]M ( [N]M ). S Loren VP N Vt N Bond likes Loren  y [ x [ x likes y in M ] ]

  25. Like, totally. Bond • [like]M =  y [ x [ x likes y in M ] ] • [VP]M = [Vt]M ( [N]M ) • [VP]M =Loren y [ x [ x likes y in M ] ] • …and lambda conversion gives us… • = x [ x likes Loren in M ] S Loren VP N Vt N Bond likes Loren  y [ x [ x likes y in M ] ]

  26. x [ x likes Loren in M ] Like, totally. Bond • [VP]M = x [ x likes Loren in M ] • Then, we evaluate [S]M. It has two constituents, one a function of type <e,t>, the other an individual of type <e>. Apply Functional Application. • [S]M = [VP]M ( [N]M )= Bond x [ x likes Loren in M ]= Bond likes Loren in M S Loren VP N Vt N Bond likes Loren  y [ x [ x likes y in M ] ]

  27. Formal finishing touches • Strictly speaking, we still fudged a bit when we said that • [like]M =  y [ x [ x likes y in M ] ] • Really, what we mean is: • [like]M =  y [ x [ <x,y>  F(like) ] ] • Since F(like) is the set of pairs <liker, likee> where liker and likee are drawn from U.

  28. Generalized semantics • We now have a relatively simple semantic theory. Each node in the (syntactic) structure has a semantic value. If the node has a sister, one of them is a function and one of them is an argument, and the semantic value of both together is whatever the function yields, given the argument (Functional Application). If a node has no sisters, its parent node just has the same semantic value (Pass-up). • The semantic values of the lexical items reflects this structure. So the semantic value of names will be of type <e>, that of intransitive verbs will be of type <e,t>, that of transitive verbs will be of type <e,<e,t>>.

  29. Remaining loose ends • Functional Application only allows for two daughters, but our conjunction rules yield structures will three. We need to change this so that Functional Application will work. • The simplest approach is just to treat and and or as if they are something like transitive predicates. That is, type <t,<t, t>>.

  30. ConjP S • Instead ofS  S Conj S,we can do this in two steps:S  S ConjP andConjP  Conj S • Then, we define [and]M as a function that takes a truth value and returns a function that takes a truth value and returns a truth value: <t,<t,t>> S Conj S and S ConjP S Conj S and

  31. and S • [and]M =  y [ x [ x  y ] ] • [ConjP]M = [Conj]M ( [S2]M )= [S2]M y [ x [ x  y ] ]= x [ x [S2]M] • [S]M = [ConjP]M ( [S1]M )= [S1]Mx [ x [S2]M]= [S1]M[S2]M ConjP S1 Conj S2 and

  32.         

More Related