General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Constructing lambda terms

For this exercise, you should already know something about semantic construction. In particular, you should be familiar with lambda calculus. The second week course on computational semantics by Koller, Burchardt and Walter will start at this point: they will tell you about semantic construction using lambda calculus and how to do it in Prolog.

We can use the same mechanism that we used for constructing parse trees to build lambda terms representing the semantics of the parsed expression.

Here is a way of representing lambda terms as Prolog terms:

  • Let's use a two place complex term with the functor l for representing lambda abstraction. That is, we represent λx.Formula as l(X,Formula). For example, the semantics associated with the verb kills, i.e., the lambda term λx.λy.kill(y,x), would look like this in our Prolog representation: l(X,l(Y,kill(Y,X)))
  • Let's use a two place complex term with the functor '@' to represent functional application. That is, λx.λy.kill(y,x)(bill) is '@'(l(X,l(Y,kill(Y,X))), bill) in our representation.

First, use this simple grammar and add a semantic representation to all lexical entries.
Solution

Second, extend the rules so that the semantics representation is build while processing the input phrase. The mechanism is exactly the same as the one that we used for building the parse tree. Use the '@' symbol to express that one expression is applied to another. That means, the output will be a lambda term which is not beta-reduced. For example, the lambda representation for the sentence [the,nurse,whistles] is '@'('@'(l(R,l(S, exists(X,'@'(R,X),'@'(S,X)))),l(Y,nurse(Y))),l(Z,whistles(Z))).
Solution

Back to the practical session of day 5.