Truth in Model

We have looked at the syntax of first-order logic, and in Section 10.4 we will examine the task of translating English into first-order logic. Yet as we argued in Section 10.1, this gets us further forward only if we can give a meaning to sentences of first-order logic. In other words, we need to give a truth-conditional semantics to first-order logic. From the point of view of computational semantics, there are obvious limits to how far one can push this approach. Although we want to talk about sentences being true or false in situations, we only have the means of representing situations in the computer in a symbolic manner. Despite this limitation, it is still possible to gain a clearer picture of truth-conditional semantics by encoding models in NLTK.

Given a first-order logic language L, a model M for L is a pair (D, Val), where D is an non-empty set called the domain of the model, and Val is a function called the valuation function, which assigns values from D to expressions of L as follows:

1. For every individual constant c in L, Val(c) is an element of D.

2. For every predicate symbol P of arity n 2: 0, Val(P) is a function from Dn to {True, False}. (If the arity of P is 0, then Val(P) is simply a truth value, and P is regarded as a propositional symbol.)

According to 2, if P is of arity 2, then Val(P) will be a function f from pairs of elements of D to {True, False}. In the models we shall build in NLTK, we'll adopt a more convenient alternative, in which Val(P) is a set S of pairs, defined as follows:

Such an f is called the characteristic function of S (as discussed in the further readings).

Relations are represented semantically in NLTK in the standard set-theoretic way: as sets of tuples. For example, let's suppose we have a domain of discourse consisting of the individuals Bertie, Olive, and Cyril, where Bertie is a boy, Olive is a girl, and Cyril is a dog. For mnemonic reasons, we use b, o, and c as the corresponding labels in the model. We can declare the domain as follows: >>> dom = set(['b', 'o', 'c'])

We will use the utility function parse_valuation() to convert a sequence of strings of the form symbol => value into a Valuation object.

>>> val = nltk.parse_valuation(v) >>> print val {'bertie': 'b', 'boy': set([('b',)]), 'cyril': 'c', 'dog': set([('c',)]), 'girl': set([('o',)]), 'olive': 'o',

'see': set([('o', 'c'), ('c', 'b'), ('b', 'o')]), 'walk': set([('c',), ('o',)])}

So according to this valuation, the value of see is a set of tuples such that Bertie sees Olive, Cyril sees Bertie, and Olive sees Cyril.

Your Turn: Draw a picture of the domain dom and the sets corresponding to each of the unary predicates, by analogy with the diagram shown in Figure 10-2.

You may have noticed that our unary predicates (i.e, boy, girl, dog) also come out as sets of singleton tuples, rather than just sets of individuals. This is a convenience which allows us to have a uniform treatment of relations of any arity. A predication of the form P(Tj, ... Tn), where P is of arity n, comes out true just in case the tuple of values corresponding to (Tj, ... Tn) belongs to the set of tuples in the value of P.

Was this article helpful?

0 0

Post a comment