Docsity

Lambda Calculus Lecture - Introduction to Formal Semantics - Lecture Slides, Slides of Formal Semantics

Partial preview of the text

Download Lambda Calculus Lecture - Introduction to Formal Semantics - Lecture Slides and more Slides Formal Semantics in PDF only on Docsity!

Last Time

Grammar Rule Recursion

Recursion:

– A phrase may contain embedded inside another

instance of the same phrase

Examples:

– sentence with a

relative clause

  • [

Sbar

[

S

I saw [

NP

the man [

Sbar

who [

S

attacked me]]]]]

possessive NPs

  • [

NP

[

NP

[

NP

John]’s mother]’s cat]

Last Time

Grammar Rule Recursion

-^

(Fixed) Prolog Computation Rule:

always pick the

first-mentioned

matching grammar rule to try each

time we expand a non-terminal

-^

General Rule for writing recursive rules:

put recursive case

last

i.e.

place non-recursive rules for a non-terminal ahead of the

recursive ones

-^

DCG rules for Possessive NPs:

np --> np, [‘‘‘s‘], n.

n --> [mother].

n --> [cat].

np --> [john].

move

recursive

rule tothe end

avoid Infinite Loop in PrologERROR: out of local stack.

Today’s Topic

• “The Lambda Calculus Lecture”

– Getting comfortable with Lambda Calculus

see it as another way of stating what we havebeen doing already using Prolog notation

– do lots of examples

More on the Lambda Calculus•^

Lambda Calculus

vs. Prolog notation

-^

Example (Quiz 3)

transitive predicate

Phrase

Lambda Calculus

Prolog notation

likes

λy.[

λx.x likes y]

likes(X,Y).

likes Mary

[λ

y.[

λx.x likes y]](Mary)

likes(X,Y), Y = mary.

λx.x likes Mary

likes(X,mary).

John likes Mary

[

λx.x likes Mary](John)

likes(X,mary), X = john.

John likes Mary

likes(john,mary).

More on the Lambda Calculus Note:

nesting order of

y and

x matters

why

: λy.[

λx.x likes y] λx.[

λy.x likes y] here

: lambda expression quantifier for the

object must be outside because of phrasestructure hierarchy

Example: Phrase

Lambda Calculus

likes

λy.[

λx.x likes y]

likes Mary

[λ

y.[

λx.x likes y]](Mary) λx.x likes Mary

John likes Mary

[λ

x.x likes Mary](John) John likes Mary

sentence np

np

vp v

John

Mary

likes

mary

likes(X,Y)

likes(X,mary)

likes(john,mary)john

sentence np

np

vp v

John

Mary

likes

Mary

λy.[

λx.x likes Maryλx.x likes y]

John likes MaryJohn

Prolognotation LambdaCalculus

More on the Lambda Calculus•^

3.3 Relative Clauses

  • (7) Hannibal is [who Shelby saw]

semantics of relative clause [who Shelby saw]:

who Shelby saw

is a bit like a sentence (proposition)

-^

who

1

Shelby saw e

1

wh

-movement

of

who

1

leaving a trace

e

1

-^

Shelby saw who

underlying structure

Prolog style:

  • saw(shelby,who).• saw(shelby,X).

(using a logic variable for

who

lambda calculus style:

-^

x.Shelby saw x

( straight translation from Prolog

sentence np

vp v

Hannibal

is

sbar

sentence np

np

vp v

Shelby

saw

np

e^1

who

1

More on the Lambda Calculus•^

Back to comparing:

–^

(7) Hannibal is [who Shelby saw]

-^

(7’) Hannibal is happy

-^

Semantics (Prolog-style):

–^

(7) Hannibal is [saw(shelby,X)]

-^

(7’) Hannibal is

[happy(X)]

-^

Semantics (Lambda calculus):

–^

(7) Hannibal is [

λx.Shelby saw x]

–^

(7’) Hannibal is

[λ

x.x happy]

-^

Notice the similarity between (7) and (7’)wrt meaning:

–^

both highlighted parts are single variable

λ

x

expressions

-^

(unsaturated for subject)

-^

we can say they are of the “same type”

-^

This means we can use the same identityfunction

λ

y.y

for the copula in either case

sentence np

np

vp v

Hannibal

happy

is

λx.x happy

λx.x happy

Hannibal happy

(Simplified Derivation)Points to remember: Phrase

Lambda calculus

who

λx

e^

x

λy.y

Hannibal

λy.y saw x

Shelby

[λ

y.y saw x](Shelby) Shelby saw x

λx.Shelby saw x λx

λx.Shelby saw x

Shelby saw Hannibal

x

λx.[

λy.y saw x]

docsity.com

More on the Lambda Calculus•^

We could do topicalization in the same wayas for relative clauses

3.4 Topicalization

– (9) Shelby, Mary saw– (10) Shelby is who

Mary saw

e

– (10’) Shelby is [

x.Mary saw x]

– (10”) Mary saw Shelby