computational semantics lambda calculus
play

Computational Semantics: Lambda Calculus Semantic Analysis Problems - PowerPoint PPT Presentation

Computational Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Computational Semantics: Lambda Calculus Semantic Analysis Problems One Solution: -Calculus Scott Farrar -calculus and


  1. Computational Example: Semantic attachments Semantics: Lambda Calculus Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: rar@u.washington.edu Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ -Calculus λ -calculus and FOL V.sem = love.sem λ -calculus and compositionality The semantics of love.sem = love ( x , y ) words based on syntactic category NP.sem = NNP.sem NNP.sem = Betty.sem or Jim.sem loves ( JIM , BETTY ) 8/37

  2. Computational Example: Semantic attachments Semantics: Lambda Calculus Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: rar@u.washington.edu Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ -Calculus λ -calculus and FOL V.sem = love.sem λ -calculus and compositionality The semantics of love.sem = love ( x , y ) words based on syntactic category NP.sem = NNP.sem NNP.sem = Betty.sem or Jim.sem Betty.sem = BETTY loves ( JIM , BETTY ) 8/37

  3. Computational Example: Semantic attachments Semantics: Lambda Calculus Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: rar@u.washington.edu Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ -Calculus λ -calculus and FOL V.sem = love.sem λ -calculus and compositionality The semantics of love.sem = love ( x , y ) words based on syntactic category NP.sem = NNP.sem NNP.sem = Betty.sem or Jim.sem Betty.sem = BETTY Jim.sem = JIM loves ( JIM , BETTY ) 8/37

  4. Computational Analysis problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu But what about other examples: Semantic Analysis Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 9/37

  5. Computational Analysis problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu But what about other examples: Semantic Analysis Problems Betty is loved by Jim. One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 9/37

  6. Computational Analysis problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu But what about other examples: Semantic Analysis Problems Betty is loved by Jim. One Solution: λ -Calculus It’s Jim who loves Betty. λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 9/37

  7. Computational Analysis problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu But what about other examples: Semantic Analysis Problems Betty is loved by Jim. One Solution: λ -Calculus It’s Jim who loves Betty. λ -calculus and FOL λ -calculus and compositionality Betty is the one loved by Jim. The semantics of words based on syntactic category 9/37

  8. Computational Analysis problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu But what about other examples: Semantic Analysis Problems Betty is loved by Jim. One Solution: λ -Calculus It’s Jim who loves Betty. λ -calculus and FOL λ -calculus and compositionality Betty is the one loved by Jim. The semantics of words based on syntactic category All clues to how the semantic representation might look are found in the syntactic structure of NL. All this, without even considering the ambiguity problem. 9/37

  9. Computational Analysis problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu The analysis problem : there is no (elegant) way to fill in Semantic Analysis Problems the arguments of formulas at the level of semantic One Solution: representation, in a way that is consistent with the syntax. λ -Calculus λ -calculus and FOL In other words, there is no formal means of combining parts λ -calculus and compositionality into wholes in standard FOL: . The semantics of words based on syntactic category Even with passive verbs for example, we need to get BETTY to fill the second argument position of the predicate love ( x , y ). 10/37

  10. Computational Representation problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Representation problem: no way to represent the meaning Semantic Analysis for some kinds of constituents. Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 11/37

  11. Computational Representation problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Representation problem: no way to represent the meaning Semantic Analysis for some kinds of constituents. Problems One Solution: λ -Calculus We can very easily express the meaning of full sentences in λ -calculus and FOL λ -calculus and plain FOL. We can say that a sentence is true given some compositionality state of the world. The semantics of words based on John kissed Mary is T just in case John really did kiss Mary. syntactic category 11/37

  12. Computational Representation problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Representation problem: no way to represent the meaning Semantic Analysis for some kinds of constituents. Problems One Solution: λ -Calculus We can very easily express the meaning of full sentences in λ -calculus and FOL λ -calculus and plain FOL. We can say that a sentence is true given some compositionality state of the world. The semantics of words based on John kissed Mary is T just in case John really did kiss Mary. syntactic category With standard truth-conditional semantics , where the truth of propositions can either be T or F , such logical expressions have a truth value. BUT... 11/37

  13. Computational Representation problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra . The rar@u.washington.edu semantics would something like VP.sem, or kiss ( x , OPRA ) Semantic Analysis Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 12/37

  14. Computational Representation problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra . The rar@u.washington.edu semantics would something like VP.sem, or kiss ( x , OPRA ) Semantic Analysis Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 12/37

  15. Computational Representation problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra . The rar@u.washington.edu semantics would something like VP.sem, or kiss ( x , OPRA ) Semantic Analysis Problems One Solution: But kiss ( x , OPRA ) has no truth value. This is because λ -Calculus λ -calculus and FOL there are unbound variables: x has no connection to the λ -calculus and compositionality UD . Such open sentences are neither T or F . The semantics of words based on syntactic category 12/37

  16. Computational Representation problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra . The rar@u.washington.edu semantics would something like VP.sem, or kiss ( x , OPRA ) Semantic Analysis Problems One Solution: But kiss ( x , OPRA ) has no truth value. This is because λ -Calculus λ -calculus and FOL there are unbound variables: x has no connection to the λ -calculus and compositionality UD . Such open sentences are neither T or F . The semantics of words based on Intuitively however, we know what a NL predicate/VP syntactic category means: e.g., ... kissed Opra means something like a “ kissing Opra event”, reguardless of who does the kissing. 12/37

  17. Computational Representation problem Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra . The rar@u.washington.edu semantics would something like VP.sem, or kiss ( x , OPRA ) Semantic Analysis Problems One Solution: But kiss ( x , OPRA ) has no truth value. This is because λ -Calculus λ -calculus and FOL there are unbound variables: x has no connection to the λ -calculus and compositionality UD . Such open sentences are neither T or F . The semantics of words based on Intuitively however, we know what a NL predicate/VP syntactic category means: e.g., ... kissed Opra means something like a “ kissing Opra event”, reguardless of who does the kissing. But we cannot express the meaning of this in FOL given our current machinery, since we’ll always have an unbound variable. 12/37

  18. Computational Summary Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu In summary then, we have at least two problems for Semantic Analysis Problems compositionality: One Solution: λ -Calculus λ -calculus and FOL 1 Analysis problem: No systematic way to use syntax to λ -calculus and compositionality guide the construction of a semantic representation The semantics of words based on 2 Representation problem: Unsatisfying approach to syntactic category representing the meanings of certain constituents; deriving truth values for certain kinds of constituents is ill defined. 13/37

  19. Computational Today’s lecture Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis 1 Semantic Analysis Problems Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality One Solution: λ -Calculus 2 The semantics of λ -calculus and FOL words based on syntactic category λ -calculus and compositionality The semantics of words based on syntactic category 3 14/37

  20. Computational back to Church Semantics: Lambda Calculus Alonzo Church created a calculus for describing arbitrary Scott Farrar CLMA, University functions, called λ -calculus . (It was developed to give a of Washington far- rar@u.washington.edu functional foundation for mathematics.) It wasn’t picked up by mathematicians, but it did become a versatile tool for Semantic Analysis Problems computer scientists. One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 15/37

  21. Computational back to Church Semantics: Lambda Calculus Alonzo Church created a calculus for describing arbitrary Scott Farrar CLMA, University functions, called λ -calculus . (It was developed to give a of Washington far- rar@u.washington.edu functional foundation for mathematics.) It wasn’t picked up by mathematicians, but it did become a versatile tool for Semantic Analysis Problems computer scientists. One Solution: λ -Calculus λ -calculus and FOL Remember Lisp ? The second oldest high-level programming λ -calculus and compositionality language, and still used today (invented by John McCarthy, The semantics of words based on 1958). Lisp (pure Lisp at least) deals exclusively with syntactic category functions, and functions can be created on the fly and without names. 15/37

  22. Computational back to Church Semantics: Lambda Calculus Alonzo Church created a calculus for describing arbitrary Scott Farrar CLMA, University functions, called λ -calculus . (It was developed to give a of Washington far- rar@u.washington.edu functional foundation for mathematics.) It wasn’t picked up by mathematicians, but it did become a versatile tool for Semantic Analysis Problems computer scientists. One Solution: λ -Calculus λ -calculus and FOL Remember Lisp ? The second oldest high-level programming λ -calculus and compositionality language, and still used today (invented by John McCarthy, The semantics of words based on 1958). Lisp (pure Lisp at least) deals exclusively with syntactic category functions, and functions can be created on the fly and without names. In Lisp, this expression evaluates to an anonymous function: (lambda (x y) (+ x y)), read as “the pair x and y are mapped to x + y ”. 15/37

  23. Computational back to Church Semantics: Lambda Calculus Alonzo Church created a calculus for describing arbitrary Scott Farrar CLMA, University functions, called λ -calculus . (It was developed to give a of Washington far- rar@u.washington.edu functional foundation for mathematics.) It wasn’t picked up by mathematicians, but it did become a versatile tool for Semantic Analysis Problems computer scientists. One Solution: λ -Calculus λ -calculus and FOL Remember Lisp ? The second oldest high-level programming λ -calculus and compositionality language, and still used today (invented by John McCarthy, The semantics of words based on 1958). Lisp (pure Lisp at least) deals exclusively with syntactic category functions, and functions can be created on the fly and without names. In Lisp, this expression evaluates to an anonymous function: (lambda (x y) (+ x y)), read as “the pair x and y are mapped to x + y ”. 15/37

  24. Computational back to Church Semantics: Lambda Calculus Alonzo Church created a calculus for describing arbitrary Scott Farrar CLMA, University functions, called λ -calculus . (It was developed to give a of Washington far- rar@u.washington.edu functional foundation for mathematics.) It wasn’t picked up by mathematicians, but it did become a versatile tool for Semantic Analysis Problems computer scientists. One Solution: λ -Calculus λ -calculus and FOL Remember Lisp ? The second oldest high-level programming λ -calculus and compositionality language, and still used today (invented by John McCarthy, The semantics of words based on 1958). Lisp (pure Lisp at least) deals exclusively with syntactic category functions, and functions can be created on the fly and without names. In Lisp, this expression evaluates to an anonymous function: (lambda (x y) (+ x y)), read as “the pair x and y are mapped to x + y ”. Otherwise, we’d have a named function, something like: add ( x , y ) 15/37

  25. Computational Functions and arguments Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More generally, we can describe what’s going on by assuming that every expression is either a function or argument. For Semantic Analysis Problems instance, suppose we want to create: (+ x y ) : One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 16/37

  26. Computational Functions and arguments Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More generally, we can describe what’s going on by assuming that every expression is either a function or argument. For Semantic Analysis Problems instance, suppose we want to create: (+ x y ) : One Solution: λ -Calculus Start with three symbols: +, x , and y λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 16/37

  27. Computational Functions and arguments Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More generally, we can describe what’s going on by assuming that every expression is either a function or argument. For Semantic Analysis Problems instance, suppose we want to create: (+ x y ) : One Solution: λ -Calculus Start with three symbols: +, x , and y λ -calculus and FOL λ -calculus and compositionality Treat each symbol as either a function or argument The semantics of words based on syntactic category 16/37

  28. Computational Functions and arguments Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More generally, we can describe what’s going on by assuming that every expression is either a function or argument. For Semantic Analysis Problems instance, suppose we want to create: (+ x y ) : One Solution: λ -Calculus Start with three symbols: +, x , and y λ -calculus and FOL λ -calculus and compositionality Treat each symbol as either a function or argument The semantics of words based on + x yields (+ x ) syntactic category 16/37

  29. Computational Functions and arguments Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More generally, we can describe what’s going on by assuming that every expression is either a function or argument. For Semantic Analysis Problems instance, suppose we want to create: (+ x y ) : One Solution: λ -Calculus Start with three symbols: +, x , and y λ -calculus and FOL λ -calculus and compositionality Treat each symbol as either a function or argument The semantics of words based on + x yields (+ x ) syntactic category (+ x ) y yields ((+ x ) y ) 16/37

  30. Computational Functions and arguments Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More generally, we can describe what’s going on by assuming that every expression is either a function or argument. For Semantic Analysis Problems instance, suppose we want to create: (+ x y ) : One Solution: λ -Calculus Start with three symbols: +, x , and y λ -calculus and FOL λ -calculus and compositionality Treat each symbol as either a function or argument The semantics of words based on + x yields (+ x ) syntactic category (+ x ) y yields ((+ x ) y ) Thus, when an expression (function) is applied to another expression (argument), a third expression (result) is obtained. 16/37

  31. Computational λ -calculus: Formal definition Semantics: Lambda Calculus Definition Scott Farrar CLMA, University of Washington far- Expressions in the language Λ are composed of: rar@u.washington.edu variables { a , b , c , . . . , x , y , z } Semantic Analysis Problems abstraction symbols: λ and . , the dot One Solution: λ -Calculus parentheses: ( and ) λ -calculus and FOL λ -calculus and compositionality λ -terms. T ∈ Λ iff one of the following holds: The semantics of words based on 1 T is a member of a countable set of variables syntactic category 2 T is of the form (MN) where M and N are in Λ. 3 T is of the form ( λ X . Y ) where X is a variable and Y is in Λ. Λ is the smallest language with this property. (MN) is called an application and λ X . Y is an abstraction . 17/37

  32. Computational Examples Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 18/37

  33. Computational Examples Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ -Calculus 1 λ x . x λ -calculus and FOL 4 λ -calculus and compositionality The semantics of words based on syntactic category 18/37

  34. Computational Examples Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ -Calculus 1 λ x . x λ -calculus and FOL 4 λ -calculus and compositionality 2 λ x . y ( λ x . z x ) The semantics of words based on syntactic category 18/37

  35. Computational Examples Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ -Calculus 1 λ x . x λ -calculus and FOL 4 λ -calculus and compositionality 2 λ x . y ( λ x . z x ) The semantics of words based on 3 λ x . x ( y ) syntactic category 18/37

  36. Computational Examples Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ -Calculus 1 λ x . x λ -calculus and FOL 4 λ -calculus and compositionality 2 λ x . y ( λ x . z x ) The semantics of words based on 3 λ x . x ( y ) syntactic category 18/37

  37. Computational λ -calculus and FOL Semantics: Lambda Calculus Standard definitions of FOL can be augmented with Scott Farrar CLMA, University λ -calculus. The point is that we can use standard FOL of Washington far- rar@u.washington.edu formulas as functions and create new FOL formulas compositionally. Semantic Analysis Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 19/37

  38. Computational λ -calculus and FOL Semantics: Lambda Calculus Standard definitions of FOL can be augmented with Scott Farrar CLMA, University λ -calculus. The point is that we can use standard FOL of Washington far- rar@u.washington.edu formulas as functions and create new FOL formulas compositionally. Semantic Analysis Problems One Solution: Definition λ -Calculus λ -calculus and FOL If in some formula a variable is bound by the λ operator, the λ -calculus and compositionality formula is called a lambda expression . The semantics of words based on syntactic category 19/37

  39. Computational λ -calculus and FOL Semantics: Lambda Calculus Standard definitions of FOL can be augmented with Scott Farrar CLMA, University λ -calculus. The point is that we can use standard FOL of Washington far- rar@u.washington.edu formulas as functions and create new FOL formulas compositionally. Semantic Analysis Problems One Solution: Definition λ -Calculus λ -calculus and FOL If in some formula a variable is bound by the λ operator, the λ -calculus and compositionality formula is called a lambda expression . The semantics of words based on syntactic category Syntactically, a λ -expression looks just like any other quantified expression: λ x . red ( x ) ∀ y . boat ( y ) ∃ z . floats ( z ) 19/37

  40. Computational Application expressions Semantics: Lambda Calculus Scott Farrar To symbolize compositionality, we can create a new formula CLMA, University of Washington far- from λ x . dog ( x ) by treating it as a function and then rar@u.washington.edu applying it to an argument : Semantic Analysis Problems λ x . dog ( x )( FIDO ) One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 20/37

  41. Computational Application expressions Semantics: Lambda Calculus Scott Farrar To symbolize compositionality, we can create a new formula CLMA, University of Washington far- from λ x . dog ( x ) by treating it as a function and then rar@u.washington.edu applying it to an argument : Semantic Analysis Problems λ x . dog ( x )( FIDO ) One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 20/37

  42. Computational Application expressions Semantics: Lambda Calculus Scott Farrar To symbolize compositionality, we can create a new formula CLMA, University of Washington far- from λ x . dog ( x ) by treating it as a function and then rar@u.washington.edu applying it to an argument : Semantic Analysis Problems λ x . dog ( x )( FIDO ) One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The result is: The semantics of dog ( FIDO ) words based on syntactic category 20/37

  43. Computational Application expressions Semantics: Lambda Calculus Scott Farrar To symbolize compositionality, we can create a new formula CLMA, University of Washington far- from λ x . dog ( x ) by treating it as a function and then rar@u.washington.edu applying it to an argument : Semantic Analysis Problems λ x . dog ( x )( FIDO ) One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The result is: The semantics of dog ( FIDO ) words based on syntactic category Definition Given some application expression F A the function can be reduced by a process called β -reduction , such that the result is F with all occurrences of variables bound by λ replaced by A . (The terminology has roots in the original papers of Church and Kleene.) 20/37

  44. Computational NLTK notes Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis The λ operator is represented by the single back slash \ , and Problems One Solution: is indicated with a raw string: λ -Calculus λ -calculus and FOL λ -calculus and compositionality 4 \ x . dog(x) (FIDO) The semantics of words based on syntactic category The Python string is the equivalent of the following application expression: λ x . dog x ( FIDO ) 21/37

  45. Computational Scope of λ Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu In the augmented FOL, the λ operator ranges over sets and Semantic Analysis Problems individuals, not just individuals as with ∀ and ∃ . One Solution: λ -Calculus λ -calculus and FOL example λ -calculus and compositionality The semantics of (\P. P) (walk(x)) words based on syntactic category reduces to: boat(x) 22/37

  46. Computational Summary of terminology Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu abstraction : the process of creating a λ function from Semantic Analysis a predicate logic formula. Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 23/37

  47. Computational Summary of terminology Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu abstraction : the process of creating a λ function from Semantic Analysis a predicate logic formula. Problems One Solution: λ expression : one with variables bound by the λ λ -Calculus λ -calculus and FOL operator, sometimes called a λ function. λ -calculus and compositionality The semantics of words based on syntactic category 23/37

  48. Computational Summary of terminology Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu abstraction : the process of creating a λ function from Semantic Analysis a predicate logic formula. Problems One Solution: λ expression : one with variables bound by the λ λ -Calculus λ -calculus and FOL operator, sometimes called a λ function. λ -calculus and compositionality application expression : one with a function and an The semantics of words based on argument. syntactic category 23/37

  49. Computational Summary of terminology Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu abstraction : the process of creating a λ function from Semantic Analysis a predicate logic formula. Problems One Solution: λ expression : one with variables bound by the λ λ -Calculus λ -calculus and FOL operator, sometimes called a λ function. λ -calculus and compositionality application expression : one with a function and an The semantics of words based on argument. syntactic category β -reduction : where subparts of a function are evaluated and rewritten until the function itself is reduced to a simpler form. 23/37

  50. Computational Steps in compositionality Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Steps in compositionally deriving a semantic representation: Semantic Analysis Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 24/37

  51. Computational Steps in compositionality Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Steps in compositionally deriving a semantic representation: Semantic Analysis Problems 1 Express the semantics of each constituent in terms of One Solution: λ -Calculus lambda expressions; λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 24/37

  52. Computational Steps in compositionality Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Steps in compositionally deriving a semantic representation: Semantic Analysis Problems 1 Express the semantics of each constituent in terms of One Solution: λ -Calculus lambda expressions; λ -calculus and FOL λ -calculus and 2 Determine which expression is the function and which is compositionality The semantics of the argument; words based on syntactic category 24/37

  53. Computational Steps in compositionality Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Steps in compositionally deriving a semantic representation: Semantic Analysis Problems 1 Express the semantics of each constituent in terms of One Solution: λ -Calculus lambda expressions; λ -calculus and FOL λ -calculus and 2 Determine which expression is the function and which is compositionality The semantics of the argument; words based on syntactic category 3 Apply the function to the argument; 24/37

  54. Computational Steps in compositionality Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Steps in compositionally deriving a semantic representation: Semantic Analysis Problems 1 Express the semantics of each constituent in terms of One Solution: λ -Calculus lambda expressions; λ -calculus and FOL λ -calculus and 2 Determine which expression is the function and which is compositionality The semantics of the argument; words based on syntactic category 3 Apply the function to the argument; 4 β -reduce the conjoined elements to arrive at the final semantic representation. 24/37

  55. Computational Example: Sue bikes Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Sue bikes ⇒ bikes ( SUE ) Semantic Analysis Given: Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 25/37

  56. Computational Example: Sue bikes Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Sue bikes ⇒ bikes ( SUE ) Semantic Analysis Given: Problems One Solution: λ -expression for Sue : \ P . P (SUE) λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 25/37

  57. Computational Example: Sue bikes Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Sue bikes ⇒ bikes ( SUE ) Semantic Analysis Given: Problems One Solution: λ -expression for Sue : \ P . P (SUE) λ -Calculus λ -calculus and FOL λ -calculus and λ -expression for bikes : \ x. bikes(x) compositionality The semantics of words based on syntactic category 25/37

  58. Computational Example: Sue bikes Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Sue bikes ⇒ bikes ( SUE ) Semantic Analysis Given: Problems One Solution: λ -expression for Sue : \ P . P (SUE) λ -Calculus λ -calculus and FOL λ -calculus and λ -expression for bikes : \ x. bikes(x) compositionality The semantics of words based on Derivation syntactic category 25/37

  59. Computational Example: Sue bikes Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Sue bikes ⇒ bikes ( SUE ) Semantic Analysis Given: Problems One Solution: λ -expression for Sue : \ P . P (SUE) λ -Calculus λ -calculus and FOL λ -calculus and λ -expression for bikes : \ x. bikes(x) compositionality The semantics of words based on Derivation syntactic category An application expression: \ P . P (SUE) ( \ x . bikes(x)) 25/37

  60. Computational Example: Sue bikes Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Sue bikes ⇒ bikes ( SUE ) Semantic Analysis Given: Problems One Solution: λ -expression for Sue : \ P . P (SUE) λ -Calculus λ -calculus and FOL λ -calculus and λ -expression for bikes : \ x. bikes(x) compositionality The semantics of words based on Derivation syntactic category An application expression: \ P . P (SUE) ( \ x . bikes(x)) \ x. bikes(x) (SUE) by β -reduction 25/37

  61. Computational Example: Sue bikes Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Sue bikes ⇒ bikes ( SUE ) Semantic Analysis Given: Problems One Solution: λ -expression for Sue : \ P . P (SUE) λ -Calculus λ -calculus and FOL λ -calculus and λ -expression for bikes : \ x. bikes(x) compositionality The semantics of words based on Derivation syntactic category An application expression: \ P . P (SUE) ( \ x . bikes(x)) \ x. bikes(x) (SUE) by β -reduction bikes(SUE) by β -reduction 25/37

  62. Computational Today’s lecture Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis 1 Semantic Analysis Problems Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality One Solution: λ -Calculus 2 The semantics of λ -calculus and FOL words based on syntactic category λ -calculus and compositionality The semantics of words based on syntactic category 3 26/37

  63. Computational General strategy for using λ -calculus Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis The point is to enrich each lexical entry with a semantics, Problems and then derive the semantic representation of the entire One Solution: λ -Calculus sentence or phrase. λ -calculus and FOL λ -calculus and compositionality The semantics of We’ll need to express the semantics of everything using words based on syntactic category λ -calculus. Namely, we’ll need to express the semantics of lexical items using the functional notation. NNP → Sue NNP [ sem = \ S . S (SUE) ] → Sue 27/37

  64. Computational Intransitive verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Intransitive verbs, in non-event style FOL, are mapped to Problems One Solution: unary predicates. The semantic attachment for run would be λ -Calculus λ x . run ( x ), a predicate waiting for an argument. Bill runs : λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 28/37

  65. Computational Intransitive verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Intransitive verbs, in non-event style FOL, are mapped to Problems One Solution: unary predicates. The semantic attachment for run would be λ -Calculus λ x . run ( x ), a predicate waiting for an argument. Bill runs : λ -calculus and FOL λ -calculus and compositionality The semantics of words based on \ x.run(x) (BILL) reduces to: run(BILL) syntactic category 28/37

  66. Computational Intransitive verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Intransitive verbs, in non-event style FOL, are mapped to Problems One Solution: unary predicates. The semantic attachment for run would be λ -Calculus λ x . run ( x ), a predicate waiting for an argument. Bill runs : λ -calculus and FOL λ -calculus and compositionality The semantics of words based on \ x.run(x) (BILL) reduces to: run(BILL) syntactic category But, Bill comes before the verb in the syntax. 28/37

  67. Computational Proper nouns Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Ordinarily. the semantic attachment for Bill would be a Problems constant like BILL , as proper nouns are (non-logical) One Solution: λ -Calculus constants, i.e., always arguments of other expressions. But λ -calculus and FOL λ -calculus and in a λ system, the semantic attachment is \ P . P (BILL) compositionality The semantics of words based on syntactic category 29/37

  68. Computational Proper nouns Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Semantic Analysis Ordinarily. the semantic attachment for Bill would be a Problems constant like BILL , as proper nouns are (non-logical) One Solution: λ -Calculus constants, i.e., always arguments of other expressions. But λ -calculus and FOL λ -calculus and in a λ system, the semantic attachment is \ P . P (BILL) compositionality The semantics of words based on syntactic category Why? Because we need the semantics of a proper noun to be a function in order to get our representations to come out correctly. 29/37

  69. Computational Intransitive verbs, proper order Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu We need to preserve the order from the syntax. For Bill Semantic Analysis runs , we need to find a semantic representation for the word Problems Bill and then for runs : One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 30/37

  70. Computational Intransitive verbs, proper order Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu We need to preserve the order from the syntax. For Bill Semantic Analysis runs , we need to find a semantic representation for the word Problems Bill and then for runs : One Solution: λ -Calculus λ -calculus and FOL λ -calculus and ( \ P. P) (BILL) ( \ x.run(x)) reduces to: compositionality The semantics of \ x.run(x) (BILL) words based on syntactic category run(BILL) 30/37

  71. Computational Intransitive verbs, proper order Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu We need to preserve the order from the syntax. For Bill Semantic Analysis runs , we need to find a semantic representation for the word Problems Bill and then for runs : One Solution: λ -Calculus λ -calculus and FOL λ -calculus and ( \ P. P) (BILL) ( \ x.run(x)) reduces to: compositionality The semantics of \ x.run(x) (BILL) words based on syntactic category run(BILL) Thus, order from the syntax can be used as is, which makes things much easier for compositionality. 30/37

  72. Computational Transitive Verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More care has to be taken to specify the order of reduction Semantic Analysis for the semantics of transitive verbs and di-transitive verbs. Problems These are respectively binary and ternary predicates in FOL. One Solution: λ -Calculus For a transitive verb like love : λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 31/37

  73. Computational Transitive Verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More care has to be taken to specify the order of reduction Semantic Analysis for the semantics of transitive verbs and di-transitive verbs. Problems These are respectively binary and ternary predicates in FOL. One Solution: λ -Calculus For a transitive verb like love : λ -calculus and FOL λ -calculus and compositionality \ y. \ x. The semantics of love(x,y) words based on syntactic category 31/37

  74. Computational Transitive Verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More care has to be taken to specify the order of reduction Semantic Analysis for the semantics of transitive verbs and di-transitive verbs. Problems These are respectively binary and ternary predicates in FOL. One Solution: λ -Calculus For a transitive verb like love : λ -calculus and FOL λ -calculus and compositionality \ y. \ x. The semantics of love(x,y) words based on syntactic category \ y. \ x. love(x,y) (BETTY) 31/37

  75. Computational Transitive Verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More care has to be taken to specify the order of reduction Semantic Analysis for the semantics of transitive verbs and di-transitive verbs. Problems These are respectively binary and ternary predicates in FOL. One Solution: λ -Calculus For a transitive verb like love : λ -calculus and FOL λ -calculus and compositionality \ y. \ x. The semantics of love(x,y) words based on syntactic category \ y. \ x. love(x,y) (BETTY) \ x. love(x,BETTY) 31/37

  76. Computational Transitive Verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More care has to be taken to specify the order of reduction Semantic Analysis for the semantics of transitive verbs and di-transitive verbs. Problems These are respectively binary and ternary predicates in FOL. One Solution: λ -Calculus For a transitive verb like love : λ -calculus and FOL λ -calculus and compositionality \ y. \ x. The semantics of love(x,y) words based on syntactic category \ y. \ x. love(x,y) (BETTY) \ x. love(x,BETTY) \ x. love(x,BETTY) (JIM) 31/37

  77. Computational Transitive Verbs Semantics: Lambda Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu More care has to be taken to specify the order of reduction Semantic Analysis for the semantics of transitive verbs and di-transitive verbs. Problems These are respectively binary and ternary predicates in FOL. One Solution: λ -Calculus For a transitive verb like love : λ -calculus and FOL λ -calculus and compositionality \ y. \ x. The semantics of love(x,y) words based on syntactic category \ y. \ x. love(x,y) (BETTY) \ x. love(x,BETTY) \ x. love(x,BETTY) (JIM) love(JIM,BETTY) 31/37

  78. Computational Transitive Verbs, proper order Semantics: Lambda Calculus Scott Farrar But, how do we deal with the linear order of the NL string? CLMA, University of Washington far- Due to subject and object order, the following will not rar@u.washington.edu reduce, since JIM is not a function: Semantic Analysis Problems One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 32/37

  79. Computational Transitive Verbs, proper order Semantics: Lambda Calculus Scott Farrar But, how do we deal with the linear order of the NL string? CLMA, University of Washington far- Due to subject and object order, the following will not rar@u.washington.edu reduce, since JIM is not a function: Semantic Analysis Problems Consider: One Solution: λ -Calculus λ -calculus and FOL λ -calculus and compositionality The semantics of words based on syntactic category 32/37

  80. Computational Transitive Verbs, proper order Semantics: Lambda Calculus Scott Farrar But, how do we deal with the linear order of the NL string? CLMA, University of Washington far- Due to subject and object order, the following will not rar@u.washington.edu reduce, since JIM is not a function: Semantic Analysis Problems Consider: One Solution: λ -Calculus λ -calculus and FOL \ Q. Q (JIM) which is another form of simply JIM λ -calculus and compositionality The semantics of words based on syntactic category 32/37

  81. Computational Transitive Verbs, proper order Semantics: Lambda Calculus Scott Farrar But, how do we deal with the linear order of the NL string? CLMA, University of Washington far- Due to subject and object order, the following will not rar@u.washington.edu reduce, since JIM is not a function: Semantic Analysis Problems Consider: One Solution: λ -Calculus λ -calculus and FOL \ Q. Q (JIM) which is another form of simply JIM λ -calculus and compositionality \ X y. X( \ x. loves(y,x)) The semantics of words based on syntactic category 32/37

  82. Computational Transitive Verbs, proper order Semantics: Lambda Calculus Scott Farrar But, how do we deal with the linear order of the NL string? CLMA, University of Washington far- Due to subject and object order, the following will not rar@u.washington.edu reduce, since JIM is not a function: Semantic Analysis Problems Consider: One Solution: λ -Calculus λ -calculus and FOL \ Q. Q (JIM) which is another form of simply JIM λ -calculus and compositionality \ X y. X( \ x. loves(y,x)) The semantics of words based on syntactic category 32/37

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend