3b. A formalism for meaning (cont’d again): F2 3.2, 3.6

Slides:



Advertisements
Similar presentations
Semantics Static semantics Dynamic semantics attribute grammars
Advertisements

Grammars, constituency and order A grammar describes the legal strings of a language in terms of constituency and order. For example, a grammar for a fragment.
CAS LX 502 8a. Formal semantics Truth and meaning The basis of formal semantics: knowing the meaning of a sentence is knowing under what conditions.
Foundations of Programming Languages: Introduction to Lambda Calculus
CAS LX 502 Semantics 1b. The Truth Ch. 1.
CSRU 1100 Logic. Logic is concerned with determining: Is it True? Is it False?
CAS LX a. A notational holiday. Sets A set is a collection of entities of any kind. They can be finite: {√2, John Saeed, 1984}. They can be infinite:
Let remember from the previous lesson what is Knowledge representation
Introduction Even though the syntax of Scheme is simple, it can be very difficult to determine the semantics of an expression. Hacker’s approach: Run it.
Meaning and Language Part 1.
CAS LX 502 Semantics 2b. A formalism for meaning 2.5, 3.2, 3.6.
CAS LX 502 Semantics 3a. A formalism for meaning (cont ’ d) 3.2, 3.6.
CAS LX 502 8b. Formal semantics A fragment of English.
CAS LX 502 Semantics 5b. Pronouns, assignments, and quantifiers 5.7(.1), 6.1.
Albert Gatt LIN3021 Formal Semantics Lecture 4. In this lecture Compositionality in Natural Langauge revisited: The role of types The typed lambda calculus.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Rules, Movement, Ambiguity
FUNCTIONS Relation – a set of ( x, y ) points Function – a set of ( x, y ) points where there is only one output for each specific input – x can not be.
Curry A Tasty dish? Haskell Curry!. Curried Functions Currying is a functional programming technique that takes a function of N arguments and produces.
CAS LX b. Binding. Syntactic base rules (F2) S  NP VPVP  Vt NP S  S ConjPVP  Vi ConjP  Conj SNP  Det N C S  Neg SNP  N P Det  the, a, everyN.
CAS LX b. Summarizing the fragment analysis, relative clauses.
CAS LX 502 9b. Formal semantics Pronouns and quantifiers.
CMSC 330: Organization of Programming Languages Operational Semantics.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
Meaning and Language Part 1. Plan We will talk about two different types of meaning, corresponding to two different types of objects: –Lexical Semantics:
PPL Syntax & Formal Semantics Lecture Notes: Chapter 2.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 04 : Logic.
JavaScript: Conditionals contd.
Propositional Calculus
HA1-439: Functions Intro Remember, a relation is ANY set of ordered pairs like (3,2), (-2, 4), (4.5, 6) …It is any set of x’s and y’s. A FUNCTION is a.
The NP class. NP-completeness
P & NP.
State the domain, range and tell whether or not it is a function.
Syntax Lecture 9: Verb Types 1.
Copyright © Cengage Learning. All rights reserved.
ARTIFICIAL INTELLIGENCE
11a. Predicate modification and adjectives
Boolean algebra Last time we talked about Boolean functions, Boolean expressions, and truth tables. Today we’ll learn how to how use Boolean algebra to.
Chapter 2 Sets and Functions.
Discrete Structure II: Introduction
NP-Completeness Yin Tat Lee
Structural relations Carnie 2013, chapter 4 Kofi K. Saah.
Lecture 5 Floyd-Hoare Style Verification
Copyright © Cengage Learning. All rights reserved.
Truth Trees.
FP Foundations, Scheme In Text: Chapter 14.
What would be our focus ? Geometry deals with Declarative or “What is” knowledge. Computer Science deals with Imperative or “How to” knowledge 12/25/2018.
Announcements Quiz 6 HW7 due Tuesday, October 30
Algorithm and Ambiguity
FUNCTION NOTATION AND EVALUATING FUNCTIONS
6.001 SICP Further Variations on a Scheme
MA/CSSE 474 Theory of Computation
What would be our focus ? Geometry deals with Declarative or “What is” knowledge. Computer Science deals with Imperative or “How to” knowledge 2/23/2019.
From now on: Combinatorial Circuits:
6.001 SICP Variations on a Scheme
NP-Completeness Yin Tat Lee
ECE 352 Digital System Fundamentals
Copyright © Cengage Learning. All rights reserved.
This Lecture Substitution model
Copyright © Cengage Learning. All rights reserved.
Curry A Tasty dish? Haskell Curry!.
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
APPLICATIONS OF DIFFERENTIATION
Compounding.
Implementation of Learning Systems
Introducing Natural Deduction
Truth tables.
Presentation transcript:

3b. A formalism for meaning (cont’d again): F2 3.2, 3.6 CAS LX 502 Semantics 3b. A formalism for meaning (cont’d again): F2 3.2, 3.6

Full summary of F1 S  N VP [S N VP]M = true iff [N]M  [VP]M S  Neg S [S Neg S´]M = true iff [S´]M  [Neg]M S  S ConjP [S S ConjP]M = true iff [S]M  [ConjP]M ConjP  Conj S [ConjP Conj S]M = {x : < x, [S]M >  [Conj]M } VP  Vt N [VP Vt N]M = {x : < x, [N]M >  [Vt]M } VP  Vi [ [X] ]M = [X]M for any X [X]M = F(X) where X is a terminal node N  Pavarotti, … F(Pavarotti) = PAVAROTTI Vi  is boring, … F(is boring) = {x: x is boring in M} Vt  likes F(likes) = { <x,y> : x likes y in M } Conj  and, or F(and) = {<true, true>}, F(or) = {<true, true>, <true,false>, <false,true>} Neg  it is not… F(iintct) = {false}

What we have We have created a little fragment describing a (very small) subset of English, generating structural descriptions of syntactically valid sentences and providing the means to determine the truth conditions of these sentences. We did this by formulating a set of syntactic rewrite rules, each accompanied by a semantic rule of interpretation, such that every syntactic step can be interpreted compositionally.

One step more general Looking over the rules that we have, there are basically just two kinds: [S N VP]M = true iff [N]M  [VP]M [S S ConjP]M = true iff [S]M  [ConjP]M [S Neg S]M = true iff [S]M  [Neg]M [VP Vt N]M = {x: <x,[N]M>  [Vt]M } [ConjP Conj S]M = {x: <x,[S]M>  [Conj]M } More generally: [A B]M = true iff [A]M  [B]M (where [B]M is a set of [A]M-type things) [A B]M = {x: <x,[A]M>}  [B]M (where [B]M is a set of pairs, the second member being an [A]M-type thing) [ [A] ]M = [A]M This will cover our other rules… and make it easier to extend our syntax as well.

One step further…? If we have these rules: [A B]M = true iff [A]M  [B]M (where [B]M is a set of [A]M-type things) [A B]M = {x: <x,[A]M>  [B]M } (where [B]M is a set of pairs, the second member being an [A]M-type thing) [ [A] ]M = [A]M It still feels as if the first two rules are kind of the same, perhaps the first is a “special case” of the second. But it’s not obvious exactly how to formulate one rule that will apply to both situations. Suppose that the second rule is the more general, and we want to subsume the first rule into the second. What would need to happen? The first rule applies to properties: For example VP and N under S, where [A]M is the denotation of N, and [B]M is the denotation of VP.

An option… If we have these rules: [A B]M = true iff [A]M  [B]M (where [B]M is a set of [A]M-type things) [A B]M = {x: <x,[A]M>  [B]M } (where [B]M is a set of pairs, the second member being an [A]M-type thing) [ [A] ]M = [A]M So what would we need to do for properties like VP applied to N to fit the description of the second rule? We would need to think of properties also as being sets of pairs. Sure, ok. Suppose F(is boring) is something like this (in some particular model): F(is boring) = {<true, Bond>, <false, Loren>, <true, Pavarotti>} Or in general, F(is boring) = {<x,y>: y is an individual in U, and x is true if y is boring in M, false otherwise} Then, if we combine is boring with Bond, we can use the second rule, and, in that same particular model, get {true}.

An option… If we have these rules: [A B]M = true iff [A]M  [B]M (where [B]M is a set of [A]M-type things) [A B]M = {x: <x,[A]M>  [B]M } (where [B]M is a set of pairs, the second member being an [A]M-type thing) [ [A] ]M = [A]M If we end up with {true} for Bond is boring, we still don’t exactly have a truth value. But we can simply stipulate that if the semantic value of a sentence is {true}, the sentence is true, and if it is {false} the sentence is false. We would also need to redefine transitive verbs, such as like. They should be pairs so that when the second rule applies to the pair, it results in a set of pairs (of the same sort is boring was). So, if we used to think of likes as {<Bond, Loren>, <Loren, Pavarotti>}, we would now need to think of it as: F(likes) = {<<true,Bond>,Loren>, <<false,Bond>,Pavarotti>, …}

An option… Trying to just get by with these rules: [A B]M = {x: <x,[A]M>  [B]M } (where [B]M is a set of pairs, the second member being an [A]M-type thing) [ [A] ]M = [A]M So, if we used to think of likes as {<Bond, Loren>, <Loren, Pavarotti>}, we would now need to think of it as: F(likes) = {<<true,Bond>,Loren>, <<false,Bond>,Pavarotti>, …} The way this works is we combine likes and Loren, say, using the rule above, which will pick out a set of all the things that are paired with Loren: [likes Loren]M = {x: <x,[Loren]M>  [likes]M} = {x: <x,F(Loren)>  F(likes)} = {x: <x,Loren>  {<<true,Bond>,Loren>, <<false,Bond>,Pavarotti>, …}} = {<true, Bond>, <false, Pavarotti>, <false, Loren>} And then combine likes Loren with Bond, which will pick out all the things that are paired with Bond: [Bond likes-Loren]M = {x: <x,[Bond]M>  [likes-Loren]M} = {x: <x,F(Bond)>  {<true, Bond>, <false, Pavarotti>, <false, Loren>}} = {x: <x,Bond>  {<true, Bond>, <false, Pavarotti>, <false, Loren>}} = {true} And by our stipulation, this means the sentence is true.

Win some and lose some? That’s great! Two rules for the semantics: one for combinations, and one trivial one for single-branches. Except it’s now much less intuitive and it’s harder to write. It seems to work, but is it progress? Answer: Yes, but we need to make it more intuitive and easier to write. So, let’s think about our one (substantive) semantic rule. What does it actually do?

Collecting things paired with… Here is our rule. [A B]M = {x: <x,[A]M>  [B]M } In plain English, combining a set of pairs with an element x gives us the set of things that are paired with x. But suppose we instead think of [B]M above as a little box that accepts an element x and returns a set of things. The set of pairs we attributed to it simply describe the box’s behavior. E.g., give it Bond, it’ll give you {true}.

The little box Here’s a picture of the little box. Let’s call it f. We can think of it as a mapping from an input to an output. Oh, right. Yes. It’s a function. We can describe the behavior of the function by listing explicitly (as pairs of outputs and inputs) what it does, or we could state what it does to an input to form the output (e.g., f(n) = 2+n). f input output

Functions We have several way to write a function. Suppose we want to write the not function that reverses a truth value. So, a truth value is provided as an input and a truth value is returned as an output. fnot is a function that, for any x{true,false}, returns x. We can also write the mapping explicitly, using ordered pairs of the form <output, input>: fnot = {<true, false>, <false, true>} Or, we can write in the form input[output]: fnot = x[x]. Side note: If writing the mapping explicitly in most contexts, the convention would be to write the pairs as <input,output>. Here I used <output,input> for compatibility with the semantic rule we developed the idea from, but the information content is the same, whichever way you write it (so long as you define which member of the pair is the input and which is the output).

How does this help? If we think about these in terms of functions, we can forget about the pairs and just concentrate on describing the functions. [is boring]M = the function f such that f(x)=true iff x is boring in M. This function takes individuals as input. We’ll say these are type <e>. It gives truth values as an output, which we’ll say are type <t>. We can talk about the type of function [is boring] is as <e,t>: takes an <e>, returns a <t>.

Enter the l The standard way to describe functions like this in semantics is using lambda notation. The structure of a function written in lambda notation is:  argument [ return value ] So, for [is boring]M, we can write this:  x [ x is boring in M ] This is the function such that, given an individual x, returns true if x is boring in M and false otherwise. We are now changing F somewhat. F(is boring) will no longer the set of boring individuals in M, but rather the function that is true of all and only the boring individuals in M. (The “characteristic function” of the set)

 argument [ return value ]  x [ x is boring in M ] The idea here is that x is boring in M is either true (if x is boring in M) or false (if x is not boring in M), and so whatever truth value x is boring in M has will be what this function returns. This is a function of type <e,t>.

 argument [ return value ] Change-machine($n-bill) = 4  n quarters. Change-machine =  $n-bill [ 4  n quarters ] Square =  n [ n  n ] Not very complicated, just a short way to write “that function f such that, given argument, returns return value.”

 argument [ return value ](value) Square =  n [ n  n ] Square(3) = 3  3 = 9 Square(4) = 4  4 = 16. To evaluate a function given a value, we take the value and substitute it in for the argument within the return value. If we give it a 3, and the argument is n, then we replace all of the ns with 3s and evaluate the return value. Known as “lambda conversion.”

 argument [ return value ](value) One last piece of terminology: Instances of argument within return value are said to be variables that bound by the lambda operator. Triple =  n [ 3  n ] Lambda operator Bound variable

Back to likes… In F1, the value of F(likes) was a set of pairs (the likers paired with the likees for a given model). In the intermediate version we developed above, the value of F(likes) was more complex: A set of pairs, one member of each pair being a pair itself. F(likes) = {<<true,Bond>,Loren>, …} This was because we wanted the set of things paired with the object to be a set of pairs itself—a property (of being a Bond-liker), just like is boring. But pairs define the behavior of a function. In terms of functions, we want F(likes) to be a function that returns a function.

Functions returning functions With the help of , we can easily describe the function we want likes to return. F(likes) = y[x[x likes y in M]] So give likes Bond: y[x[x likes y in M]](Bond) The return value is the function x[x likes y in M]. Lambda conversion: Change all ys in the return value to Bond: x[x likes Bond in M] And this is the property of being a Bond-liker. Give it an individual, and it will return true if that individual likes Bond and false otherwise. x[x likes Bond in M](Loren) = Loren likes Bond in M After lambda conversion, this is either true or it’s false.

What this buys us Defining things in terms of functions allows us to reduce our semantic rules to the following (the official rules of F2): Functional application: [a b]M = [a]M([b]M) or [b]M([a]M), whichever is defined. Pass up: [b a]M = [a]M We will also redefine the verbs as functions instead of sets (of pairs), and the overall system will wind up simpler (and I think more comprehensible) than it was with sets.

[S N VP]M = true iff [N]M  [VP]M, otherwise false S  S Conj S [S S1 Conj S2]M = [Conj]M ( < [S1]M, [S2]M > ) S  Neg S [S Neg S´]M = [Neg]M ( [S´]M ). VP  Vt N [VP Vt N]M = {x : < x, [N]M >  [Vt]M } VP  Vi N  Pavarotti, … [Pavarotti]M = F(Pavarotti) Vi  is boring, … [is boring]M = {x: x is boring in M} Vt  likes [likes]M = { <x,y> : x likes y in M } Conj  and, … [and]M = {<<true,true>,true>, <true,false>,false>, …} Neg  it is not the case that [iintct]M = {<true,false>, <false,true>}

Generalizing our semantics M=<U,F> [Bond]M = F(Bond) = Bond Type: <e> [is hungry]M = F(is hungry) = the function f such that, given an individual x, it returns true if x is hungry in M, false otherwise. x[x is hungry in M] Type: <e,t> N VP Bond Vi Bond is hungry The function f such that, given an individual x, it returns true if x is hungry in M, false otherwise

Generalizing our semantics Pass-Up: [b a]M = [a]M What this says is that if a node b contains nothing else but a node a, then the semantic value of b is going to be exactly the same as the semantic value of a. So [N]M = [Bond]M = Bond. [VP]M = [Vi]M = [is hungry]M. N VP Bond Vi Bond is hungry The function f such that, given an individual x, it returns true if x is hungry in M, false otherwise

Generalizing our semantics The function f such that, given an individual x, it returns true if x is hungry in M, false otherwise Bond S Functional application: [g a b ]M = [b]M ( [a]M ) or [a]M ( [b]M ) whichever is defined What this says if a node b contains two things, one being a function that takes the other as an argument, the result will be whatever the function returns given that argument. [N]M is type <e> [VP]M is type <e,t> So [S]M is type <t>. N VP Bond Vi Bond is hungry The function f such that, given an individual x, it returns true if x is hungry in M, false otherwise

Generalizing our semantics The function f such that, given an individual x, it returns true if x is hungry in M, false otherwise Bond Functional application: [g a b ]M = [b]M ( [a]M ) or [a]M ( [b]M ) whichever is defined [S]M = [S N VP]M = [VP]M ( [N]M ) [VP]M is the function such that given an individual x, it returns true if x is hungry in M, false otherwise. [N]M is the individual Bond. S N VP Bond Vi Bond is hungry The function f such that, given an individual x, it returns true if x is hungry in M, false otherwise

Generalizing our semantics The function f such that, given an individual x, it returns true if x is hungry in M, false otherwise Bond S Functional application: [g a b ]M = [b]M ( [a]M ) or [a]M ( [b]M ) whichever is defined [S]M = [S N VP]M = [VP]M([N]M) So, [S]M is true if Bond is hungry in M, false otherwise. N VP Bond Vi Bond is hungry The function f such that, given an individual x, it returns true if x is hungry in M, false otherwise

Like, totally. <t> <e,t> <e> S N VP Vt N Bond likes Transitive verbs, such as like, are ultimately relations between individuals. Yet, our syntax produces structures like this, where VP has only likes and Loren in it. We know that [S]M needs to be a truth value, it needs to be of type <t>. We know that [N]M is an individual (Bond), type <e>. Given the way Functional Application works, [VP]M needs to be a function of type <e,t>. S N VP Vt N Bond likes Loren

Like, totally. <t> <e,t> <e> S <e> N VP Vt N What we want [VP]M to be is a function that is true of all Loren-likers, such that the whole sentence will be true if Bond is a Loren-liker. So, what is [VP]M? Well, that too has two parts. We know that it needs to be of type <e,t>. We know that one component (N) is an individual of type <e>. So we need [Vt] to be something that takes an individual, type <e>, and returns a predicate, type <e,t>. That is, [Vt] must be type <e,<e,t>>. S <e> N VP Vt N Bond likes Loren

Like, totally. <t> <e,t> <e> S <e> N VP Vt N If [Vt] is of type <e,<e,t>>, it is a function that takes an individual and returns a function, specifically a function from individuals to truth values. The particular function we need it to return is the one that is true of Loren-likers. So, how do we write that? Well,  argument [ return value ] S <e> N VP Vt N Bond likes Loren <e,<e,t>>

Like, totally.  x [ x is a Loren-liker in M ] What we’re aiming for is something that will work out to:  x [ x is a Loren-liker in M ] But we want to derive x is a Loren-liker in M from like and Loren. (That is, from [Vt]M and [N]M). We know what [N]M is, it’s Loren. So, what’s [Vt]M ? [like]M =  y [  x [ x likes y in M ] ] S N VP Vt N Bond likes Loren

Like, totally. Bond [like]M =  y [  x [ x likes y in M ] ] That is, [like]M is the function that, given an individual y, returns the function that, given an individual x, is true if x likes y in M. So, what is [VP]M ? Well, it contains Vt and N, and [Vt]M is a function of type <e,<e,t>> that takes an argument of type <e>. [N]M is of type <e>. So, [VP]M = [Vt]M ( [N]M ). S Loren N VP Vt N Bond likes Loren  y [  x [ x likes y in M ] ]

Like, totally. Bond [like]M =  y [  x [ x likes y in M ] ] [VP]M = [Vt]M ( [N]M ) [VP]M = Loren  y [  x [ x likes y in M ] ] …and lambda conversion gives us… =  x [ x likes Loren in M ] S Loren N VP Vt N Bond likes Loren  y [  x [ x likes y in M ] ]

Like, totally.  x [ x likes Loren in M ] [VP]M =  x [ x likes Loren in M ] Then, we evaluate [S]M. It has two constituents, one a function of type <e,t>, the other an individual of type <e>. Apply Functional Application. [S]M = [VP]M ( [N]M ) = Bond  x [ x likes Loren in M ] = Bond likes Loren in M Bond S Loren N VP Vt N Bond likes Loren  y [  x [ x likes y in M ] ]

Generalized semantics We now have a relatively simple semantic theory. Each node in the (syntactic) structure has a semantic value. If the node has a sister, one of them is a function and one of them is an argument, and the semantic value of both together is whatever the function yields, given the argument (Functional Application). If a node has no sisters, its parent node just has the same semantic value (Pass-up). The semantic values of the lexical items reflects this structure. So the semantic value of names will be of type <e>, that of intransitive verbs will be of type <e,t>, that of transitive verbs will be of type <e,<e,t>>.

and [and]M =  y [  x [ x  y ] ] [ConjP]M = [Conj]M ( [S2]M ) =  y [  x [ x  y ] ] ( [S2]M ) =  x [ x  [S2]M ] [S]M = [ConjP]M ( [S1]M ) =  x [ x  [S2]M ] ( [S1]M ) = [S1]M  [S2]M S S1 ConjP Conj S2 and

F2 S  N VP Pass-Up: [b a]M = [a]M S  Neg S S  S ConjP ConjP  Conj S Functional application: [g a b ]M = [b]M ( [a]M ) or [a]M ( [b]M ) whichever is defined VP  Vt N VP  Vi N  Pavarotti, … [a]M = F(a) where a is a terminal node Vi  is boring, … [is boring]M =  x [ x is boring in M ] Vt  likes [likes]M =  y [  x [ x likes y in M] ] Conj  and, … [and]M =  y [  x [ x  y ] ] Neg  it is not the case that [iintct]M =  x [ x ] F2

       