# Philosophy, Computing, and Artificial Intelligence

PHI 319. Semantics and Donkey Sentences.

## Building Meaning With The Lambda Calculus

One way to generate the logical form of a sentence, and hence to associate truth-conditions with a sentence, is to use the lambda calculus to represent the semantics of the lexical items in the lexicon and to understand grammatical structure in terms of substitutions in the lambda calculus. λ is the eleventh letter of the Greek alphabet.

### The Lambda Calculus

Here is a formula in the lambda
calculus **λx.MAN(x)**.
In this formula, the prefix
**λx**
binds the occurrence of the variable
**x**
in the one-place predicate
**MAN(x)**.

The formula **λx.MAN(x)** may be understood as a one-place function.
The lambda binds a variable that holds a place
for a substitution of the argument in the one-place predicate.
The symbol @ separates the functor from the argument. In the expression

**λx.MAN(x)@vincent**

The left hand expression

**λx.MAN(x)**

is the *functor*. The right hand expression

**vincent**

is the *argument*. The substitution process is called
*β-reduction*. In the
example, the result of the conversion is the sentence

**MAN(vincent)**

### Grammatical Categories

We can think of the semantics of grammatical categories in terms of the lambda calculus:

**
'every' : λP.λQ.∀x(P@x
→ Q@x)
'some' or 'a' : λP.λQ.∃x(P@x ∧ Q@x)
'no' : λP.λQ.∀x(P@x → ¬Q@x)
'boxer' : λy.BOXER(y)
'walks' : λx.WALKS(x)**

Here is the representation tree for the noun phrase 'every boxer'

every boxer (NP) λP.λQ.∀x(P@x → Q@x)@λy.BOXER(y) / \ / \ / \ every (DET) boxer (NOUN) λP.λQ.∀x(P@x → Q@x) λy.BOXER(y)

The expression at the root of the tree is

**
'every boxer'
λP.λQ.∀x(P@x → Q@x)@λy.BOXER(y)
**

By substitution, this reduces to

**
'every boxer' (NP)
λQ.∀x(λy.BOXER(y)@x → Q@x)
**

This reduces to

**
'every boxer' (NP)
λQ.∀x(BOXER(x) → Q@x)
**

If this noun phrase is given a verb phrase, the result is a sentence. Here is the representation tree (with substitutions completed) for the sentence 'every boxer walks'

every boxer walks (S) ∀x(BOXER(x) → WALKS(x)) / \ / \ / \ every boxer (NP) walks(VP) λQ.∀x(BOXER(x) → Q@x) λx.WALKS(x) / \ / \ / \ every (DET) boxer (NOUN) λP.λQ.∀x(P@x → Q@x) λy.BOXER(y)

Here is the representation tree for the sentence 'vincent loves mia'

vincent loves mia (S) LOVE(vincent, mia) / \ / \ / \ vincent (NP) loves mia (VP) λP.P@vincent λz(LOVE(z,mia)) / \ / \ / \ loves (TV) mia (NP) λX.λz.(X@λx.LOVE)(z,x)) λP.P@mia

It is sometimes useful to think of lambda substitution
in terms of types. There are two basic types, **e** and
**t**. The first is the type of *entities* in the domain
of the model. The second is the type for truth-values (*true*
and *false*). Compound types are built from these two basic
types.

One place predicates, for example, have the type
**<e, t>**. When a one-place predicate
is given an expression of type **e**, it returns an
expression with type **t**.

To understand more clearly how this works, think again about the lambda expression

**λx.MAN(x)@vincent**

By β-conversion, this expression reduces to

**MAN(vincent)**

In terms of types, the lambda expression

λx.MAN(x)@vincent <e,t>e

reduces to

MAN(vincent)t

Here is a simple grammar whose lexical entries are associated with formulas in the lambda calculus

**
S → VP NP
NP → NAME
NP → DET N
VP → IV
VP → TV NP
NAME → mia: λP.P@mia
NAME → vincent: λP.P@vincent
DET → every: λP.λQ.∀x(P@x →
Q@x)
DET → some: λP.λQ.∃x(P@x ∧ Q@x)
N → man: λx.MAN(x)
N → woman: λx.WOMAN(x)
IV → laughs: λx.LAUGHS(x)
TV → loves: λX.λz.(X@λx.LOVE)(z,x))**

Here are the abstract representation trees showing the type conversions

S : t / \ / \ NP : (e → t) → t VP : e → t NP : (e → t) → t | | NAME : (e → t) → t NP : (e → t) → t / \ / \ DET : (e → t) → (e → t) → t N : e → t VP : e → t | | IV : e → t VP : e → t / \ / \ TV : e → (e → t) NP : (e → t) → t

Here is the representation tree for a sentence of the grammar ('every man laughs'):

every man laughs (S) ∀x(MAN(x) → LAUGHS(x)) t / \ / \ every man (NP) laughs (VP) λQ.∀x(BOXER(x) → Q@x) λx.LAUGHS(x) (e→t)→t e→t / \ / \ every (DET) man (NOUN) λP.λQ.∀x(P@x → Q@x) λy.MAN(y) (e →t)→(e→t)→t e→t

## Problems with the Semantics

Discourse Representation Theory (DRT) is a possible solution to these problems. This theory, however, is beyond the scope of the course. This semantics is not without its problems. Here are two of the more famous problems.

### Indefinite NPs in Donkey sentences

When Peter Geach called attention to the phenomenon (now known as
"donkey anaphora"), he used sentences about farmers and
donkeys to construct his counterexample.
The word *anaphora* is from
ἀναφορά, meaning "carrying back."
One problem concerns the truth conditions for donkey sentences.

The truth-conditions for the following two sentences

**If John owns a donkey, he feeds
it.**

**Every farmer who owns a donkey feeds it.**

are

**
∀x((donkey(x) ∧ own(john, x))
→ feeds(john,x))
∀x∀y((farmer(x) ∧ donkey(y) ∧ own(x, y))
→ feeds(x, y))
**

In neither is the indefinite NP an existentially
quantified expression. In the first, **a donkey** (located in the
antecedent of a conditional) is a universally
quantified expression with wide scope over the material
conditional. In the second, **a donkey**
(located in relative clause that modifies a universally
quantified NP) is also a universally quantified
expression taking wide scope.

### Indefinite NPs in Discourse

Another problem
concerns the way indefinite NPs function in
discourse. The sentence **A dog came in**
can be part of a discourse

**A dog came in. It sat down.**

but the translation does

**∃x(dog(x) ∧ came_in(x)). sat_down(x).**

not make sense. The existential quantifier does not bind the variable
in the predicate **sat_down(x)**.

Here is another argument in terms of discourse.
In classical logic, **∃xφ** and **¬∀¬xφ** are logically equivalent. **¬(φ ∧ ψ)**
and **φ → ¬ψ** are also logically equivalent.
So

**∃x(dog(x) ∧ came_in(x))**

**¬∀x(dog(x) → ¬came_in(x))**

are logically equivalent, but the sentences

**A dog came in.**

**Not every dog failed to come in.**

are not interchangeable. Only the first can be extended in conversation

**A dog came in. It sat down.**

**Not every dog failed to come
in. It sat down.**

The second discourse does not make sense.

## What we Accomplished in this Lecture

We looked at how to use the lambda calculus to generate the logical form of a sentence.