Title: Formal Semantics
1Formal Semantics
- Slides by Lucas Champollion
- Based on Heim Kratzer (1998)
2The MURI pipeline
3The big picture, more generally
Somebody sleeps
Tokenization
POS Tagging
Syntax
Semantics
(Pragmatics)
?x sleeps(x)
4From trees to logic
compositional semantics
?xthink(bill,likes(harry,x))
or some other suitable representation
5Examples of representation languages
Other candidates Modal logics, higher-order
predicate logics, description logics etc.
6First-order predicate logic
- ?x (man(x))
- Everybody is a man
- ?x (man(x))
- Somebody is a man
7First-order predicate logic
- ?x (man(x))
- Everybody is a man
- ?x (man(x))
- Somebody is a man
- ?x (rich(x) ? popular(x))
- Everybody is rich or popular
- ?x (rich(x) ? popular(x))
- Everybody is rich and popular
- ?x (rich(x) ? popular(x))
- Everybody who is rich is popular
8First-order predicate logic
- ?x (man(x))
- Everybody is a man
- ?x (man(x))
- Somebody is a man
- ?x (rich(x) ? popular(x))
-
- ?x (rich(x) ? popular(x))
-
- ?x (rich(x) ? popular(x))
-
9First-order predicate logic
- ?x (man(x) ? mortal(x))
- man(socrates)
- ____________________
- mortal(socrates)
?x ?y loves(x,y) ________________ ??y ?x
loves(x,y)
10First-order predicate logic with lambdas
- ?x (man(x))
- Everybody is a man
- ?x (man(x))
- Somebody is a man
- ?x (man(x))
- The function that maps men to true and non-men
to false
11First-order predicate logic with lambdas
- ?x (man(x))
- Everybody is a man
- ?x (man(x))
- Somebody is a man
- ?x (man(x))
- The function that maps men to true and non-men
to false - ?x (man(x)) (john)
- The function that maps men to true and non-men
to false applied to john - Reduces to man(john) in one step
- This step is called function application or beta
reduction or lambda conversion
12The Algorithm (simplest case)
- Assume all nodes are at most binary branching
- Every word is mapped to a formula/fragment
- This information is looked up in the lexicon
- Ambiguous words have multiple entries -- use WSD
- Non-branching nodes inherit meaning from their
daughter nodes - Branching nodes Functional Application
- If one child denotes a function and the other
child denotes an argument, apply function to
argument - Apply recursively until root is reached
13Simple Lexical Semantics
- Each proper noun is mapped to a constant
- John john
- America america
14Simple Lexical Semantics
- Each proper noun is mapped to a constant
- John john
- America america
- Adjectives, nouns, and intransitive verbs are
mapped to one-place predicates - A predicate is a function that returns a boolean
value (true, false) - sleeps ?x if x sleeps then return true
else return false - man ?x if x is a man then return true
else return false - red ?x if x is red then return true else
return false
15Simple Lexical Semantics
- Each proper noun is mapped to a constant
- John john
- America america
- Adjectives, nouns, and intransitive verbs are
mapped to one-place predicates - A predicate is a function that returns a boolean
value (true, false) - sleeps ?x if x sleeps then return true
else return false - man ?x if x is a man then return true
else return false - red ?x if x is red then return true else
return false
Can be simplified
16Simple Lexical Semantics
- Each proper noun is mapped to a constant
- John john
- America america
- Adjectives, nouns, and intransitive verbs are
mapped to one-place predicates - A predicate is a function that returns a boolean
value (true, false) - sleeps ?x sleeps(x)
- man ?x man(x)
- red ?x red(x)
17Simple Lexical Semantics
- Each proper noun is mapped to a constant
- John john
- America america
- Adjectives, nouns, and intransitive verbs are
mapped to one-place predicates - A predicate is a function that returns a boolean
value (true, false) - sleeps ?x sleeps(x)
- man ?x man(x)
- red ?x red(x)
- Transitive verbs are mapped to two-place
predicates - loves ?y ?x loves(x,y)
18Simple Lexical Semantics
- Each proper noun is mapped to a constant
- John john
- America america
- Adjectives, nouns, and intransitive verbs are
mapped to one-place predicates - A predicate is a function that returns a boolean
value (true, false) - sleeps ?x sleeps(x)
- man ?x man(x)
- red ?x red(x)
- Transitive verbs are mapped to two-place
predicates - loves ?y ?x loves(x,y)
- Auxiliaries are mapped to the identity function
- is does ?x x
19Example
S
NP
VP
NP
N
V
N
John
loves
Mary
John loves Mary
20Example
S
NP
VP
NP
N
V
N
john
?y ?x loves(x,y)
mary
John loves Mary
21Example
S
NP
VP
NP
john
V
N
?y ?x loves(x,y)
mary
John loves Mary
22Example
S
john
VP
NP
V
N
?y ?x loves(x,y)
mary
John loves Mary
23Example
S
john
VP
NP
?y ?x loves(x,y)
N
mary
John loves Mary
24Example
S
john
VP
NP
?y ?x loves(x,y)
mary
John loves Mary
25Example
S
john
VP
mary
?y ?x loves(x,y)
John loves Mary
26Example
S
john
?y ?x loves(x,y) (mary)
John loves Mary
27Example
S
john
?x loves(x,mary)
John loves Mary
28Example
?x loves(x,mary) (john)
John loves Mary
29Example
loves(john,mary)
John loves Mary
30A more involved example
S
NP
VP
NP
N
V
N
Somebody
loves
Mary
Somebody loves Mary
31The meaning of quantifier NPs
- A first try
- somebody somebody
- everybody everybody
- Somebody loves Mary. loves(somebody, mary)
- ???
32Quantifier noun phrases have a special status
- They are functions from VP meanings to booleans
- So, they are functions from one-place predicates
to booleans - Higher-order function a function that takes
another function as an argument - Examples
- everybody ?P ?z P(z)
- nobody ?P ??z P(z)
- Building quantifier NPs from quantifiers
- every ?P ?Q ?z P(z) ? Q(z)
- Question words as quantifiers
- who ?P ?z P(z)
- where ? is a query operator
33A more involved example
S
NP
VP
NP
N
V
N
?P ?z P(z)
?y ?x loves(x,y)
mary
Somebody loves Mary
34A more involved example
S
?P ?z P(z)
VP
NP
V
N
?y ?x loves(x,y)
mary
Somebody loves Mary
35A more involved example
S
?P ?z P(z)
VP
NP
?y ?x loves(x,y)
N
mary
Somebody loves Mary
36A more involved example
S
?P ?z P(z)
VP
NP
?y ?x loves(x,y)
mary
Somebody loves Mary
37A more involved example
S
?P ?z P(z)
VP
mary
?y ?x loves(x,y)
Somebody loves Mary
38A more involved example
S
?P ?z P(z)
?y ?x loves(x,y) (mary)
Somebody loves Mary
39A more involved example
S
?P ?z P(z)
?x loves(x,mary)
Somebody loves Mary
40A more involved example
?P ?z P(z) ?x loves(x,mary)
Somebody loves Mary
41A more involved example
?P ?z P(z) ?x loves(x,mary)
?P ?z P (z)
?x loves(x,mary)
Somebody loves Mary
42A more involved example
?P ?z P(z) ?x loves(x,mary)
?P ?z P (z)
?x loves(x,mary)
?z ?x loves(x,mary)(z)
Somebody loves Mary
43A more involved example
?P ?z P(z) ?x loves(x,mary)
?P ?z P (z)
?x loves(x,mary)
?z ?x loves(x,mary)(z)
?z loves(z,mary)
Somebody loves Mary
44Pronouns are mapped to variables
- Can be bound by any noun phrase (both proper
nouns and quantifier NPs) - Are sometimes pronounced as reflexives (himself)
- Binder-bindee relation indicated by an integer
index - John1 likes himself1.
- Every man1 likes a woman who hates him1.
- John1 thinks that he1 likes Mary and that Mary
likes him1. - Often, several ways of binding them are possible
(anaphora resolution) - John1 likes Bill2 because he2 pays him1.
- John1 likes Bill2 because he1 pays him2.
- John1 likes Bill2 because he1 pays himself1.
- John1 likes Bill2 because he2 pays himself2.
- Can be bound across sentences
- John1 sleeps. He1 is tired.
- though some quantifiers cause problems there
- Every man1 sleeps. He1 is tired.
45The pronoun mechanism
- Pronoun interpretation is delegated to a special
function g - Any noun phrase that carries a binder index
extends g (writes information into g) - A pronouns meaning is given by g, applied to the
pronouns index. (The pronoun reads information
from g) - he1 g(1)
- he2 g(2)
- him2 g(2) etc.
- The following is a simplified illustration
46Example Proper noun binds pronoun
S
NP
VP
NP
N
V
N
John1
loves
himself1
John loves himself
47Example Proper noun binds pronoun
S
NP
VP
NP
N
V
N
john1
?y ?x loves(x,y)
g(1)
John loves himself
48Example Proper noun binds pronoun
S
john1
VP
NP
V
N
?y ?x loves(x,y)
g(1)
John loves himself
49Example Proper noun binds pronoun
S
john1
VP
NP
?y ?x loves(x,y)
N
g(1)
John loves himself
50Example Proper noun binds pronoun
S
john1
VP
g(1)
?y ?x loves(x,y)
John loves himself
51Example Proper noun binds pronoun
S
john1
?y ?x loves(x,y) g(1)
John loves himself
52Example Proper noun binds pronoun
S
john1
?x loves(x,g(1))
John loves himself
53Example Proper noun binds pronoun
S
john1
?x loves(x,g(1))
g(1) picks up its meaning as the coindexed NP
(john) at the moment of combining
John loves himself
54Example Proper noun binds pronoun
S
john1
?x loves(x, g(1))
g(1) picks up its meaning as the coindexed NP
(john) at the moment of combining
John loves himself
55Example Proper noun binds pronoun
?x loves(x, g(1)) john
John loves himself
56Example Proper noun binds pronoun
loves(g(1), john)
John loves himself
57Example Proper noun binds pronoun
loves(g(1), john)
We now resolve g(1), which yields john
John loves himself
58Example Proper noun binds pronoun
loves(john, john)
We now resolve g(1), which yields john
John loves himself
59Example Quantifier NP binds pronoun
S
NP
VP
NP
N
V
N
Everybody1
loves
himself1
Everybody loves himself
60Example Quantifier NP binds pronoun
S
NP
VP
NP
N
V
N
?P ?z P(z)1
?y ?x loves(x,y)
g(1)
Everybody loves himself
61Example Quantifier NP binds pronoun
S
?P ?z P(z)1
VP
NP
V
N
?y ?x loves(x,y)
g(1)
Everybody loves himself
62Example Quantifier NP binds pronoun
S
?P ?z P(z)1
VP
NP
?y ?x loves(x,y)
N
g(1)
Everybody loves himself
63Example Quantifier NP binds pronoun
S
?P ?z P(z)1
VP
g(1)
?y ?x loves(x,y)
Everybody loves himself
64Example Quantifier NP binds pronoun
S
?P ?z P(z)1
?y ?x loves(x,y) g(1)
Everybody loves himself
65Example Quantifier NP binds pronoun
S
?P ?z P(z)1
?x loves(x,g(1))
Everybody loves himself
66Example Quantifier NP binds pronoun
S
?P ?z P(z)1
?x loves(x,g(1))
Replace pronoun by QNP variable at the moment of
combining
Everybody loves himself
67Example Quantifier NP binds pronoun
S
?P ?z P(z)1
?x loves(x,g(1))
g(1) picks up its meaning as the QNP variable
(z) at the moment of combining
Everybody loves himself
68Example Quantifier NP binds pronoun
?z P(z) ?x loves(x,g(1))
Everybody loves himself
69Example Quantifier NP binds pronoun
?z ?x loves(x,g(1)) (z)
Everybody loves himself
70Example Quantifier NP binds pronoun
?z loves(z,g(1))
Everybody loves himself
71Example Quantifier NP binds pronoun
?z loves(z,g(1))
We now resolve g(1), which yields z
Everybody loves himself
72Example Quantifier NP binds pronoun
?z loves(z,z)
We now resolve g(1), which yields z
Everybody loves himself
73Traces
- Can be bound by any noun phrase (both proper
nouns and quantifier NPs) - Are almost never pronounced (by definition, in
some sense) - Sometimes pronounced anyway (resumptive
pronouns) - This is the man1 that Mary doesnt know what he1
is eating. - Binder-bindee relation indicated by an integer
index - Who1 does John like t1?
- Who1 does Bill think Harry likes t1?
- Beans1, John likes t1.
- John knows the man1 that Mary likes t1.
- Can only be bound by a noun phrase that has moved
- Who1 does John2 like t2?
74The trace mechanism
- Trace interpretation is delegated to the special
function g - Any noun phrase that carries a binder index
extends g (writes information into g) - A traces meaning is given by g, applied to the
traces index. (The trace reads information from
g) - t1 g(1)
- t2 g(2) etc.
- Exactly the same as pronouns
75Example Question word binds trace
S
S
NP
S
Aux
N
NP
VP
does
Who1
N
V
NP
Who does Harry like?
like
t1
Harry
76Example Question word binds trace
S
S
NP
S
Aux
N
NP
VP
?x x
?P ?x P(x)1
N
V
NP
Who does Harry like?
?y?xlike(x,y)
g(1)
harry
77Example Question word binds trace
S
S
NP
S
Aux
N
NP
VP
?x x
?P ?x P(x)1
N
?y?xlike(x,y)
g(1)
Who does Harry like?
harry
78Example Question word binds trace
S
S
NP
S
Aux
N
NP
?xlike(x,g(1))
?x x
?P ?x P(x)1
N
Who does Harry like?
harry
79Example Question word binds trace
S
S
NP
S
Aux
N
NP
?xlike(x,g(1))
?x x
?P ?x P(x)1
harry
Who does Harry like?
80Example Question word binds trace
S
S
NP
S
Aux
N
harry
?xlike(x,g(1))
?x x
?P ?x P(x)1
Who does Harry like?
81Example Question word binds trace
S
S
NP
like(harry,g(1))
Aux
N
?x x
?P ?x P(x)1
Who does Harry like?
82Example Question word binds trace
S
S
NP
like(harry,g(1))
?x x
N
?P ?x P(x)1
Who does Harry like?
83Example Question word binds trace
S
?x x like(harry,g(1))
NP
N
?P ?x P(x)1
Who does Harry like?
84Example Question word binds trace
S
like(harry,g(1))
NP
N
?P ?x P(x)1
Who does Harry like?
85Example Question word binds trace
S
like(harry,g(1))
NP
?P ?x P(x)1
Who does Harry like?
86Example Question word binds trace
S
like(harry,g(1))
?P ?x P(x)1
Who does Harry like?
87Example Question word binds trace
?P ?x P(x) like(harry,g(1))
Who does Harry like?
88Example Question word binds trace
?x like(harry,x)
Who does Harry like?
89Problem Quantifiers in object position
S
NP
VP
NP
N
V
N
Mary
loves
somebody
Mary loves somebody.
90Problem Quantifiers in object position
S
NP
VP
NP
N
V
N
mary
?y ?x loves(x,y)
?P ?z P(z)
Mary loves somebody.
91Problem Quantifiers in object position
S
NP
VP
?P ?z P(z)
N
?y ?x loves(x,y)
mary
Mary loves somebody.
92Problem Quantifiers in object position
S
NP
?P ?z P(z) ?y ?x loves(x,y)
N
mary
Mary loves somebody.
93Problem Quantifiers in object position
S
NP
?z ?y ?x loves(x,y) (z)
N
mary
Mary loves somebody.
94Problem Quantifiers in object position
S
NP
?z ?y ?x loves(x,y) (z)
A two-place function is fed only one argument
N
mary
Mary loves somebody.
95Problem Quantifiers in object position
S
NP
?z ?x loves(x,z)
A two-place function is fed only one argument
N
mary
Mary loves somebody.
96Problem Quantifiers in object position
S
NP
?z ?x loves(x,z)
A two-place function is fed only one argument
N
Whatever this is, its not a function, so we
cant apply it to mary
mary
Mary loves somebody.
97Proposed Solutions
- Quantifier NPs are ambiguous
- somebody1 ?P ?z P(z)
- subject position only
- somebody2 ?P ?x ?z P(x,z)
- object position only
- Quantifier NPs can act on their context
- Intuition somebody ?Context ?z
Context(z) - What does context mean?
- The continuation of the current computation
(Barker, Shan) - The surrounding tree, accessible after movement
(May, much of GB) - Quantifier scope is resolved in a separate step
- Use a representation language that leaves
quantifier scope underspecified (most of
computational semantics)
98Example Quantifier Raising
- Quantifier NPs move out of object position
- They move above the clause so they have access to
the whole context - Similar mechanism to wh-movement, topicalization
etc. -- except that we dont hear it - A separate step before interpretation starts
99Example Quantifier Raising
S
S
NP
N
NP
VP
N
V
NP
Somebody1
loves
t1
Mary
Mary loves somebody.
100Example Quantifier Raising
S
S
NP
N
NP
VP
N
V
NP
?P ?z P(z)1
?y?xloves(x,y)
g(1)
mary
Mary loves somebody.
101Example Quantifier Raising
S
S
NP
N
NP
VP
?y?xloves(x,y)
g(1)
N
?P ?z P(z)1
mary
Mary loves somebody.
102Example Quantifier Raising
S
S
NP
N
NP
?xloves(x,g(1))
N
?P ?z P(z)1
mary
Mary loves somebody.
103Example Quantifier Raising
S
S
NP
N
mary
?xloves(x,g(1))
?P ?z P(z)1
Mary loves somebody.
104Example Quantifier Raising
S
?xloves(x,g(1)) mary
NP
N
?P ?z P(z)1
Mary loves somebody.
105Example Quantifier Raising
S
loves(mary,g(1))
NP
N
?P ?z P(z)1
Mary loves somebody.
106Example Quantifier Raising
S
loves(mary,g(1))
?P ?z P(z)1
Mary loves somebody.
107Example Quantifier Raising
?z loves(mary,g(1))
Mary loves somebody.
108Example Quantifier Raising
?z loves(mary,z)
Mary loves somebody.
109Quantifier scope ambiguities
- Somebody loves everybody.
- In this country a woman gives birth every 15
min. Our job is to find that woman and stop her.
(Groucho Marx) - In Quantifier Raising approach
- Which quantifier raises highest?
- see blackboard
- In continuations approach
- In which order are the quantifiers evaluated?
- In underspecification approach
- Collect quantifiers, delay decision to a later
stage
110Scopal ambiguity is pervasive
- Most politicians can fool most voters most of the
time, but no politician can fool all voters all
of the time. - A participant of every course gave two
presentations.
111Constraints on quantifier scope
- Similar to islands
- Some man loves every woman
- (?? and ?? are both OK)
- Some man thinks that he loves every woman
- (?? is OK, ?? is not possible)
- Polarity items are sensitive to negation
- We did not see any man
- (?? is OK, ?? is not possible)
- We did not see some man
- (?? is OK, ?? is not possible)
- We did not see a man
- (?? and ?? are both OK)
112Appendix Type theory in a nutshell
- Types help us determine which way function
application applies - In more refined versions of the theory, when we
have more operations than just function
application, types tell us which operations to
apply - We start with just two basic types
- t - a truth value (boolean type)
- e - an entity (individual type)
- The set of types is the smallest set such that
- All basic types are types
- If ?and ? are types then lt?,?gt is a type
(complex type) - Complex types are used to specify the types of
input and output values to functions - A function from entities (e) to booleans (t) will
have the type lte,tgt (one-place predicate type) - A function from one-place predicates (lte,tgt) to
booleans (t) will have the type