Computational Semantics: More Calculus -calculus Recap NLTK - - PowerPoint PPT Presentation

computational semantics more calculus
SMART_READER_LITE
LIVE PREVIEW

Computational Semantics: More Calculus -calculus Recap NLTK - - PowerPoint PPT Presentation

Computational Semantics: More Calculus Scott Farrar CLMA, University of Washington far- rar@u.washington.edu Computational Semantics: More Calculus -calculus Recap NLTK semantics operations Scott Farrar Type theory CLMA,


slide-1
SLIDE 1

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Computational Semantics: More λ Calculus

Scott Farrar CLMA, University of Washington farrar@u.washington.edu March 1, 2010

1/23

slide-2
SLIDE 2

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Today’s lecture

1

λ-calculus Recap

2

NLTK semantics

3

λ operations

4

Type theory

2/23

slide-3
SLIDE 3

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Key points from last time

The λ-calculus can be considered an axiomatic theory

  • f functions.

3/23

slide-4
SLIDE 4

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Key points from last time

The λ-calculus can be considered an axiomatic theory

  • f functions.

It is a calculus of functions and function application (F A), where F is some function and A is some argument.

3/23

slide-5
SLIDE 5

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Key points from last time

The λ-calculus can be considered an axiomatic theory

  • f functions.

It is a calculus of functions and function application (F A), where F is some function and A is some argument. F is in the form of λvar.expr such that var is bound by the λ operator.

3/23

slide-6
SLIDE 6

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Key points from last time

The λ-calculus can be considered an axiomatic theory

  • f functions.

It is a calculus of functions and function application (F A), where F is some function and A is some argument. F is in the form of λvar.expr such that var is bound by the λ operator. λx.red(x) is an example of a λ-expression.

3/23

slide-7
SLIDE 7

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Key points from last time

The λ-calculus can be considered an axiomatic theory

  • f functions.

It is a calculus of functions and function application (F A), where F is some function and A is some argument. F is in the form of λvar.expr such that var is bound by the λ operator. λx.red(x) is an example of a λ-expression. The function λx.red(x) is anonymous; it has no name.

3/23

slide-8
SLIDE 8

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Key points from last time

The λ-calculus can be considered an axiomatic theory

  • f functions.

It is a calculus of functions and function application (F A), where F is some function and A is some argument. F is in the form of λvar.expr such that var is bound by the λ operator. λx.red(x) is an example of a λ-expression. The function λx.red(x) is anonymous; it has no name. The λ-calculus can be used with FOL to functions to aid in the compositionality process.

3/23

slide-9
SLIDE 9

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Today’s lecture

1

λ-calculus Recap

2

NLTK semantics

3

λ operations

4

Type theory

4/23

slide-10
SLIDE 10

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Variables

The NLTK implements FOL and λ-calculus starting with a basic functional calculus and then adding elements of FOL. Furthermore, variables in the NLTK’s implementation are typed:

5/23

slide-11
SLIDE 11

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Variables

The NLTK implements FOL and λ-calculus starting with a basic functional calculus and then adding elements of FOL. Furthermore, variables in the NLTK’s implementation are typed: IndividualVariableExpression: the value has to be a, b, c, ..., w,x,y,z (but not e), plus 0 or more numerals, e.g., x, y, x1, y23.

5/23

slide-12
SLIDE 12

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Variables

The NLTK implements FOL and λ-calculus starting with a basic functional calculus and then adding elements of FOL. Furthermore, variables in the NLTK’s implementation are typed: IndividualVariableExpression: the value has to be a, b, c, ..., w,x,y,z (but not e), plus 0 or more numerals, e.g., x, y, x1, y23. EventVariableExpression: has to be e or e1, e2, ...

5/23

slide-13
SLIDE 13

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Variables

The NLTK implements FOL and λ-calculus starting with a basic functional calculus and then adding elements of FOL. Furthermore, variables in the NLTK’s implementation are typed: IndividualVariableExpression: the value has to be a, b, c, ..., w,x,y,z (but not e), plus 0 or more numerals, e.g., x, y, x1, y23. EventVariableExpression: has to be e or e1, e2, ... FunctionVariableExpression: has to be a single capital letter and can be followed by a numeral, e.g., A, B, A1, E1

5/23

slide-14
SLIDE 14

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Constants

ConstantExpression: an expression consisting of a constant, e.g., BILL, BB, bill

6/23

slide-15
SLIDE 15

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Binder expressions

7/23

slide-16
SLIDE 16

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Binder expressions

VariableBinderExpression: an abstract class, an expression with at least one bound variable and a binding operator (\, all, exists)

7/23

slide-17
SLIDE 17

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Binder expressions

VariableBinderExpression: an abstract class, an expression with at least one bound variable and a binding operator (\, all, exists) LambdaExpression: an expression with at least one variable bound by the λ operator (\)

7/23

slide-18
SLIDE 18

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Binder expressions

VariableBinderExpression: an abstract class, an expression with at least one bound variable and a binding operator (\, all, exists) LambdaExpression: an expression with at least one variable bound by the λ operator (\) ExistsExpression: an expression with at least one variable bound by the exists operator

7/23

slide-19
SLIDE 19

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Binder expressions

VariableBinderExpression: an abstract class, an expression with at least one bound variable and a binding operator (\, all, exists) LambdaExpression: an expression with at least one variable bound by the λ operator (\) ExistsExpression: an expression with at least one variable bound by the exists operator AllExpression: an expression with at least one variable bound by the all operator

7/23

slide-20
SLIDE 20

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK semantics

Binder expressions

VariableBinderExpression: an abstract class, an expression with at least one bound variable and a binding operator (\, all, exists) LambdaExpression: an expression with at least one variable bound by the λ operator (\) ExistsExpression: an expression with at least one variable bound by the exists operator AllExpression: an expression with at least one variable bound by the all operator ApplicationExpression: an expression with a functor and an argument

7/23

slide-21
SLIDE 21

Summary of λ-expressions

  • syn. category

example FOL λ expression common noun dog dog(x) \ x.dog(x) proper noun Bill BILL \ P.P(BILL) intransitive verb runs run(x) \ x.run(x) transitive verb loves love(x, y) \ X y.X(\ x.love(y,x)) copula is eq(x, y) \ X y.X(\ x.eq(y,x)) negative copula isn’t ¬eq(x, y) \ X y.X(\ x.-eq(y,x)) auxiliary verb did go go(x) \ K z.K(z) (\ x.go(x))

  • neg. auxiliary verb

didn’t go ¬go(x) \ K z.-K(z) (\ x.go(x))

slide-22
SLIDE 22

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Abstractions

We say that: \ x.red(x) is a λ abstraction

9/23

slide-23
SLIDE 23

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Abstractions

We say that: \ x.red(x) is a λ abstraction

Definition

The term λ-abstraction refers to a function, possibly constructed from an expression which was not originally a function, e.g., a predicate logic formula.

9/23

slide-24
SLIDE 24

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Applications

We say that: \ x. red(x) (BOAT)

10/23

slide-25
SLIDE 25

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Applications

We say that: \ x. red(x) (BOAT) is an application expression.

10/23

slide-26
SLIDE 26

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Applications

We say that: \ x. red(x) (BOAT) is an application expression.

Definition

An application expression is a formula with a function and an argument.

10/23

slide-27
SLIDE 27

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Today’s lecture

1

λ-calculus Recap

2

NLTK semantics

3

λ operations

4

Type theory

11/23

slide-28
SLIDE 28

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Reducing

We say that: \x.red(x)(BOAT) β-reduces to: red(BOAT)

Definition

β-reduction is the process of substituting an argument for variables (in the function) bound by the λ operator.

12/23

slide-29
SLIDE 29

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

α-conversion

Definition

Alpha conversion allows bound variable names to be

  • changed. For example, an alpha conversion of \ x.x would

be \ y.y . Frequently in uses of λ calculus, terms that differ

  • nly by alpha conversion are considered to be equivalent.

\ x.x ≡ \ y.y ≡ \ t.t Given \ x. \ x.x, which of the following would be a valid α-conversion?

1 \ y.

\ x.x

2 \ y.\ x.y 13/23

slide-30
SLIDE 30

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

α-conversion

Definition

Alpha conversion allows bound variable names to be

  • changed. For example, an alpha conversion of \ x.x would

be \ y.y . Frequently in uses of λ calculus, terms that differ

  • nly by alpha conversion are considered to be equivalent.

\ x.x ≡ \ y.y ≡ \ t.t Given \ x. \ x.x, which of the following would be a valid α-conversion?

1 \ y.

\ x.x

2 \ y.\ x.y (invalid conversion) 13/23

slide-31
SLIDE 31

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Today’s lecture

1

λ-calculus Recap

2

NLTK semantics

3

λ operations

4

Type theory

14/23

slide-32
SLIDE 32

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Adjectives

Adjectives are relatively simple unary predicates, but with an added conjunction.

15/23

slide-33
SLIDE 33

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Adjectives

Adjectives are relatively simple unary predicates, but with an added conjunction. For example, the target semantics for a noun modified by an adjective would be red ball, would translate to: \ x.red(x) & ball(x) The result is obtained using this lambda expression for red: \ P y. (red(y) & P(y))

15/23

slide-34
SLIDE 34

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Adjectives

Adjectives are relatively simple unary predicates, but with an added conjunction. For example, the target semantics for a noun modified by an adjective would be red ball, would translate to: \ x.red(x) & ball(x) The result is obtained using this lambda expression for red: \ P y. (red(y) & P(y)) red ball

15/23

slide-35
SLIDE 35

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Adjectives

Adjectives are relatively simple unary predicates, but with an added conjunction. For example, the target semantics for a noun modified by an adjective would be red ball, would translate to: \ x.red(x) & ball(x) The result is obtained using this lambda expression for red: \ P y. (red(y) & P(y)) red ball \ P y. (red(y) & P(y)) (\ x.ball(x))

15/23

slide-36
SLIDE 36

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Adjectives

Adjectives are relatively simple unary predicates, but with an added conjunction. For example, the target semantics for a noun modified by an adjective would be red ball, would translate to: \ x.red(x) & ball(x) The result is obtained using this lambda expression for red: \ P y. (red(y) & P(y)) red ball \ P y. (red(y) & P(y)) (\ x.ball(x)) \ y. (red(y) & \ x.ball(x)(y))

15/23

slide-37
SLIDE 37

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Adjectives

Adjectives are relatively simple unary predicates, but with an added conjunction. For example, the target semantics for a noun modified by an adjective would be red ball, would translate to: \ x.red(x) & ball(x) The result is obtained using this lambda expression for red: \ P y. (red(y) & P(y)) red ball \ P y. (red(y) & P(y)) (\ x.ball(x)) \ y. (red(y) & \ x.ball(x)(y)) \ y.(red(y) & ball(y))

15/23

slide-38
SLIDE 38

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Basic types

Syntactically speaking, expressions in the FOL+λ language come in 2 basic types: e and t

16/23

slide-39
SLIDE 39

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Basic types

Syntactically speaking, expressions in the FOL+λ language come in 2 basic types: e and t e is the type for entities

16/23

slide-40
SLIDE 40

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Basic types

Syntactically speaking, expressions in the FOL+λ language come in 2 basic types: e and t e is the type for entities t is the type for formulas, i.e., expressions which have truth values (True or False).

16/23

slide-41
SLIDE 41

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Basic types

Syntactically speaking, expressions in the FOL+λ language come in 2 basic types: e and t e is the type for entities t is the type for formulas, i.e., expressions which have truth values (True or False).

e type

The ‘e’ stands for entity in the UD. Constants and variables (terms) map to entities in the UD:

16/23

slide-42
SLIDE 42

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Basic types

Syntactically speaking, expressions in the FOL+λ language come in 2 basic types: e and t e is the type for entities t is the type for formulas, i.e., expressions which have truth values (True or False).

e type

The ‘e’ stands for entity in the UD. Constants and variables (terms) map to entities in the UD: BILL is of type e

16/23

slide-43
SLIDE 43

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Basic types

Syntactically speaking, expressions in the FOL+λ language come in 2 basic types: e and t e is the type for entities t is the type for formulas, i.e., expressions which have truth values (True or False).

e type

The ‘e’ stands for entity in the UD. Constants and variables (terms) map to entities in the UD: BILL is of type e x is of type e

16/23

slide-44
SLIDE 44

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

t type

type for formulas, i.e., expressions which have truth values (True or False):

17/23

slide-45
SLIDE 45

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

t type

type for formulas, i.e., expressions which have truth values (True or False): boy(x)

17/23

slide-46
SLIDE 46

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

t type

type for formulas, i.e., expressions which have truth values (True or False): boy(x) ∀x.smokes(x)

17/23

slide-47
SLIDE 47

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

t type

type for formulas, i.e., expressions which have truth values (True or False): boy(x) ∀x.smokes(x) ∃y.knows(y, BILL)

17/23

slide-48
SLIDE 48

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Definition

Now, lets assume that expressions in our FOL can be either functions and arguments, as the λ calculus does. Functions have signatures which define (1) what kinds of arguments the function takes and (2) the return type.

18/23

slide-49
SLIDE 49

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Definition

Now, lets assume that expressions in our FOL can be either functions and arguments, as the λ calculus does. Functions have signatures which define (1) what kinds of arguments the function takes and (2) the return type.

Complex types

There are arbitrarily many complex types expressed by their

  • signatures. The set of types is defined as follows:

18/23

slide-50
SLIDE 50

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Definition

Now, lets assume that expressions in our FOL can be either functions and arguments, as the λ calculus does. Functions have signatures which define (1) what kinds of arguments the function takes and (2) the return type.

Complex types

There are arbitrarily many complex types expressed by their

  • signatures. The set of types is defined as follows:

e is a (basic) type

18/23

slide-51
SLIDE 51

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Definition

Now, lets assume that expressions in our FOL can be either functions and arguments, as the λ calculus does. Functions have signatures which define (1) what kinds of arguments the function takes and (2) the return type.

Complex types

There are arbitrarily many complex types expressed by their

  • signatures. The set of types is defined as follows:

e is a (basic) type t is a (basic) type

18/23

slide-52
SLIDE 52

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Definition

Now, lets assume that expressions in our FOL can be either functions and arguments, as the λ calculus does. Functions have signatures which define (1) what kinds of arguments the function takes and (2) the return type.

Complex types

There are arbitrarily many complex types expressed by their

  • signatures. The set of types is defined as follows:

e is a (basic) type t is a (basic) type If a and b are types, then so is a, b.

18/23

slide-53
SLIDE 53

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Definition

Now, lets assume that expressions in our FOL can be either functions and arguments, as the λ calculus does. Functions have signatures which define (1) what kinds of arguments the function takes and (2) the return type.

Complex types

There are arbitrarily many complex types expressed by their

  • signatures. The set of types is defined as follows:

e is a (basic) type t is a (basic) type If a and b are types, then so is a, b. Nothing except the basic types, and what can be constructed from them by means of the previous clause are types.

18/23

slide-54
SLIDE 54

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Complex types

19/23

slide-55
SLIDE 55

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Complex types

1 < e, t >: signature for unary predicates, ie sets in UD 19/23

slide-56
SLIDE 56

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Complex types

1 < e, t >: signature for unary predicates, ie sets in UD 2 < e, < e, t >>: signature for binary predicates, ie

relations among sets in UD

19/23

slide-57
SLIDE 57

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Complex types

1 < e, t >: signature for unary predicates, ie sets in UD 2 < e, < e, t >>: signature for binary predicates, ie

relations among sets in UD

3 < e, < e, < e, t >>>: signature for a more complex

function

19/23

slide-58
SLIDE 58

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Complex types

1 < e, t >: signature for unary predicates, ie sets in UD 2 < e, < e, t >>: signature for binary predicates, ie

relations among sets in UD

3 < e, < e, < e, t >>>: signature for a more complex

function

4 ... 19/23

slide-59
SLIDE 59

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Expression types

Complex types

1 < e, t >: signature for unary predicates, ie sets in UD 2 < e, < e, t >>: signature for binary predicates, ie

relations among sets in UD

3 < e, < e, < e, t >>>: signature for a more complex

function

4 ...

< e, t >

< e, t > means that some function takes something of type e and returns something of type t. For instance, a unary predicate is one such example.

19/23

slide-60
SLIDE 60

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Complex Types

< e, < e, t >>

< e, < e, t >> means that some expression takes something

  • f type e and returns something of type ¡e,t¿. For instance,

a binary predicate is one example.

< e, e >

What about this one?

20/23

slide-61
SLIDE 61

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Complex Types

< e, < e, t >>

< e, < e, t >> means that some expression takes something

  • f type e and returns something of type ¡e,t¿. For instance,

a binary predicate is one example.

< e, e >

What about this one? Consider the named function father(x).

20/23

slide-62
SLIDE 62

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Complex Types

< e, < e, t >>

< e, < e, t >> means that some expression takes something

  • f type e and returns something of type ¡e,t¿. For instance,

a binary predicate is one example.

< e, e >

What about this one? Consider the named function father(x). fatherJOHN results in TED

20/23

slide-63
SLIDE 63

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Universal quantifier

The quantifier words every and all translate to the universal quantifier ∀, plus a conditional, e.g., All CEOs smoke. ∀x(CEO(x) → smoke(x)) We need to ensure that the structure of this quantifier phrase gets preserved. The attachment for all is: \ P Q. all x. (P (x) -> Q (x))

21/23

slide-64
SLIDE 64

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Universal quantifier example

All boys smoke.

22/23

slide-65
SLIDE 65

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Universal quantifier example

All boys smoke.

1 \ P Q. all x.

(P (x) -> Q (x)) (\ z. boy(z))(\ s.smoke(s))

22/23

slide-66
SLIDE 66

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Universal quantifier example

All boys smoke.

1 \ P Q. all x.

(P (x) -> Q (x)) (\ z. boy(z))(\ s.smoke(s))

2 \ Q. all x.

((\ z. boy(z)) (x) -> Q (x))

22/23

slide-67
SLIDE 67

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Universal quantifier example

All boys smoke.

1 \ P Q. all x.

(P (x) -> Q (x)) (\ z. boy(z))(\ s.smoke(s))

2 \ Q. all x.

((\ z. boy(z)) (x) -> Q (x))

3 \ Q. all x.

(boy(x) -> Q (x))

22/23

slide-68
SLIDE 68

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Universal quantifier example

All boys smoke.

1 \ P Q. all x.

(P (x) -> Q (x)) (\ z. boy(z))(\ s.smoke(s))

2 \ Q. all x.

((\ z. boy(z)) (x) -> Q (x))

3 \ Q. all x.

(boy(x) -> Q (x))

4 \ Q. all x.

(boy(x) -> Q (x))(\ s.smoke(s))

22/23

slide-69
SLIDE 69

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Universal quantifier example

All boys smoke.

1 \ P Q. all x.

(P (x) -> Q (x)) (\ z. boy(z))(\ s.smoke(s))

2 \ Q. all x.

((\ z. boy(z)) (x) -> Q (x))

3 \ Q. all x.

(boy(x) -> Q (x))

4 \ Q. all x.

(boy(x) -> Q (x))(\ s.smoke(s))

5

all x. (boy(x) -> \ s.smoke(s) (x))

22/23

slide-70
SLIDE 70

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

Universal quantifier example

All boys smoke.

1 \ P Q. all x.

(P (x) -> Q (x)) (\ z. boy(z))(\ s.smoke(s))

2 \ Q. all x.

((\ z. boy(z)) (x) -> Q (x))

3 \ Q. all x.

(boy(x) -> Q (x))

4 \ Q. all x.

(boy(x) -> Q (x))(\ s.smoke(s))

5

all x. (boy(x) -> \ s.smoke(s) (x))

6

all x. (boy(x) -> smoke(x))

22/23

slide-71
SLIDE 71

Computational Semantics: More λ Calculus Scott Farrar CLMA, University

  • f Washington far-

rar@u.washington.edu λ-calculus Recap NLTK semantics λ operations Type theory

NLTK notes for hw6

For hw6 use a feature context free grammar to parse the simple sentences. Notice how the func-arg relation is represented here: % start S S[sem = <?subj(?vp)>] -> NP[sem=?subj] VP[sem=?vp] ... IV[sem=<\x.run(x)>] -> ’runs’ ... Just use simple semantic attachments, no m/s features

  • required. Try event semantics if you want.

23/23