Semantics and Pragmatics of NLP Lascarides & Klein Lambda - - PowerPoint PPT Presentation

semantics and pragmatics of nlp
SMART_READER_LITE
LIVE PREVIEW

Semantics and Pragmatics of NLP Lascarides & Klein Lambda - - PowerPoint PPT Presentation

SPNLP: Lambda Terms, Quantifiers, Satisfaction Semantics and Pragmatics of NLP Lascarides & Klein Lambda Terms, Quantifiers, Satisfaction Outline Typed Lambda Calculus Alex Lascarides & Ewan Klein First Order Logic Truth and


slide-1
SLIDE 1

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Semantics and Pragmatics of NLP Lambda Terms, Quantifiers, Satisfaction

Alex Lascarides & Ewan Klein

School of Informatics University of Edinburgh

10 January 2008

slide-2
SLIDE 2

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

1

Typed Lambda Calculus

2

First Order Logic

3

Truth and Satisfaction

slide-3
SLIDE 3

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Transitive Verbs as Functions

We looked at replacing n-ary relations with functions. How does this work with transitive verbs? Version 1: chase of type <IND, IND >→ BOOL Version 2: chase of type IND → (IND → BOOL) Advantages of Version 2 (called a curryed function): Makes the syntax more uniform. Fits better with compositional semantics (discussed later)

slide-4
SLIDE 4

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Transitive Verbs as Functions

We looked at replacing n-ary relations with functions. How does this work with transitive verbs? Version 1: chase of type <IND, IND >→ BOOL Version 2: chase of type IND → (IND → BOOL) Advantages of Version 2 (called a curryed function): Makes the syntax more uniform. Fits better with compositional semantics (discussed later)

slide-5
SLIDE 5

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Transitive Verbs as Functions

We looked at replacing n-ary relations with functions. How does this work with transitive verbs? Version 1: chase of type <IND, IND >→ BOOL Version 2: chase of type IND → (IND → BOOL) Advantages of Version 2 (called a curryed function): Makes the syntax more uniform. Fits better with compositional semantics (discussed later)

slide-6
SLIDE 6

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Transitive Verbs as Functions

We looked at replacing n-ary relations with functions. How does this work with transitive verbs? Version 1: chase of type <IND, IND >→ BOOL Version 2: chase of type IND → (IND → BOOL) Advantages of Version 2 (called a curryed function): Makes the syntax more uniform. Fits better with compositional semantics (discussed later)

slide-7
SLIDE 7

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Transitive Verbs as Functions

We looked at replacing n-ary relations with functions. How does this work with transitive verbs? Version 1: chase of type <IND, IND >→ BOOL Version 2: chase of type IND → (IND → BOOL) Advantages of Version 2 (called a curryed function): Makes the syntax more uniform. Fits better with compositional semantics (discussed later)

slide-8
SLIDE 8

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Lambda

Lambdas talk about missing information, and where it is. The λ binds a variable. The positions of a λ-bound variable in the formula mark where information is ‘missing’. Replacing these variables with values fills in the missing information. Example: λx.(man x) λ-abstract (λx.(man x) john) application (man john) β-reduction/function application.

slide-9
SLIDE 9

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Types

IND and BOOL are basic types.

If σ, τ are types, then so is (σ → τ). Brackets are

  • mitted if no ambiguity.

For types τ, we have variables Var(τ), constants Con(τ). Since we are doing first order logic, we will later restrict variables to Var(IND), but allow constants of any type.

slide-10
SLIDE 10

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Types

IND and BOOL are basic types.

If σ, τ are types, then so is (σ → τ). Brackets are

  • mitted if no ambiguity.

For types τ, we have variables Var(τ), constants Con(τ). Since we are doing first order logic, we will later restrict variables to Var(IND), but allow constants of any type.

slide-11
SLIDE 11

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Types

IND and BOOL are basic types.

If σ, τ are types, then so is (σ → τ). Brackets are

  • mitted if no ambiguity.

For types τ, we have variables Var(τ), constants Con(τ). Since we are doing first order logic, we will later restrict variables to Var(IND), but allow constants of any type.

slide-12
SLIDE 12

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Types

IND and BOOL are basic types.

If σ, τ are types, then so is (σ → τ). Brackets are

  • mitted if no ambiguity.

For types τ, we have variables Var(τ), constants Con(τ). Since we are doing first order logic, we will later restrict variables to Var(IND), but allow constants of any type.

slide-13
SLIDE 13

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Terms in Typed Lambda Calculus

We define terms Term(τ) of type τ: Var(τ) ⊆ Term(τ). Con(τ) ⊆ Term(τ). If α ∈ Term(σ → τ) and β ∈ Term(σ) then (α β) ∈ Term(τ) (function application). If x ∈ Var(σ) and α ∈ Term(ρ), then λx.α ∈ Term(τ), where τ = (σ → ρ)

slide-14
SLIDE 14

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Terms in Typed Lambda Calculus

We define terms Term(τ) of type τ: Var(τ) ⊆ Term(τ). Con(τ) ⊆ Term(τ). If α ∈ Term(σ → τ) and β ∈ Term(σ) then (α β) ∈ Term(τ) (function application). If x ∈ Var(σ) and α ∈ Term(ρ), then λx.α ∈ Term(τ), where τ = (σ → ρ)

slide-15
SLIDE 15

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Terms in Typed Lambda Calculus

We define terms Term(τ) of type τ: Var(τ) ⊆ Term(τ). Con(τ) ⊆ Term(τ). If α ∈ Term(σ → τ) and β ∈ Term(σ) then (α β) ∈ Term(τ) (function application). If x ∈ Var(σ) and α ∈ Term(ρ), then λx.α ∈ Term(τ), where τ = (σ → ρ)

slide-16
SLIDE 16

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Terms in Typed Lambda Calculus

We define terms Term(τ) of type τ: Var(τ) ⊆ Term(τ). Con(τ) ⊆ Term(τ). If α ∈ Term(σ → τ) and β ∈ Term(σ) then (α β) ∈ Term(τ) (function application). If x ∈ Var(σ) and α ∈ Term(ρ), then λx.α ∈ Term(τ), where τ = (σ → ρ)

slide-17
SLIDE 17

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Extending to a First Order Language

1 Variables i.e., Var(IND): x, y, z, . . . , x0, x1, x2, . . . 2 Boolean connectives:

¬

BOOL → BOOL

(negation) ∧

BOOL → (BOOL → BOOL)

(and) ∨

BOOL → (BOOL → BOOL)

(or) →

BOOL → (BOOL → BOOL)

(if. . . then)

3 Quantifiers:

∀ (all) ∃ (some)

4 Equality:

= τ → (τ → BOOL)

5 Punctuation: brackets and period

slide-18
SLIDE 18

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Quantifier Syntax

If φ ∈ Term(BOOL), and x ∈ Var(IND), then ∀x.φ and ∃x.φ ∈ Term(BOOL). x ∈ Var(IND) is called an individual variable. Syntactic conventions: Instead of writing ((= α)β), ((∧φ)ψ), etc., we write (= α = β), (φ ∧ ψ), etc. Instead of writing e.g., ((chase fido) john), we sometimes write (chase fido john). NB this is equivalent to chase(john, fido) on a relational approach.

slide-19
SLIDE 19

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Quantifier Syntax

If φ ∈ Term(BOOL), and x ∈ Var(IND), then ∀x.φ and ∃x.φ ∈ Term(BOOL). x ∈ Var(IND) is called an individual variable. Syntactic conventions: Instead of writing ((= α)β), ((∧φ)ψ), etc., we write (= α = β), (φ ∧ ψ), etc. Instead of writing e.g., ((chase fido) john), we sometimes write (chase fido john). NB this is equivalent to chase(john, fido) on a relational approach.

slide-20
SLIDE 20

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Quantifier Syntax

If φ ∈ Term(BOOL), and x ∈ Var(IND), then ∀x.φ and ∃x.φ ∈ Term(BOOL). x ∈ Var(IND) is called an individual variable. Syntactic conventions: Instead of writing ((= α)β), ((∧φ)ψ), etc., we write (= α = β), (φ ∧ ψ), etc. Instead of writing e.g., ((chase fido) john), we sometimes write (chase fido john). NB this is equivalent to chase(john, fido) on a relational approach.

slide-21
SLIDE 21

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Quantifier Syntax

If φ ∈ Term(BOOL), and x ∈ Var(IND), then ∀x.φ and ∃x.φ ∈ Term(BOOL). x ∈ Var(IND) is called an individual variable. Syntactic conventions: Instead of writing ((= α)β), ((∧φ)ψ), etc., we write (= α = β), (φ ∧ ψ), etc. Instead of writing e.g., ((chase fido) john), we sometimes write (chase fido john). NB this is equivalent to chase(john, fido) on a relational approach.

slide-22
SLIDE 22

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Some Examples

1 ∃x.(love x kim)

Kim loves someone

2 (¬∃x.(love x kim))

Kim doesn’t love anyone

3 ∀x.((robber x) → ∃y.((customer y) ∧ (love y x)))

All robbers love a (perhaps different) customer

4 ∃y.((customer y) ∧ ∀x.((robber x) → (love y x)))

All robbers love the same customer

slide-23
SLIDE 23

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Some Examples

1 ∃x.(love x kim)

Kim loves someone

2 (¬∃x.(love x kim))

Kim doesn’t love anyone

3 ∀x.((robber x) → ∃y.((customer y) ∧ (love y x)))

All robbers love a (perhaps different) customer

4 ∃y.((customer y) ∧ ∀x.((robber x) → (love y x)))

All robbers love the same customer

slide-24
SLIDE 24

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Some Examples

1 ∃x.(love x kim)

Kim loves someone

2 (¬∃x.(love x kim))

Kim doesn’t love anyone

3 ∀x.((robber x) → ∃y.((customer y) ∧ (love y x)))

All robbers love a (perhaps different) customer

4 ∃y.((customer y) ∧ ∀x.((robber x) → (love y x)))

All robbers love the same customer

slide-25
SLIDE 25

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Some Examples

1 ∃x.(love x kim)

Kim loves someone

2 (¬∃x.(love x kim))

Kim doesn’t love anyone

3 ∀x.((robber x) → ∃y.((customer y) ∧ (love y x)))

All robbers love a (perhaps different) customer

4 ∃y.((customer y) ∧ ∀x.((robber x) → (love y x)))

All robbers love the same customer

slide-26
SLIDE 26

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Free and Bound Variables

((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) First occurrence of x is free; Second occurrence of x is bound; Occurrence of y is bound. Free variable ≈ pronouns.

She loves Fido

Context needed to interpret she; Something in addition to models so far needed to interpret free variables. A WFF (Term(BOOL)) with no free variables is a (closed)

  • sentence. FOL sentences ⊂ WFFs.
slide-27
SLIDE 27

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Free and Bound Variables

((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) First occurrence of x is free; Second occurrence of x is bound; Occurrence of y is bound. Free variable ≈ pronouns.

She loves Fido

Context needed to interpret she; Something in addition to models so far needed to interpret free variables. A WFF (Term(BOOL)) with no free variables is a (closed)

  • sentence. FOL sentences ⊂ WFFs.
slide-28
SLIDE 28

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Free and Bound Variables

((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) First occurrence of x is free; Second occurrence of x is bound; Occurrence of y is bound. Free variable ≈ pronouns.

She loves Fido

Context needed to interpret she; Something in addition to models so far needed to interpret free variables. A WFF (Term(BOOL)) with no free variables is a (closed)

  • sentence. FOL sentences ⊂ WFFs.
slide-29
SLIDE 29

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Free and Bound Variables

((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) First occurrence of x is free; Second occurrence of x is bound; Occurrence of y is bound. Free variable ≈ pronouns.

She loves Fido

Context needed to interpret she; Something in addition to models so far needed to interpret free variables. A WFF (Term(BOOL)) with no free variables is a (closed)

  • sentence. FOL sentences ⊂ WFFs.
slide-30
SLIDE 30

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Free and Bound Variables

((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) First occurrence of x is free; Second occurrence of x is bound; Occurrence of y is bound. Free variable ≈ pronouns.

She loves Fido

Context needed to interpret she; Something in addition to models so far needed to interpret free variables. A WFF (Term(BOOL)) with no free variables is a (closed)

  • sentence. FOL sentences ⊂ WFFs.
slide-31
SLIDE 31

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Free and Bound Variables

((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) First occurrence of x is free; Second occurrence of x is bound; Occurrence of y is bound. Free variable ≈ pronouns.

She loves Fido

Context needed to interpret she; Something in addition to models so far needed to interpret free variables. A WFF (Term(BOOL)) with no free variables is a (closed)

  • sentence. FOL sentences ⊂ WFFs.
slide-32
SLIDE 32

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Free and Bound Variables

((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) First occurrence of x is free; Second occurrence of x is bound; Occurrence of y is bound. Free variable ≈ pronouns.

She loves Fido

Context needed to interpret she; Something in addition to models so far needed to interpret free variables. A WFF (Term(BOOL)) with no free variables is a (closed)

  • sentence. FOL sentences ⊂ WFFs.
slide-33
SLIDE 33

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Interpreting FOL Sentences

Task: Compute whether a sentence is true or false with respect to a model.

Is the sentence an accurate description of the situation?

Strategy: Compositionality! Use recursion, but: Subformula of ∀x.(robber x) is (robber x) and this is not a sentence! So. . .

slide-34
SLIDE 34

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Satisfaction: [ [φ] ]M,g = 1

Model M and variable assignment g satisfy the WFF φ. g defined for all individual variables, i.e., x ∈ Var(IND); g(x) ∈ D. If α is an atomic term (∈ Con(τ) ∪ Var(τ)), then ig

V(α) =

g(α) if α is a variable V(α) if α is a constant [ [∃x.φ] ]M,g = 1 iff [ [φ] ]M,g[u/x] = 1 for some u ∈ D g[u/x](x) = u ‘Try to find some value u for x that makes φ true’

slide-35
SLIDE 35

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Value of a term in a model

Where M = D, V: [ [α] ]M,g = ig

V(α)

if α is atomic [ [(α β)] ]M,g = [ [α] ]M,g([ [β] ]M,g) [ [(λx.α)] ]M,g = that function h such that for any u ∈ D, h(u) = [ [α] ]M,g[u/x] [ [α1 = α2] ]M,g = 1 iff [ [α1] ]M,g = [ [α2] ]M,g [ [¬φ] ]M,g = 1 iff [ [φ] ]M,g = 0 [ [φ ∧ ψ] ]M,g = 1 iff [ [φ] ]M,g = 1 and [ [ψ] ]M,g = 1 [ [φ ∨ ψ] ]M,g iff [ [φ] ]M,g = 1 or [ [ψ] ]M,g = 1 [ [φ → ψ] ]M,g = 1 iff [ [φ] ]M,g = 0 or [ [ψ] ]M,g = 1 [ [∃x.φ] ]M,g = 1 iff [ [φ] ]M,g[u/x] = 1 for some u ∈ D [ [∀x.φ] ]M,g = 1 iff [ [φ] ]M,g[u/x] = 1 for every u ∈ D.

slide-36
SLIDE 36

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein Outline Typed Lambda Calculus First Order Logic Truth and Satisfaction

Truth (in terms of Satisfaction)

If φ ∈ Term(BOOL), we often write M, g | = φ instead of [ [φ] ]M,g′ = 1. It doesn’t matter which g you use for sentences, so: Truth: A sentence φ is true in a model M (written M | = φ) iff for any g, M, g | = φ Validity: A sentence φ is valid (written | = φ) iff for any M, M | = φ Entailment: φ1, . . . , φn | = ψ iff if M, g | = φi for all i, 1 ≤ i ≤ n, then M, g | = ψ