Logical Structures in Natural Language: Lambda calculus Raffaella - - PowerPoint PPT Presentation

logical structures in natural language lambda calculus
SMART_READER_LITE
LIVE PREVIEW

Logical Structures in Natural Language: Lambda calculus Raffaella - - PowerPoint PPT Presentation

Logical Structures in Natural Language: Lambda calculus Raffaella Bernardi Universit` a di Trento e-mail: bernardi@disi.unitn.it Contents First Last Prev Next Contents 1 Recall: Formal Semantics Main questions . . . . . . . . . . .


slide-1
SLIDE 1

Logical Structures in Natural Language: Lambda calculus

Raffaella Bernardi

Universit` a di Trento e-mail: bernardi@disi.unitn.it

Contents First Last Prev Next ◭

slide-2
SLIDE 2

Contents

1 Recall: Formal Semantics Main questions . . . . . . . . . . . . . . . . . . . . . 4 1.1 Building Meaning Representations . . . . . . . . . . . . . . . . . . . . 5 2 Lambda Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 Lambda-terms: Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2 Functional Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.3 β-conversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.4 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.5 α-conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3 Lambda-Terms Interpretations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.1 Models, Domains, Interpretation . . . . . . . . . . . . . . . . . . . . . . 13 3.2 Lambda-calculus: some remarks . . . . . . . . . . . . . . . . . . . . . . 14 4 Summing up: Constituents and Assembly . . . . . . . . . . . . . . . . . . . . 15 5 Determiners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.1 Determiners (cont’d) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.2 Quantified NP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.3 Generalized Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.4 Generalized Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 6 Administrativa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Contents First Last Prev Next ◭

slide-3
SLIDE 3

1. Recall: Formal Semantics Main questions

The main questions are:

  • 1. What does a given sentence mean?
  • 2. How is its meaning built?
  • 3. How do we infer some piece of information out of another?

Contents First Last Prev Next ◭

slide-4
SLIDE 4

1.1. Building Meaning Representations

To build a meaning representation we need to fulfill three tasks: Task 1 Specify a reasonable syntax for the natural language fragment of interest. Task 2 Specify semantic representations for the lexical items. Task 3 Specify the translation of constituents compositionally. That is, we need to specify the translation of such expressions in terms of the translation

  • f their parts, parts here referring to the substructure given to us by the syntax.

Moreover, when interested in Computational Semantics, all three tasks need to be carried out in a way that leads to computational implementation naturally.

Contents First Last Prev Next ◭

slide-5
SLIDE 5

2. Lambda Calculus

FOL augmented with Lambda calculus can capture the “how” and accomplish tasks 2 and 3. ◮ It has a variable binding operators λ. Occurrences of variables bound by λ should be thought of as place-holders for missing information: they explicitly mark where we should substitute the various bits and pieces obtained in the course of semantic construction. ◮ An operation called β-conversion performs the required substitutions.

Contents First Last Prev Next ◭

slide-6
SLIDE 6

2.1. Lambda-terms: Examples

Here is an example of lambda terms: λx.left(x) The prefix λx. binds the occurrence of x in student(x). We say it abstracts over the variable x. The purpose of abstracting over variables is to mark the slots where we want the substitutions to be made. To glue vincent with “left” we need to apply the lambda-term representing “left” to the

  • ne representing “Vincent”:

λx.left(x)(vincent) Such expressions are called functional applications, the left-hand expression is called the functor and the right-hand expression is called the argument. The functor is applied to the argument. Intuitively it says: fill all the placeholders in the functor by occurrences

  • f the term vincent.

The substitution is performed by means of β-conversion, obtaining left(vincent).

Contents First Last Prev Next ◭

slide-7
SLIDE 7

2.2. Functional Application

Summing up: ◮ FA has the form: Functor(Argument). E.g. (λx.love(x, mary))(john) ◮ FA triggers a very simple operation: Replace the λ-bound variable by the

  • argument. E.g. (λx.love(x, mary))(john) ⇒ love(john, mary)

Contents First Last Prev Next ◭

slide-8
SLIDE 8

2.3. β-conversion

Summing up:

  • 1. Strip off the λ-prefix,
  • 2. Remove the argument,
  • 3. Replace all occurences of the λ-bound variable by the argument.

For instance,

  • 1. (λx.love(x, mary))(john)
  • 2. love(x, mary)(john)
  • 3. love(x, mary)
  • 4. love(john, mary)

Contents First Last Prev Next ◭

slide-9
SLIDE 9

2.4. Exercise

Give the lambda term representing a transitive verb. (a) Build the meaning representation of “John saw Mary” starting from: ◮ John: j ◮ Mary: m ◮ saw: λx.λy.saw(y, x) (b) Build the syntactic tree of the sentence. (c) Compare what you have done to assembly the meaning representation with the way you have built the tree.

Contents First Last Prev Next ◭

slide-10
SLIDE 10

2.5. α-conversion

Warning: Accidental bounds, e.g. λx.λy.Love(y, x)(y) gives λy.Love(y, y). We need to rename variables before performing β-conversion. α-conversion is the process used in the λ-calculus to rename bound variables. For instance, we obtain λx.λy.Love(y, x) from λz.λy.Love(y, z). When working with lambda calculus we always α-covert before carrying out β-

  • conversion. In particular, we always rename all the bound variables in the functor

so they are distinct from all the variables in the argument. This prevents accidental binding.

Contents First Last Prev Next ◭

slide-11
SLIDE 11

3. Lambda-Terms Interpretations

In the first part of the course you’ve seen that a Model is a pair consisting of a domain (D) and an interpretation function (I). ◮ In the case of FOL we had only one domain, namely the one of the ob- jects/entities we were reasoning about. Similarly, we only had one type of

  • variables. Moreover, we were only able to speak of propositions/clauses.

◮ λ-terms speak of functions and we’ve used also variables standing for func-

  • tions. Therefore, we need a more complex concept of interpretation, or better

a more complex concept of domain to provide the fine-grained distinction among the objects we are interested in: truth values, entities and functions. ◮ For this reason, the λ-calculus is of Higher Order.

Contents First Last Prev Next ◭

slide-12
SLIDE 12

3.1. Models, Domains, Interpretation

In order to interpret meaning representations expressed in FOL augmented with λ, the following facts are essential:

◮ Sentences: Sentences can be thought of as referring to their truth value, hence they denote in the the domain Dt = {1, 0}. ◮ Entities: Entities can be represented as constants denoting in the domain De, e.g. De = {john, vincent, mary} ◮ Functions: The other natural language expressions can be seen as incomplete sen- tences and can be interpreted as boolean functions (i.e. functions yielding a truth value). They denote on functional domains DDa

b

and are represented by functional terms of type (a → b). For instance “walks” misses the subject (of type e) to yield a sentence (t). ⊲ denotes in DDe

t

⊲ is of type (e → t), ⊲ is represented by the term λxe(walk(x))t

Contents First Last Prev Next ◭

slide-13
SLIDE 13

3.2. Lambda-calculus: some remarks

The pure lambda calculus is a theory of functions as rules invented around 1930 by Church. It has more recently been applied in Computer Science for instance in “Semantics of Programming Languages”. In Formal Linguistics we are mostly interested in lambda conversion and abstraction. Moreover, we work only with typed-lambda calculus and even more, only with a fragment of it. The types are the ones we have seen above labeling the domains, namely: ◮ e and t are types. ◮ If a and b are types, then (a → b) is a type.

Contents First Last Prev Next ◭

slide-14
SLIDE 14

4. Summing up: Constituents and Assembly

Let’s go back to the points where FOL fails, i.e. constituent representation and

  • assembly. The λ-calculus succeeds in both:

Constituents: each constituent is represented by a lambda term. John: j knows: λxy.(know(x))(y) read john: λy.know(y, j) Assembly: function application (α(β)) and abstraction (λx.α[x]) capture compo- sition and decomposition of meaning representations. Exercises on lambda calculus.

Contents First Last Prev Next ◭

slide-15
SLIDE 15

5. Determiners

Which is the lambda term representing quantifiers like “nobody”, “everybody”, “a man”or “every student” or a determiners like “a”, “every” or “no” ? We know how to represent in FOL the following sentences ◮ “Nobody left” ¬∃x.left(x) ◮ “Everybody left” ∀x.left(x) ◮ “Every student left” ∀x.Student(x) → left(x) ◮ “A student left” ∃x.Student(x) ∧ left(x) ◮ “No student left” ¬∃x.Student(x) ∧ left(x) But how do we reach these meaning representations starting from the lexicon?

Contents First Last Prev Next ◭

slide-16
SLIDE 16

5.1. Determiners (cont’d)

Let’s start representing “a man” as ∃x.man(x). Applying the rules we have seen so far, we obtain that the representation of “A man loves Mary” is: love(∃x.man(x), mary) which is clearly wrong. Notice that ∃x.man(x) just isn’t the meaning of “a man”. If anything, it translates the complete sentence “There is a man”. FOL does not give us the possibility to express its meaning representation. We will see now that instead lambda terms provide us with the proper expressivity.

Contents First Last Prev Next ◭

slide-17
SLIDE 17

5.2. Quantified NP

a) Every male student of Filosofia & Informatica attends the LoLa course. b) No male student of Filosofia & Informatica attends the Logic course. a) means that if Enrico constitute the set of the male students of Filosofia & Infor- matica, then it is true that he attends the LoLa course. b) means that for none of the individual members of the set of male students of Filosofia & Informatica it is true that he attends the Logic course. What is the interpretation of “every male student” and of “no male student”? Individual constants used to denote specific individuals cannot be used to denote quantified expressions like “every man”, “no student”, “some friends”. Quantified-NPs like “every man”, “no student”, “some friends” are called non- referential. See Heim & Kratzer for other discussion on this issue. (Ch. 6)

Contents First Last Prev Next ◭

slide-18
SLIDE 18

5.3. Generalized Quantifiers

A Generalized Quantifier (GQ) is a set of properties, i.e. a set of sets-of-individuals. For instance, “every man” denotes the set of properties that every man has. The property of “walking” is in this set iff every man walks. For instance, [ [man] ] = {a, b, c}; [ [fat] ] = {a, b, c, d}; [ [dog] ] = {d}; [ [run] ] = {a, b}; [ [jump] ] = {b, c, d}; [ [laugh] ] = {b, d}; Which is the interpretation of “every man”? What do we know that holds for every man? “Every man is man”, “Every man is fat” [ [every man] ] = {X|[ [man] ] ⊆ X} = {{a, b, c}, {a, b, c, d}} = {[ [man] ], [ [fat] ]}

Contents First Last Prev Next ◭

slide-19
SLIDE 19

5.4. Generalized Quantifiers

[ [no man] ] = {X ⊆ E | [ [man] ] ∩ X = ∅}. [ [some man] ] = {X ⊆ E | [ [man] ] ∩ X = ∅}. [ [every man] ] = {X ⊆ E | [ [man] ] ⊆ X}. [ [man which VP] ] = [ [man] ] ∩ [ [VP] ]. Therefore, determiners are as below: [ [no N] ] = {X ⊆ E | [ [N] ] ∩ X = ∅}. [ [some N] ] = {X ⊆ E | [ [N] ] ∩ X = ∅}. [ [every N] ] = {X ⊆ E | [ [N] ] ⊆ X}. [ [N which VP] ] = [ [N] ] ∩ [ [VP] ]. Generalized quantifiers have attracted the attention of many researchers working on the interaction between logic and linguistics. Which is the lambda term representing quantifiers like “nobody”, “everybody”, “a man”or “every student” or a determiners like “a”, “every” or “no” ?

Contents First Last Prev Next ◭

slide-20
SLIDE 20

6. Administrativa

Exams: 9 June, 7 July, 8 September. The written exam will include also Roberto’s part.

Contents First Last Prev Next ◭