<<

Computational : Lambda

Scott Farrar CLMA, University of Washington far- [email protected]

Computational Semantics: Semantic Analysis Problems One Solution: λ-Calculus Scott Farrar λ-calculus and FOL λ-calculus and CLMA, University of Washington compositionality The semantics of [email protected] words based on syntactic category

February 24, 2010

1/37 Computational Today’s lecture Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

1 Semantic Analysis Semantic Analysis Problems Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and 2 One Solution: λ-Calculus compositionality The semantics of λ-calculus and FOL words based on syntactic category λ-calculus and compositionality

3 The semantics of words based on syntactic category

2/37 Computational Semantic analysis Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Definition [email protected] Semantic analysis is the derivation of a semantic Semantic Analysis Problems representation from a string of words (perhaps marked up One Solution: with syntactic structure). In other words, sentences of λ-Calculus λ-calculus and FOL λ-calculus and NL onto logical formulas. compositionality The semantics of words based on Map Jim loves Betty to love(JIM, BETTY ) syntactic category

There are several competing approaches for doing this, as there are several competing standards for the right semantic representation (use of event vs. relations).

3/37 Computational Compositionality Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Definition [email protected] Recall the principle of compositionality: the meaning of a Semantic Analysis Problems complex is a of the meaning of its parts. One Solution: λ-Calculus λ-calculus and FOL λ-calculus and The assumption is that we should be able to assign each compositionality The semantics of “part” a meaning, then build larger structures, guided by the words based on syntax of the language. syntactic category

The syntax of NL and the syntax of logic are similar, but ultimately not one-to-one compatible: translation between the two is a non-trivial task.

4/37 ∃e ∃b [SailBoat(b) ∧ HeelingEvent(e) ∧ actor(e, b)]

My sailboat is on the bottom. ∃e [SpatialLocating(e) ∧ theme(e, MYSB) ∧ loc(e, SEAFLOOR)]

Computational Event structure Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis A sailboat heels. Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

5/37 My sailboat is on the bottom. ∃e [SpatialLocating(e) ∧ theme(e, MYSB) ∧ loc(e, SEAFLOOR)]

Computational Event structure Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis A sailboat heels. Problems One Solution: λ-Calculus ∃e ∃b [SailBoat(b) ∧ HeelingEvent(e) ∧ actor(e, b)] λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

5/37 ∃e [SpatialLocating(e) ∧ theme(e, MYSB) ∧ loc(e, SEAFLOOR)]

Computational Event structure Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis A sailboat heels. Problems One Solution: λ-Calculus ∃e ∃b [SailBoat(b) ∧ HeelingEvent(e) ∧ actor(e, b)] λ-calculus and FOL λ-calculus and compositionality The semantics of My sailboat is on the bottom. words based on syntactic category

5/37 Computational Event structure Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis A sailboat heels. Problems One Solution: λ-Calculus ∃e ∃b [SailBoat(b) ∧ HeelingEvent(e) ∧ actor(e, b)] λ-calculus and FOL λ-calculus and compositionality The semantics of My sailboat is on the bottom. words based on syntactic category ∃e [SpatialLocating(e) ∧ theme(e, MYSB) ∧ loc(e, SEAFLOOR)]

5/37 Let’s assume strict compositionality and say that the meaning of each syntactic constituent contributes to the meaning of the parent constituent. We could come up with something like XP.sem to stand for the semantics of some constituent XP.

Definition Semantic attachment refers to the adornment of phrase structure rules with such semantic information.

Computational Semantic attachments Semantics: Lambda Calculus Consider the problem of two-place predicates in a Scott Farrar CLMA, University non-event-style semantics: we need to map Jim loves Betty of Washington far- [email protected] to something like: Semantic Analysis love(JIM, BETTY ) Problems One Solution: λ-Calculus λ-calculus and FOL . λ-calculus and compositionality The semantics of words based on syntactic category

6/37 Definition Semantic attachment refers to the adornment of phrase structure rules with such semantic information.

Computational Semantic attachments Semantics: Lambda Calculus Consider the problem of two-place predicates in a Scott Farrar CLMA, University non-event-style semantics: we need to map Jim loves Betty of Washington far- [email protected] to something like: Semantic Analysis love(JIM, BETTY ) Problems One Solution: λ-Calculus λ-calculus and FOL . λ-calculus and compositionality The semantics of Let’s assume strict compositionality and say that the words based on syntactic category meaning of each syntactic constituent contributes to the meaning of the parent constituent. We could come up with something like XP.sem to stand for the semantics of some constituent XP.

6/37 Computational Semantic attachments Semantics: Lambda Calculus Consider the problem of two-place predicates in a Scott Farrar CLMA, University non-event-style semantics: we need to map Jim loves Betty of Washington far- [email protected] to something like: Semantic Analysis love(JIM, BETTY ) Problems One Solution: λ-Calculus λ-calculus and FOL . λ-calculus and compositionality The semantics of Let’s assume strict compositionality and say that the words based on syntactic category meaning of each syntactic constituent contributes to the meaning of the parent constituent. We could come up with something like XP.sem to stand for the semantics of some constituent XP.

Definition Semantic attachment refers to the adornment of phrase structure rules with such semantic information.

6/37 Computational Semantic attachments Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

7/37 S.sem = NP.sem + VP.sem VP.sem = V.sem + NP.sem V.sem = love.sem love.sem = love(x, y) NP.sem = NNP.sem NNP.sem = Betty.sem or Jim.sem Betty.sem = BETTY Jim.sem = JIM

Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

loves(JIM, BETTY )

8/37 VP.sem = V.sem + NP.sem V.sem = love.sem love.sem = love(x, y) NP.sem = NNP.sem NNP.sem = Betty.sem or Jim.sem Betty.sem = BETTY Jim.sem = JIM

Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

loves(JIM, BETTY )

8/37 V.sem = love.sem love.sem = love(x, y) NP.sem = NNP.sem NNP.sem = Betty.sem or Jim.sem Betty.sem = BETTY Jim.sem = JIM

Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

loves(JIM, BETTY )

8/37 love.sem = love(x, y) NP.sem = NNP.sem NNP.sem = Betty.sem or Jim.sem Betty.sem = BETTY Jim.sem = JIM

Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ-Calculus λ-calculus and FOL λ-calculus and V.sem = love.sem compositionality The semantics of words based on syntactic category

loves(JIM, BETTY )

8/37 NP.sem = NNP.sem NNP.sem = Betty.sem or Jim.sem Betty.sem = BETTY Jim.sem = JIM

Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ-Calculus λ-calculus and FOL λ-calculus and V.sem = love.sem compositionality The semantics of love.sem = love(x, y) words based on syntactic category

loves(JIM, BETTY )

8/37 NNP.sem = Betty.sem or Jim.sem Betty.sem = BETTY Jim.sem = JIM

Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ-Calculus λ-calculus and FOL λ-calculus and V.sem = love.sem compositionality The semantics of love.sem = love(x, y) words based on syntactic category NP.sem = NNP.sem

loves(JIM, BETTY )

8/37 Betty.sem = BETTY Jim.sem = JIM

Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ-Calculus λ-calculus and FOL λ-calculus and V.sem = love.sem 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 Jim.sem = JIM

Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ-Calculus λ-calculus and FOL λ-calculus and V.sem = love.sem 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 Computational Example: Semantic attachments Semantics: Lambda Calculus

Scott Farrar Assume that the + symbol stands for the compositionality CLMA, University of Washington far- operator: [email protected]

Semantic Analysis S.sem = NP.sem + VP.sem Problems One Solution: VP.sem = V.sem + NP.sem λ-Calculus λ-calculus and FOL λ-calculus and V.sem = love.sem 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 Betty is loved by Jim. It’s Jim who loves Betty. Betty is the one loved by Jim.

All clues to how the semantic representation might look are found in the syntactic structure of NL. All this, without even considering the problem.

Computational Analysis problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 It’s Jim who loves Betty. Betty is the one loved by Jim.

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.

Computational Analysis problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 Betty is the one loved by Jim.

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.

Computational Analysis problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

But what about other examples: Semantic Analysis Problems Betty is loved by Jim. One Solution: λ-Calculus λ-calculus and FOL It’s Jim who loves Betty. λ-calculus and compositionality The semantics of words based on syntactic category

9/37 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.

Computational Analysis problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

But what about other examples: Semantic Analysis Problems Betty is loved by Jim. One Solution: λ-Calculus λ-calculus and FOL It’s Jim who loves Betty. λ-calculus and compositionality Betty is the one loved by Jim. The semantics of words based on syntactic category

9/37 Computational Analysis problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

But what about other examples: Semantic Analysis Problems Betty is loved by Jim. One Solution: λ-Calculus λ-calculus and FOL It’s Jim who loves Betty. λ-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 Computational Analysis problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

The analysis problem: there is no (elegant) way to fill in Semantic Analysis Problems the of formulas at the level of semantic One Solution: representation, in a way that is consistent with the syntax. λ-Calculus λ-calculus and FOL λ-calculus and In other words, there is no formal means of combining parts 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 position of the predicate love(x, y).

10/37 We can very easily express the meaning of full sentences in plain FOL. We can say that a sentence is true given some state of the world. John kissed Mary is T just in case John really did kiss Mary.

With standard truth-conditional semantics, where the truth of can either be T or F , such logical expressions have a . BUT...

Computational Representation problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] Representation problem: no way to represent the meaning for some kinds of constituents. Semantic Analysis Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

11/37 With standard truth-conditional semantics, where the truth of propositions can either be T or F , such logical expressions have a truth value. BUT...

Computational Representation problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] Representation problem: no way to represent the meaning for some kinds of constituents. Semantic Analysis 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 Computational Representation problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] Representation problem: no way to represent the meaning for some kinds of constituents. Semantic Analysis 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 But kiss(x, OPRA) has no truth value. This is because there are unbound variables: x has no connection to the UD. Such open sentences are neither T or F . Intuitively however, we know what a NL predicate/VP 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 .

Computational Representation problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra. The [email protected]

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 But kiss(x, OPRA) has no truth value. This is because there are unbound variables: x has no connection to the UD. Such open sentences are neither T or F . Intuitively however, we know what a NL predicate/VP 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.

Computational Representation problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra. The [email protected]

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 Intuitively however, we know what a NL predicate/VP 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.

Computational Representation problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra. The [email protected]

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 λ-calculus and there are unbound variables: x has no connection to the compositionality UD. Such open sentences are neither T or F . The semantics of words based on syntactic category

12/37 But we cannot express the meaning of this in FOL given our current machinery, since we’ll always have an unbound variable.

Computational Representation problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra. The [email protected]

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 λ-calculus and there are unbound variables: x has no connection to the 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 Computational Representation problem Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- What about constituents like VPs: kissed Opra. The [email protected]

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 λ-calculus and there are unbound variables: x has no connection to the 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 Computational Summary Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

In summary then, we have at least two problems for Semantic Analysis Problems compositionality: One Solution: λ-Calculus λ-calculus and FOL λ-calculus and 1 Analysis problem: No systematic way to use syntax to 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 Computational Today’s lecture Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

1 Semantic Analysis Semantic Analysis Problems Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and 2 One Solution: λ-Calculus compositionality The semantics of λ-calculus and FOL words based on syntactic category λ-calculus and compositionality

3 The semantics of words based on syntactic category

14/37 Otherwise, we’d have a named function, something like: add(x, y)

Remember Lisp? The second oldest high-level , and still used today (invented by John McCarthy, 1958). Lisp (pure Lisp at least) deals exclusively with functions, and functions can be created on the fly and without names.

In Lisp, this expression evaluates to an : (lambda (x y) (+ x y)), read as “the pair x and y are mapped to x + y”.

Computational back to Church Semantics: Lambda Calculus created a calculus for describing arbitrary Scott Farrar CLMA, University functions, called λ-calculus. (It was developed to give a of Washington far- [email protected] 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 Otherwise, we’d have a named function, something like: add(x, y)

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”.

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- [email protected] 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 Remember Lisp? The second oldest high-level programming 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 Otherwise, we’d have a named function, something like: add(x, y)

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- [email protected] 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 Remember Lisp? The second oldest high-level programming 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 Otherwise, we’d have a named function, something like: add(x, y)

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- [email protected] 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 Remember Lisp? The second oldest high-level programming 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 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- [email protected] 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 Remember Lisp? The second oldest high-level programming 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 Start with three symbols: +, x, and y Treat each symbol as either a function or argument + x yields (+ x) (+ x) y yields ((+x)y)

Thus, when an expression (function) is applied to another expression (argument), a third expression (result) is obtained.

Computational Functions and arguments Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 Treat each symbol as either a function or argument + x yields (+ x) (+ x) y yields ((+x)y)

Thus, when an expression (function) is applied to another expression (argument), a third expression (result) is obtained.

Computational Functions and arguments Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 + x yields (+ x) (+ x) y yields ((+x)y)

Thus, when an expression (function) is applied to another expression (argument), a third expression (result) is obtained.

Computational Functions and arguments Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 Treat each symbol as either a function or argument compositionality The semantics of words based on syntactic category

16/37 (+ x) y yields ((+x)y)

Thus, when an expression (function) is applied to another expression (argument), a third expression (result) is obtained.

Computational Functions and arguments Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 Treat each symbol as either a function or argument compositionality The semantics of words based on + x yields (+ x) syntactic category

16/37 Thus, when an expression (function) is applied to another expression (argument), a third expression (result) is obtained.

Computational Functions and arguments Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 Treat each symbol as either a function or argument compositionality The semantics of words based on + x yields (+ x) syntactic category (+ x) y yields ((+x)y)

16/37 Computational Functions and arguments Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 Treat each symbol as either a function or argument compositionality 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 Computational λ-calculus: Formal definition Semantics: Lambda Calculus

Scott Farrar Definition CLMA, University of Washington far- Expressions in the language Λ are composed of: [email protected]

variables {a, b, ,..., x, y, z} Semantic Analysis abstraction symbols: λ and ., the dot Problems One Solution: λ-Calculus parentheses: ( and ) λ-calculus and FOL λ-calculus and λ-terms. T ∈ Λ iff one of the following holds: compositionality 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 1 λx . x 2 λx . y (λ x . z x) 3 λx . x (y)

Computational Examples Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 2 λx . y (λ x . z x) 3 λx . x (y)

Computational Examples Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ-Calculus 41 λ-calculus and FOL λx . x λ-calculus and compositionality The semantics of words based on syntactic category

18/37 3 λx . x (y)

Computational Examples Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ-Calculus 41 λ-calculus and FOL λx . x λ-calculus and compositionality 2 λx . y (λ x . z x) The semantics of words based on syntactic category

18/37 Computational Examples Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ-Calculus 41 λ-calculus and FOL λx . x λ-calculus and compositionality 2 λx . y (λ x . z x) The semantics of words based on 3 λx . x (y) syntactic category

18/37 Computational Examples Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems The following are all examples of λ expressions: One Solution: λ-Calculus 41 λ-calculus and FOL λx . x λ-calculus and compositionality 2 λx . y (λ x . z x) The semantics of words based on 3 λx . x (y) syntactic category

18/37 Definition If in some formula a variable is bound by the λ operator, the formula is called a lambda expression.

Syntactically, a λ-expression looks just like any other quantified expression:

λx.red(x)

∀y.boat(y) ∃z.floats(z)

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- [email protected] 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 Syntactically, a λ-expression looks just like any other quantified expression:

λx.red(x)

∀y.boat(y) ∃z.floats(z)

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- [email protected] formulas as functions and create new FOL formulas compositionally. Semantic Analysis Problems One Solution: Definition λ-Calculus λ-calculus and FOL λ-calculus and If in some formula a variable is bound by the λ operator, the compositionality formula is called a lambda expression. The semantics of words based on syntactic category

19/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- [email protected] formulas as functions and create new FOL formulas compositionally. Semantic Analysis Problems One Solution: Definition λ-Calculus λ-calculus and FOL λ-calculus and If in some formula a variable is bound by the λ operator, the 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 Definition Given some application expression FA 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.)

The result is: dog(FIDO)

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 [email protected] 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 Definition Given some application expression FA 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.)

The result is: dog(FIDO)

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 [email protected] 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 Definition Given some application expression FA 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.)

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 [email protected] 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 words based on dog(FIDO) syntactic category

20/37 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 [email protected] 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 words based on dog(FIDO) syntactic category

Definition Given some application expression FA 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 Computational NLTK notes Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 Computational of λ Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 λ-calculus and example compositionality The semantics of (\P. P) (walk(x)) words based on syntactic category reduces to:

boat(x)

22/37 λ expression: one with variables bound by the λ operator, sometimes called a λ function. application expression: one with a function and an argument. β-reduction: where subparts of a function are evaluated and rewritten until the function itself is reduced to a simpler form.

Computational Summary of terminology Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 application expression: one with a function and an argument. β-reduction: where subparts of a function are evaluated and rewritten until the function itself is reduced to a simpler form.

Computational Summary of terminology Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 λ-calculus and operator, sometimes called a λ function. compositionality The semantics of words based on syntactic category

23/37 β-reduction: where subparts of a function are evaluated and rewritten until the function itself is reduced to a simpler form.

Computational Summary of terminology Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 λ-calculus and operator, sometimes called a λ function. compositionality application expression: one with a function and an The semantics of words based on argument. syntactic category

23/37 Computational Summary of terminology Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 λ-calculus and operator, sometimes called a λ function. 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 1 Express the semantics of each constituent in terms of lambda expressions; 2 Determine which expression is the function and which is the argument; 3 the function to the argument; 4 β-reduce the conjoined elements to arrive at the final semantic representation.

Computational Steps in compositionality Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 2 Determine which expression is the function and which is the argument; 3 Apply the function to the argument; 4 β-reduce the conjoined elements to arrive at the final semantic representation.

Computational Steps in compositionality Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 3 Apply the function to the argument; 4 β-reduce the conjoined elements to arrive at the final semantic representation.

Computational Steps in compositionality Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 2 Determine which expression is the function and which is The semantics of the argument; words based on syntactic category

24/37 4 β-reduce the conjoined elements to arrive at the final semantic representation.

Computational Steps in compositionality Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 2 Determine which expression is the function and which is The semantics of the argument; words based on syntactic category 3 Apply the function to the argument;

24/37 Computational Steps in compositionality Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 2 Determine which expression is the function and which is 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 An application expression: \ P . P (SUE) ( \ x . bikes(x)) \ x. bikes(x) (SUE) by β-reduction bikes(SUE) by β-reduction

λ-expression for Sue: \ P . P (SUE) λ-expression for bikes: \ x. bikes(x)

Derivation

Computational Example: Sue bikes Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Sue bikes ⇒ bikes(SUE) [email protected]

Semantic Analysis Given: Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

25/37 An application expression: \ P . P (SUE) ( \ x . bikes(x)) \ x. bikes(x) (SUE) by β-reduction bikes(SUE) by β-reduction

λ-expression for bikes: \ x. bikes(x)

Derivation

Computational Example: Sue bikes Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Sue bikes ⇒ bikes(SUE) [email protected]

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 An application expression: \ P . P (SUE) ( \ x . bikes(x)) \ x. bikes(x) (SUE) by β-reduction bikes(SUE) by β-reduction

Derivation

Computational Example: Sue bikes Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Sue bikes ⇒ bikes(SUE) [email protected]

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 An application expression: \ P . P (SUE) ( \ x . bikes(x)) \ x. bikes(x) (SUE) by β-reduction bikes(SUE) by β-reduction

Computational Example: Sue bikes Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Sue bikes ⇒ bikes(SUE) [email protected]

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 \ x. bikes(x) (SUE) by β-reduction bikes(SUE) by β-reduction

Computational Example: Sue bikes Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Sue bikes ⇒ bikes(SUE) [email protected]

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 bikes(SUE) by β-reduction

Computational Example: Sue bikes Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Sue bikes ⇒ bikes(SUE) [email protected]

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 Computational Example: Sue bikes Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- Sue bikes ⇒ bikes(SUE) [email protected]

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 Computational Today’s lecture Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

1 Semantic Analysis Semantic Analysis Problems Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and 2 One Solution: λ-Calculus compositionality The semantics of λ-calculus and FOL words based on syntactic category λ-calculus and compositionality

3 The semantics of words based on syntactic category

26/37 Computational General strategy for using λ-calculus Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 \ x.run(x) (BILL) reduces to: run(BILL)

But, Bill comes before the verb in the syntax.

Computational Intransitive verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 λ-calculus and FOL λx.run(x), a predicate waiting for an argument. Bill runs: λ-calculus and compositionality The semantics of words based on syntactic category

28/37 But, Bill comes before the verb in the syntax.

Computational Intransitive verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 λ-calculus and FOL λx.run(x), a predicate waiting for an argument. Bill runs: λ-calculus and compositionality The semantics of words based on \ x.run(x) (BILL) reduces to: run(BILL) syntactic category

28/37 Computational Intransitive verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 λ-calculus and FOL λx.run(x), a predicate waiting for an argument. Bill runs: λ-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 Why? Because we need the semantics of a proper noun to be a function in order to get our representations to come out correctly.

Computational Proper nouns Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 Computational Proper nouns Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

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 (\ P. P) (BILL) (\ x.run(x)) reduces to: \ x.run(x) (BILL) run(BILL)

Thus, order from the syntax can be used as is, which makes things much easier for compositionality.

Computational Intransitive verbs, proper order Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 Thus, order from the syntax can be used as is, which makes things much easier for compositionality.

Computational Intransitive verbs, proper order Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 \ words based on x.run(x) (BILL) syntactic category run(BILL)

30/37 Computational Intransitive verbs, proper order Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 \ words based on x.run(x) (BILL) syntactic category run(BILL)

Thus, order from the syntax can be used as is, which makes things much easier for compositionality.

30/37 \ y. \ x. love(x,y) \ y. \ x. love(x,y) (BETTY) \ x. love(x,BETTY) \ x. love(x,BETTY) (JIM) love(JIM,BETTY)

Computational Transitive Verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 \ y. \ x. love(x,y) (BETTY) \ x. love(x,BETTY) \ x. love(x,BETTY) (JIM) love(JIM,BETTY)

Computational Transitive Verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 \ y. \ x. love(x,y) words based on syntactic category

31/37 \ x. love(x,BETTY) \ x. love(x,BETTY) (JIM) love(JIM,BETTY)

Computational Transitive Verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 \ y. \ x. love(x,y) words based on syntactic category \ y. \ x. love(x,y) (BETTY)

31/37 \ x. love(x,BETTY) (JIM) love(JIM,BETTY)

Computational Transitive Verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 \ y. \ x. love(x,y) words based on syntactic category \ y. \ x. love(x,y) (BETTY) \ x. love(x,BETTY)

31/37 love(JIM,BETTY)

Computational Transitive Verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 \ y. \ x. 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 Computational Transitive Verbs Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] 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 \ y. \ x. 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 \ Q. Q (JIM) which is another form of simply JIM \ X y. X(\ x. loves(y,x))

\ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms (\ Q . Q (BETTY)) (\ x. loves(y,x)) \ x. loves(y,x) (BETTY) loves(y,BETTY)

Consider:

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 [email protected] 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 \ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms (\ Q . Q (BETTY)) (\ x. loves(y,x)) \ x. loves(y,x) (BETTY) loves(y,BETTY)

\ Q. Q (JIM) which is another form of simply JIM \ X y. X(\ x. loves(y,x))

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 [email protected] reduce, since JIM is not a function: Semantic Analysis Problems One Solution: Consider: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

32/37 \ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms (\ Q . Q (BETTY)) (\ x. loves(y,x)) \ x. loves(y,x) (BETTY) loves(y,BETTY)

\ X y. X(\ x. loves(y,x))

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 [email protected] reduce, since JIM is not a function: Semantic Analysis Problems One Solution: Consider: λ-Calculus λ-calculus and FOL λ-calculus and \ Q. Q (JIM) which is another form of simply JIM compositionality The semantics of words based on syntactic category

32/37 \ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms (\ Q . Q (BETTY)) (\ x. loves(y,x)) \ x. loves(y,x) (BETTY) loves(y,BETTY)

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 [email protected] reduce, since JIM is not a function: Semantic Analysis Problems One Solution: Consider: λ-Calculus λ-calculus and FOL λ-calculus and \ Q. Q (JIM) which is another form of simply JIM compositionality \ X y. X(\ x. loves(y,x)) The semantics of words based on syntactic category

32/37 \ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms (\ Q . Q (BETTY)) (\ x. loves(y,x)) \ x. loves(y,x) (BETTY) loves(y,BETTY)

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 [email protected] reduce, since JIM is not a function: Semantic Analysis Problems One Solution: Consider: λ-Calculus λ-calculus and FOL λ-calculus and \ Q. Q (JIM) which is another form of simply JIM compositionality \ X y. X(\ x. loves(y,x)) The semantics of words based on syntactic category

32/37 (\ Q . Q (BETTY)) (\ x. loves(y,x)) \ x. loves(y,x) (BETTY) loves(y,BETTY)

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 [email protected] reduce, since JIM is not a function: Semantic Analysis Problems One Solution: Consider: λ-Calculus λ-calculus and FOL λ-calculus and \ Q. Q (JIM) which is another form of simply JIM compositionality \ X y. X(\ x. loves(y,x)) The semantics of words based on syntactic category \ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms

32/37 \ x. loves(y,x) (BETTY) loves(y,BETTY)

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 [email protected] reduce, since JIM is not a function: Semantic Analysis Problems One Solution: Consider: λ-Calculus λ-calculus and FOL λ-calculus and \ Q. Q (JIM) which is another form of simply JIM compositionality \ X y. X(\ x. loves(y,x)) The semantics of words based on syntactic category \ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms (\ Q . Q (BETTY)) (\ x. loves(y,x))

32/37 loves(y,BETTY)

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 [email protected] reduce, since JIM is not a function: Semantic Analysis Problems One Solution: Consider: λ-Calculus λ-calculus and FOL λ-calculus and \ Q. Q (JIM) which is another form of simply JIM compositionality \ X y. X(\ x. loves(y,x)) The semantics of words based on syntactic category \ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms (\ Q . Q (BETTY)) (\ x. loves(y,x)) \ x. loves(y,x) (BETTY)

32/37 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 [email protected] reduce, since JIM is not a function: Semantic Analysis Problems One Solution: Consider: λ-Calculus λ-calculus and FOL λ-calculus and \ Q. Q (JIM) which is another form of simply JIM compositionality \ X y. X(\ x. loves(y,x)) The semantics of words based on syntactic category \ X y. X (\ x. loves(y,x)) ( \ Q.Q (BETTY)) just the inner terms (\ Q . Q (BETTY)) (\ x. loves(y,x)) \ x. loves(y,x) (BETTY) loves(y,BETTY)

32/37 \ y.loves(y,BETTY) \ P . P (JIM) (\ y.loves(y,BETTY)) \ y.loves(y,BETTY) (JIM) loves(JIM,BETTY)

Computational Transitive Verbs, proper order Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

33/37 \ P . P (JIM) (\ y.loves(y,BETTY)) \ y.loves(y,BETTY) (JIM) loves(JIM,BETTY)

Computational Transitive Verbs, proper order Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems One Solution: \ y.loves(y,BETTY) λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

33/37 \ y.loves(y,BETTY) (JIM) loves(JIM,BETTY)

Computational Transitive Verbs, proper order Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems One Solution: \ y.loves(y,BETTY) λ-Calculus λ-calculus and FOL λ-calculus and \ P . P (JIM) (\ y.loves(y,BETTY)) compositionality The semantics of words based on syntactic category

33/37 loves(JIM,BETTY)

Computational Transitive Verbs, proper order Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems One Solution: \ y.loves(y,BETTY) λ-Calculus λ-calculus and FOL λ-calculus and \ P . P (JIM) (\ y.loves(y,BETTY)) compositionality The semantics of \ y.loves(y,BETTY) (JIM) words based on syntactic category

33/37 Computational Transitive Verbs, proper order Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems One Solution: \ y.loves(y,BETTY) λ-Calculus λ-calculus and FOL λ-calculus and \ P . P (JIM) (\ y.loves(y,BETTY)) compositionality The semantics of \ y.loves(y,BETTY) (JIM) words based on loves(JIM,BETTY) syntactic category

33/37 Full transitive verb example

And the mostly unreadable full lambda epression for Jim loves Betty: \ P . P (JIM) (\ X y. X(\ x. loves(y,x)) ( \ Q . Q (BETTY))) For example, the semantic attachment for dog would be: \ x.dog(x) in λ-calculus.

Computational Nouns Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems Common nouns work just like intransitive verbs, i.e., the One Solution: λ-Calculus semantic attachment is a unary predicate. λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

35/37 Computational Nouns Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected]

Semantic Analysis Problems Common nouns work just like intransitive verbs, i.e., the One Solution: λ-Calculus semantic attachment is a unary predicate. λ-calculus and FOL λ-calculus and compositionality The semantics of For example, the semantic attachment for dog would be: words based on syntactic category \ x.dog(x) in λ-calculus.

35/37 The semantics of the copula looks just like the sematnics of any transitive verb (see previous).

For the negative copula (ain’t, isn’t, etc.) we have a slightly different formula: \ X y. X (\ x.-eq(y,x))

Computational Copulas Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] The copula (am, is, are, etc.) is a special kind of transitive verb, as it equates the subject and object. We introduce a Semantic Analysis Problems special binary predicate eq for the semantics of the copula: One Solution: \ X y. X(\ x. eq(y,x)) λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

36/37 For the negative copula (ain’t, isn’t, etc.) we have a slightly different formula: \ X y. X (\ x.-eq(y,x))

Computational Copulas Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] The copula (am, is, are, etc.) is a special kind of transitive verb, as it equates the subject and object. We introduce a Semantic Analysis Problems special binary predicate eq for the semantics of the copula: One Solution: \ X y. X(\ x. eq(y,x)) λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of The semantics of the copula looks just like the sematnics of words based on any transitive verb (see previous). syntactic category

36/37 Computational Copulas Semantics: Lambda Calculus

Scott Farrar CLMA, University of Washington far- [email protected] The copula (am, is, are, etc.) is a special kind of transitive verb, as it equates the subject and object. We introduce a Semantic Analysis Problems special binary predicate eq for the semantics of the copula: One Solution: \ X y. X(\ x. eq(y,x)) λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of The semantics of the copula looks just like the sematnics of words based on any transitive verb (see previous). syntactic category

For the negative copula (ain’t, isn’t, etc.) we have a slightly different formula: \ X y. X (\ x.-eq(y,x))

36/37 If we want to specify a semantics for does that will turn out to contribute nothing to higher constituents, this will suffice: The lambda expression for the semantics of an auxiliary contributing nothing would be: \ P x. P(x) (\ z. go(z))

does go \ P x. P(x) (\ z. go(z)) \ x . (\ z. go(z)) (x) \ z. go(z) (same as we started with; does is transparent)

Computational Auxiliaries Semantics: Lambda Calculus An auxiliary verb such as does is transparent at the level of Scott Farrar CLMA, University semantic representation, at least concerning propositional of Washington far- [email protected] content. Thus, does go would simply be: \ z. go(z). Semantic Analysis Problems One Solution: λ-Calculus λ-calculus and FOL λ-calculus and compositionality The semantics of words based on syntactic category

37/37 does go \ P x. P(x) (\ z. go(z)) \ x . (\ z. go(z)) (x) \ z. go(z) (same as we started with; does is transparent)

Computational Auxiliaries Semantics: Lambda Calculus An auxiliary verb such as does is transparent at the level of Scott Farrar CLMA, University semantic representation, at least concerning propositional of Washington far- [email protected] content. Thus, does go would simply be: \ z. go(z). Semantic Analysis Problems One Solution: λ-Calculus If we want to specify a semantics for does that will turn out λ-calculus and FOL λ-calculus and to contribute nothing to higher constituents, this will suffice: compositionality The semantics of The lambda expression for the semantics of an auxiliary words based on contributing nothing would be: syntactic category \ P x. P(x) (\ z. go(z))

37/37 \ P x. P(x) (\ z. go(z)) \ x . (\ z. go(z)) (x) \ z. go(z) (same as we started with; does is transparent)

Computational Auxiliaries Semantics: Lambda Calculus An auxiliary verb such as does is transparent at the level of Scott Farrar CLMA, University semantic representation, at least concerning propositional of Washington far- [email protected] content. Thus, does go would simply be: \ z. go(z). Semantic Analysis Problems One Solution: λ-Calculus If we want to specify a semantics for does that will turn out λ-calculus and FOL λ-calculus and to contribute nothing to higher constituents, this will suffice: compositionality The semantics of The lambda expression for the semantics of an auxiliary words based on contributing nothing would be: syntactic category \ P x. P(x) (\ z. go(z))

does go

37/37 \ x . (\ z. go(z)) (x) \ z. go(z) (same as we started with; does is transparent)

Computational Auxiliaries Semantics: Lambda Calculus An auxiliary verb such as does is transparent at the level of Scott Farrar CLMA, University semantic representation, at least concerning propositional of Washington far- [email protected] content. Thus, does go would simply be: \ z. go(z). Semantic Analysis Problems One Solution: λ-Calculus If we want to specify a semantics for does that will turn out λ-calculus and FOL λ-calculus and to contribute nothing to higher constituents, this will suffice: compositionality The semantics of The lambda expression for the semantics of an auxiliary words based on contributing nothing would be: syntactic category \ P x. P(x) (\ z. go(z))

does go \ P x. P(x) (\ z. go(z))

37/37 \ z. go(z) (same as we started with; does is transparent)

Computational Auxiliaries Semantics: Lambda Calculus An auxiliary verb such as does is transparent at the level of Scott Farrar CLMA, University semantic representation, at least concerning propositional of Washington far- [email protected] content. Thus, does go would simply be: \ z. go(z). Semantic Analysis Problems One Solution: λ-Calculus If we want to specify a semantics for does that will turn out λ-calculus and FOL λ-calculus and to contribute nothing to higher constituents, this will suffice: compositionality The semantics of The lambda expression for the semantics of an auxiliary words based on contributing nothing would be: syntactic category \ P x. P(x) (\ z. go(z))

does go \ P x. P(x) (\ z. go(z)) \ x . (\ z. go(z)) (x)

37/37 Computational Auxiliaries Semantics: Lambda Calculus An auxiliary verb such as does is transparent at the level of Scott Farrar CLMA, University semantic representation, at least concerning propositional of Washington far- [email protected] content. Thus, does go would simply be: \ z. go(z). Semantic Analysis Problems One Solution: λ-Calculus If we want to specify a semantics for does that will turn out λ-calculus and FOL λ-calculus and to contribute nothing to higher constituents, this will suffice: compositionality The semantics of The lambda expression for the semantics of an auxiliary words based on contributing nothing would be: syntactic category \ P x. P(x) (\ z. go(z))

does go \ P x. P(x) (\ z. go(z)) \ x . (\ z. go(z)) (x) \ z. go(z) (same as we started with; does is transparent)

37/37