Hi. I’m Chris Potts. This screencast is the first of three discussing
our compositional semantic grammar. This screencast covers some technical preliminaries
relating to functions — notation for them, how they work, and how
we use them to model linguistic meaning. The second screencast introduces a semantic
lexicon, and the third introduces the grammar itself. To start, let’s just establish some ways of
talking about functions. This is a sort of bracket notation. The inputs are listed on the left. The outputs are on the right. And the arrows show how the inputs and outputs
are connected. Intuitively, for this domain, this could be called the child function, since the three children map to true, and the one adult maps to false. This second version is more familiar from
programming. We’re looking at the function called ‘CHILD’. It has one argument, given here as x. If the argument is a member of the set of
children, we return true, otherwise we return false. This third view of the child function is the
one we’ll work with the most. It uses some of the notation from lambda calculus
to identify the function. The “lambda x” part says that this function
is looking for a single entity argument. Once it has that argument, it behaves just
like the others, returning T, or true, if the argument is in
the set of children, otherwise F, that is, false. It’s really useful in thinking about our grammar to be able to relate sets to functions in
systematic ways. The notion of a ‘characteristic set’ gets
us from functions to sets. Here we have a function, mapping Maggie, Lisa,
and Homer to true, and Bart to false. To create the characteristic set, we identify the arguments that map to true
for the function, and simply assemble the corresponding entities
into a set. They don’t actually leave the function, of
course, so let’s put them back. This gives us the characteristic set of the
function we began with. We can go in the reverse direction as well. That’s what the notion of a characteristic
function gives us. To do this, though, we need to know what the
universe is — more precisely, what the domain of the
function is. So, for this example, let’s assume that the
domain is this set U of Simpsons. We start with this set containing just Lisa,
Bart, and Maggie. To create the characteristic function, we map all those entities to true. And here’s where we need to know the domain
of the function. For all of the entities in the domain that
aren’t in the original set, here just Homer, we need to map them to false to complete the
function. This finally gives us the full characteristic
function of the set we began with. And of course this set is the characteristic
set of the function we created. So we have a correspondence in both directions. A word of caution is in order here. It’s important to do these conversions *absolutely
mindlessly*. The biggest gotcha is that people mess around
with the inputs and outputs. For instance, suppose we start with this function. It happens to have sets and entities in its
domain, as you can see here. So when you go to create the characteristic
set, you need to just collect the inputs that map
to T, and put them into a set, like this: What you absolutely do not want to do is “reach
inside” the inputs to create this set. This is *not* the characteristic set of the
original function. The original function doesn’t even have a
or b in its domain. You’ll avoid this mistake if you think very
mechanically about the inputs. Okay, our final technical preliminary is function
application. This is where we actually start to perform
computations with our functions. Let’s start with this function. I guess it could be the “goes to school” function
for our small domain, since it maps Lisa and Bart to true and Maggie
and Homer to false. The notation for function application puts
the argument, here Maggie, in parentheses to the right.has To figure out what this expression picks out, we intuitively look up Maggie in the domain find that she maps to the false value, and that tells us what the final meaning of
the expression is. Or, from another perspective, we applied the function to the argument Maggie
to obtain the value F, or false. Using programming-style notation, here’s the CHILD function we saw before, and if we apply the function the Homer, we get something that evaluates to the expression
F. The concepts are the same when we use lambda
expressions. Here’s the child function given as a lambda
expression, now with Lisa as the argument, in blue parentheses
at the right. To calculate the value, we get rid of the outer “lambda x”, since we are filling that argument slot. I like to imagine the argument Lisa crashing
through and destroying it. And then we substitute Lisa wherever there
was an x variable in the body of the expression. Now we’re essentially just evaluating this
assertion of set membership. Since Lisa is in this set, we get the value
T in the end. Here’s a summary of the entire computation. With these concepts established, we’re now well-positioned to define our semantic
lexicon, and build an effective semantic grammar.