<<

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & and of NLP Klein Lambda Terms, Quantifiers, Satisfaction Outline

Typed Lambda

First Order Alex Lascarides & Ewan Klein Logic

Truth and Satisfaction School of Informatics University of Edinburgh

10 January 2008 SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein 1 Typed

Outline

Typed Lambda Calculus 2 First Order Logic First Order Logic

Truth and Satisfaction 3 Truth and Satisfaction Transitive Verbs as Functions

SPNLP: Lambda Terms, Quantifiers, Satisfaction We looked at replacing n-ary relations with functions. How Lascarides & does this work with transitive verbs? Klein

Outline Version 1: chase of type → BOOL Typed Lambda Version 2: chase of type IND → (IND → BOOL) Calculus

First Order Logic Advantages of Version 2 (called a curryed ): Truth and Satisfaction Makes the syntax more uniform. Fits better with compositional semantics (discussed later) Transitive Verbs as Functions

SPNLP: Lambda Terms, Quantifiers, Satisfaction We looked at replacing n-ary relations with functions. How Lascarides & does this work with transitive verbs? Klein

Outline Version 1: chase of type → BOOL Typed Lambda Version 2: chase of type IND → (IND → BOOL) Calculus

First Order Logic Advantages of Version 2 (called a curryed function): Truth and Satisfaction Makes the syntax more uniform. Fits better with compositional semantics (discussed later) Transitive Verbs as Functions

SPNLP: Lambda Terms, Quantifiers, Satisfaction We looked at replacing n-ary relations with functions. How Lascarides & does this work with transitive verbs? Klein

Outline Version 1: chase of type → BOOL Typed Lambda Version 2: chase of type IND → (IND → BOOL) Calculus

First Order Logic Advantages of Version 2 (called a curryed function): Truth and Satisfaction Makes the syntax more uniform. Fits better with compositional semantics (discussed later) Transitive Verbs as Functions

SPNLP: Lambda Terms, Quantifiers, Satisfaction We looked at replacing n-ary relations with functions. How Lascarides & does this work with transitive verbs? Klein

Outline Version 1: chase of type → BOOL Typed Lambda Version 2: chase of type IND → (IND → BOOL) Calculus

First Order Logic Advantages of Version 2 (called a curryed function): Truth and Satisfaction Makes the syntax more uniform. Fits better with compositional semantics (discussed later) Transitive Verbs as Functions

SPNLP: Lambda Terms, Quantifiers, Satisfaction We looked at replacing n-ary relations with functions. How Lascarides & does this work with transitive verbs? Klein

Outline Version 1: chase of type → BOOL Typed Lambda Version 2: chase of type IND → (IND → BOOL) Calculus

First Order Logic Advantages of Version 2 (called a curryed function): Truth and Satisfaction Makes the syntax more uniform. Fits better with compositional semantics (discussed later) Lambda

SPNLP: Lambda Terms, Quantifiers, Lambdas talk about missing information, and where it is. Satisfaction Lascarides & The λ binds a . Klein The positions of a λ-bound variable in the formula mark Outline where information is ‘missing’. Replacing these variables with values fills in the

First Order missing information. Logic Truth and Example: Satisfaction λx.(man x) λ-abstract (λx.(man x) john) application (man john) β-reduction/. Types

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein IND and BOOL are basic types. Outline If σ, τ are types, then so is (σ → τ). Brackets are Typed Lambda omitted if no . Calculus For types τ, we have variables Var(τ), constants First Order Logic Con(τ). Truth and Satisfaction Since we are doing first order logic, we will later restrict variables to Var(IND), but allow constants of any type. Types

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein IND and BOOL are basic types. Outline If σ, τ are types, then so is (σ → τ). Brackets are Typed Lambda omitted if no ambiguity. Calculus For types τ, we have variables Var(τ), constants First Order Logic Con(τ). Truth and Satisfaction Since we are doing first order logic, we will later restrict variables to Var(IND), but allow constants of any type. Types

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein IND and BOOL are basic types. Outline If σ, τ are types, then so is (σ → τ). Brackets are Typed Lambda omitted if no ambiguity. Calculus For types τ, we have variables Var(τ), constants First Order Logic Con(τ). Truth and Satisfaction Since we are doing first order logic, we will later restrict variables to Var(IND), but allow constants of any type. Types

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein IND and BOOL are basic types. Outline If σ, τ are types, then so is (σ → τ). Brackets are Typed Lambda omitted if no ambiguity. Calculus For types τ, we have variables Var(τ), constants First Order Logic Con(τ). Truth and Satisfaction Since we are doing first order logic, we will later restrict variables to Var(IND), but allow constants of any type. Terms in Typed Lambda Calculus

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein We define terms (τ) of type τ:

Outline Var(τ) ⊆ Term(τ). Typed Lambda Con(τ) ⊆ Term(τ). Calculus

First Order If α ∈ Term(σ → τ) and β ∈ Term(σ) then Logic (α β) ∈ Term(τ) (function application). Truth and Satisfaction If x ∈ Var(σ) and α ∈ Term(ρ), then λx.α ∈ Term(τ), where τ = (σ → ρ) Terms in Typed Lambda Calculus

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein We define terms Term(τ) of type τ:

Outline Var(τ) ⊆ Term(τ). Typed Lambda Con(τ) ⊆ Term(τ). Calculus

First Order If α ∈ Term(σ → τ) and β ∈ Term(σ) then Logic (α β) ∈ Term(τ) (function application). Truth and Satisfaction If x ∈ Var(σ) and α ∈ Term(ρ), then λx.α ∈ Term(τ), where τ = (σ → ρ) Terms in Typed Lambda Calculus

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein We define terms Term(τ) of type τ:

Outline Var(τ) ⊆ Term(τ). Typed Lambda Con(τ) ⊆ Term(τ). Calculus

First Order If α ∈ Term(σ → τ) and β ∈ Term(σ) then Logic (α β) ∈ Term(τ) (function application). Truth and Satisfaction If x ∈ Var(σ) and α ∈ Term(ρ), then λx.α ∈ Term(τ), where τ = (σ → ρ) Terms in Typed Lambda Calculus

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein We define terms Term(τ) of type τ:

Outline Var(τ) ⊆ Term(τ). Typed Lambda Con(τ) ⊆ Term(τ). Calculus

First Order If α ∈ Term(σ → τ) and β ∈ Term(σ) then Logic (α β) ∈ Term(τ) (function application). Truth and Satisfaction If x ∈ Var(σ) and α ∈ Term(ρ), then λx.α ∈ Term(τ), where τ = (σ → ρ) Extending to a First Order Language

SPNLP: Lambda Terms, Quantifiers, Satisfaction 1 Variables i.e., Var(IND): x, y, z,..., x0, x1, x2,... Lascarides & Klein 2 Boolean connectives: ¬ BOOL → BOOL () Outline ∧ BOOL → (BOOL → BOOL) (and) Typed Lambda ∨ BOOL → (BOOL → BOOL) (or) Calculus → BOOL → (BOOL → BOOL) (if. . . then) First Order Logic 3 Quantifiers: ∀ (all) Truth and Satisfaction ∃ (some) 4 Equality: = τ → (τ → BOOL) 5 Punctuation: brackets and period Quantifier Syntax

SPNLP: Lambda Terms, Quantifiers, If φ ∈ Term(BOOL), and x ∈ Var(IND), then ∀x.φ and Satisfaction Lascarides & ∃x.φ ∈ Term(BOOL). Klein x ∈ Var(IND) is called an individual variable. Outline

Typed Lambda Syntactic conventions: Calculus

First Order Logic Instead of writing ((= α)β), ((∧φ)ψ), etc., we write

Truth and (= α = β), (φ ∧ ψ), etc. Satisfaction 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. Quantifier Syntax

SPNLP: Lambda Terms, Quantifiers, If φ ∈ Term(BOOL), and x ∈ Var(IND), then ∀x.φ and Satisfaction Lascarides & ∃x.φ ∈ Term(BOOL). Klein x ∈ Var(IND) is called an individual variable. Outline

Typed Lambda Syntactic conventions: Calculus

First Order Logic Instead of writing ((= α)β), ((∧φ)ψ), etc., we write

Truth and (= α = β), (φ ∧ ψ), etc. Satisfaction 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. Quantifier Syntax

SPNLP: Lambda Terms, Quantifiers, If φ ∈ Term(BOOL), and x ∈ Var(IND), then ∀x.φ and Satisfaction Lascarides & ∃x.φ ∈ Term(BOOL). Klein x ∈ Var(IND) is called an individual variable. Outline

Typed Lambda Syntactic conventions: Calculus

First Order Logic Instead of writing ((= α)β), ((∧φ)ψ), etc., we write

Truth and (= α = β), (φ ∧ ψ), etc. Satisfaction 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. Quantifier Syntax

SPNLP: Lambda Terms, Quantifiers, If φ ∈ Term(BOOL), and x ∈ Var(IND), then ∀x.φ and Satisfaction Lascarides & ∃x.φ ∈ Term(BOOL). Klein x ∈ Var(IND) is called an individual variable. Outline

Typed Lambda Syntactic conventions: Calculus

First Order Logic Instead of writing ((= α)β), ((∧φ)ψ), etc., we write

Truth and (= α = β), (φ ∧ ψ), etc. Satisfaction 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. Some Examples

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein 1 ∃x.(love x kim) Kim loves someone Outline

Typed 2 (¬∃x.(love x kim)) Lambda Calculus Kim doesn’t love anyone First Order 3 ∀x.((robber x) → ∃y.((customer y) ∧ (love y x))) Logic

Truth and All robbers love a (perhaps different) customer Satisfaction 4 ∃y.((customer y) ∧ ∀x.((robber x) → (love y x))) All robbers love the same customer Some Examples

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein 1 ∃x.(love x kim) Kim loves someone Outline

Typed 2 (¬∃x.(love x kim)) Lambda Calculus Kim doesn’t love anyone First Order 3 ∀x.((robber x) → ∃y.((customer y) ∧ (love y x))) Logic

Truth and All robbers love a (perhaps different) customer Satisfaction 4 ∃y.((customer y) ∧ ∀x.((robber x) → (love y x))) All robbers love the same customer Some Examples

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein 1 ∃x.(love x kim) Kim loves someone Outline

Typed 2 (¬∃x.(love x kim)) Lambda Calculus Kim doesn’t love anyone First Order 3 ∀x.((robber x) → ∃y.((customer y) ∧ (love y x))) Logic

Truth and All robbers love a (perhaps different) customer Satisfaction 4 ∃y.((customer y) ∧ ∀x.((robber x) → (love y x))) All robbers love the same customer Some Examples

SPNLP: Lambda Terms, Quantifiers, Satisfaction Lascarides & Klein 1 ∃x.(love x kim) Kim loves someone Outline

Typed 2 (¬∃x.(love x kim)) Lambda Calculus Kim doesn’t love anyone First Order 3 ∀x.((robber x) → ∃y.((customer y) ∧ (love y x))) Logic

Truth and All robbers love a (perhaps different) customer Satisfaction 4 ∃y.((customer y) ∧ ∀x.((robber x) → (love y x))) All robbers love the same customer Free and Bound Variables

SPNLP: Lambda Terms, Quantifiers, ((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) Satisfaction Lascarides & Klein First occurrence of x is free; Outline

Typed Second occurrence of x is bound; Lambda Occurrence of y is bound. Calculus

First Order Free variable ≈ pronouns. Logic She loves Fido Truth and Satisfaction 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. Free and Bound Variables

SPNLP: Lambda Terms, Quantifiers, ((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) Satisfaction Lascarides & Klein First occurrence of x is free; Outline

Typed Second occurrence of x is bound; Lambda Occurrence of y is bound. Calculus

First Order Free variable ≈ pronouns. Logic She loves Fido Truth and Satisfaction 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. Free and Bound Variables

SPNLP: Lambda Terms, Quantifiers, ((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) Satisfaction Lascarides & Klein First occurrence of x is free; Outline

Typed Second occurrence of x is bound; Lambda Occurrence of y is bound. Calculus

First Order Free variable ≈ pronouns. Logic She loves Fido Truth and Satisfaction 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. Free and Bound Variables

SPNLP: Lambda Terms, Quantifiers, ((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) Satisfaction Lascarides & Klein First occurrence of x is free; Outline

Typed Second occurrence of x is bound; Lambda Occurrence of y is bound. Calculus

First Order Free variable ≈ pronouns. Logic She loves Fido Truth and Satisfaction 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. Free and Bound Variables

SPNLP: Lambda Terms, Quantifiers, ((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) Satisfaction Lascarides & Klein First occurrence of x is free; Outline

Typed Second occurrence of x is bound; Lambda Occurrence of y is bound. Calculus

First Order Free variable ≈ pronouns. Logic She loves Fido Truth and Satisfaction 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. Free and Bound Variables

SPNLP: Lambda Terms, Quantifiers, ((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) Satisfaction Lascarides & Klein First occurrence of x is free; Outline

Typed Second occurrence of x is bound; Lambda Occurrence of y is bound. Calculus

First Order Free variable ≈ pronouns. Logic She loves Fido Truth and Satisfaction 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. Free and Bound Variables

SPNLP: Lambda Terms, Quantifiers, ((customer x) ∨ ∀x.((robber x) → ∃y.(person y))) Satisfaction Lascarides & Klein First occurrence of x is free; Outline

Typed Second occurrence of x is bound; Lambda Occurrence of y is bound. Calculus

First Order Free variable ≈ pronouns. Logic She loves Fido Truth and Satisfaction 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. Interpreting FOL Sentences

SPNLP: Lambda Terms, Quantifiers, Satisfaction Task: Lascarides & Klein Compute whether a sentence is true or false with Outline respect to a model. Typed Lambda Is the sentence an accurate description of the situation? Calculus

First Order Logic Strategy: Compositionality!

Truth and Use , but: Satisfaction Subformula of ∀x.(robber x) is (robber x) and this is not a sentence! So. . . Satisfaction: [[φ]]M,g = 1

SPNLP: Lambda Terms, Quantifiers, Model M and variable assignment g satisfy the WFF φ. Satisfaction Lascarides & Klein g defined for all individual variables, i.e., x ∈ Var(IND);

Outline g(x) ∈ D. Typed α ∈ τ ∪ τ Lambda If is an atomic term ( Con( ) Var( )), then Calculus  First Order g g(α) if α is a variable Logic i (α) = V V (α) if α is a constant Truth and Satisfaction [[∃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’ Value of a term in a model

SPNLP: Lambda Where M = hD, V i: Terms, Quantifiers, Satisfaction Lascarides & Klein M,g g [[α]] = iV (α) if α is atomic M,g M,g M,g Outline [[(α β)]] = [[α]] ([[β]] ) M,g Typed [[(λx.α)]] = that function h such that for any u ∈ Lambda M,g[u/x] Calculus D, h(u) = [[α]] First Order [[α = α ]]M,g = 1 iff [[α ]]M,g = [[α ]]M,g Logic 1 2 1 2 [[¬φ]]M,g = φ]]M,g = Truth and 1 iff [[ 0 Satisfaction [[φ ∧ ψ]]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. Truth (in terms of Satisfaction)

SPNLP: Lambda Terms, Quantifiers, Satisfaction If φ ∈ Term(BOOL), we often write M, g |= φ instead of M,g0 Lascarides & [[φ]] = 1. Klein It doesn’t matter which g you use for sentences, so: Outline

Typed Lambda Truth: A sentence φ is true in a model M (written Calculus M |= φ) iff First Order Logic for any g, M, g |= φ Truth and Satisfaction 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 |= ψ