First-Order Logic (and beyond)

First-Order Logic
(and beyond)
Johan Bos
University of Groningen
Overview of this lecture
• Introduction to first-order logic
• Discourse Representation Theory
• Using the Lambda-Calculus
Logical languages
expressive power
• propositional logic
• modal logic
• description logic
• first-order logic (predicate logic)
• second-order logic
• higher-order logic
This lecture
• In this lecture we will try to map
English to First-Order Logic
• First-order logic extends propositional
logic with variables and quantifiers
• As we will see it is capable for
modelling sub-sentential semantics
First-order logic
• First-order logic is a (artificial) language
• So we will look at its ingredients
• We will define the syntax, or in other
words, the “grammar”
• We will look at the semantics only from
an informal point of view
Ingredients of first-order logic
• Terms (variables or contants)
– Variables: x, y, z, …
– Constants: m’, j’, …
• Predicate Symbols
– One-place predicate symbols: walk, smoke, …
– Two-place predicate symbols: see, love, …
• Connectives: ¬, ∧,∨, →, ↔
• Punctuation: brackets ( ) and the comma ,
• The quantifiers
– Universal quantifier: ∀
– Existential quantifier: ∃
Syntax of first-order logic
• If P is a one-place relation symbol, and
t a term, then P(t) is a first-order formula
• If R is a two-place relation symbol, t1 and t2 are
terms, then R(t1,t2) is a first-order formula
• If ϕ is a first-order formula, then so is ¬ϕ
• If ϕ and φ are first-order formulas, then so are
(ϕ∧φ), (ϕ∨φ), (ϕ→φ) and (ϕ↔φ)
• If ϕ is a first-order formula, and x a variable,
then ∀xϕ and ∃xϕ are first-order formulas
• Nothing else is a first-order formula
Syntax of first-order logic
• If P is a one-place relation symbol, and
t a term, then P(t) is a first-order formula
• If R is a two-place relation symbol, t1 and t2 are
terms, then R(t1,t2) is a first-order formula
• If ϕ is a first-order formula, then so is ¬ϕ
• If ϕ and φ are first-order formulas, then so are
(ϕ∧φ), (ϕ∨φ), (ϕ→φ) and (ϕ↔φ)
• If ϕ is a first-order formula, and x a variable,
then ∀xϕ and ∃xϕ are first-order formulas
• Nothing else is a first-order formula
Examples of first-order formulas
• Mia walks.
walk(mia’)
• A dog barks.
∃x(dog(x) ∧ bark(x))
• Vincent likes every dog.
∀x(dog(x) → like(vincent’,x))
Semantics of the quantifiers
• ∃x ϕ
true if and only if there is an x such that
ϕ is true
• ∀x ϕ
true if and only if for all x it is the case
that ϕ is true
Truth and Models
• Truth in first-order logic is often defined with
the help of models
• A model M is usually taken to consist of two
parts (M = <D,F>):
(1) a domain of entities (D)
(2) an interpretation function (F)
for all non-logical symbols
• The truth-definition with models
was introduced by the famous
logician Alfred Tarski
Example model
• M = <D,F>
• D = {d1,d2,d3}
• F(mia’) = d1
F(vincent’) = d2
F(person) = {d1,d2}
F(dog) = {d3}
F(love) = {(d1,d2),(d2,d2),(d2,d1),(d2,d3)}
F(hate) = {(d1,d3)}
Semantics of the quantifiers
• ∃x ϕ
true in M if and only if we can map x to
at least one member of D such that ϕ is
true in M
• ∀x ϕ
true if and only if for all members of D,
if we map x it, it is the case that ϕ is
true in M
Free variables
• The quantifiers bind variables
• For instance, ∃x ϕ binds all occurrences
of x in the formula ϕ
• Variables that are not bound are
called free
• For instance, the following two formulas
contain free variables:
– walk(x)
– smoke(y) ∧ ∃y person(y)
Closed formulas
• Formulas that have no free variables
are called closed
• Usually we’re only interested in closed
formulas -- translating a natural
language sentence to first-order logic
should produce a closed formula
• Free variables can be thought of as
“pronouns”
What’s wrong with these translations?
• A dog barks.
(∃x dog(x) ∧ bark(x))
• A dog barks.
∃x(dog(x) → bark(x))
• Every dog barks.
∀x(dog(x) ∧ bark(x))
Lambdas and Higher-order Logic
• Fine, we have seen how we can
represent English (or Italian) sentences
into logic, but what about
– noun phrases,
– verb phrases,
– nouns,
– determiners,
– adjectives,
– prepositions, and so on?
Montague Grammar
• Richard Montague used
higher order logic to translate
sub-sentence fragments into
logic
• Basically we add to two
new constructs to first-order logic:
– the lambda operator λ
– function application @
Examples with lambdas
• The lambda binds variables and can be seen
as a “place-holder” for missing information
• Examples:
Mia 
mia’
man 
λz.man(z)
love 
λx. λy. love(y,x)
every  λp. λq. ∀x(p@x → q@x)
Example derivation
loves Mia  λx. λy. love(y,x) @ mia’
= λy. love(y,mia’)
Every man 
λp. λq. ∀x(p@x → q@x)@λz.man(z)
= λq. ∀x(λz.man(z)@x → q@x)
= λq. ∀x(man(x) → q@x)
Every man loves Mia 
λq. ∀x(man(x) → q@x) @λy. love(y,mia’)
= ∀x(man(x) → λy. love(y,mia’)@x)
= ∀x(man(x) → love(x,mia’))
Discourse Representation Theory
• Nice so far, but what about translating
pronouns that have antecedents across
sentences?
– Mia dances. She is happy.
– A man smokes. He likes Mia.
Discourse Representation Theory
• Hans Kamp introduced DRT
(Discourse Representation Theory) to
deal with anaphoric phenomena.
Problematic cases for FOL
• A woman dances. She is happy.
∃x(woman(x) ∧ dance(x)) ∧ happy(x)
• Every farmer who owns a donkey beats it.
∀x((farmer(x) ∧ ∃y(donkey(y) ∧ own(x,y))) → beat(x,y))
Problematic cases for FOL
• A woman dances. She is happy.
∃x(woman(x) ∧ dance(x)) ∧ happy(x)
∃x(woman(x) ∧ dance(x) ∧ happy(x))
• Every farmer who owns a donkey beats it.
∀x((farmer(x) ∧ ∃y(donkey(y) ∧ own(x,y))) → beat(x,y))
∀x∀y((farmer(x) ∧ donkey(y) ∧ own(x,y)) → beat(x,y))
Discourse Representation Theory
• DRT is a theory of natural language
semantics using DRSs to represent
texts (discourse)
• A DRS encapsulates both
content and context
– Content: the meaning of the text so far
– Context: information to interpret anaphoric
expressions in subsequent
sentences
DRT examples
• Discourse Representation Structures (DRS)
– Discourse referents (first-order variables)
– Structure plays role in pronoun resolution
A dog barked.
Every dog barked.
x
dog(x)
bark(x)
x
dog(x)
⇒ bark(x)
Accessibility (1)
• Discourse referents are accessible if they
are in the same DRS
A dog barked. It was happy.
xy
dog(x)
bark(x)
happy(y)
y = ???
Accessibility (1)
• Discourse referents are accessible if they
are in the same DRS
A dog barked. It was happy.
xy
dog(x)
bark(x)
happy(y)
y=x
Discourse referent x
is accessible
Accessibility (2)
• Discourse referents are not accessible if
they are part of a nested DRS
Every dog barked. ?It was happy.
y
x
dog(x)
happy(y)
y = ??
⇒ bark(x)
Discourse referent x
is not accessible
Donkey Sentences
DRT solves the donkey sentence problem
Every farmer that owns a donkey beats it.
xy
farmer(x)
donkey(y)
own(x,y)
⇒
z
beat(x,z)
z=y
Further Reading
• Gamut, Volume 2
(Montague Grammar)
• Kamp & Reyle
(Discourse Representation Theory)