Notes on computational linguistics.pdf - UCLA Department of ...
Notes on computational linguistics.pdf - UCLA Department of ...
Notes on computational linguistics.pdf - UCLA Department of ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Stabler - Lx 185/209 2003<br />
1.5 Predicate Prolog<br />
Predicate prolog allows predicates that take <strong>on</strong>e or more arguments, and it also gives a first glimpse <strong>of</strong> expressi<strong>on</strong>s<br />
that depend <strong>on</strong> “c<strong>on</strong>text” for their interpretati<strong>on</strong>. For example, we could have a 1-place predicate<br />
mathematician which may be true <strong>of</strong> various individuals that have different names, as in the following axioms:<br />
/*<br />
* file: people.pl<br />
*/<br />
mathematician(frege).<br />
mathematician(hilbert).<br />
mathematician(turing).<br />
mathematician(m<strong>on</strong>tague).<br />
linguist(frege).<br />
linguist(m<strong>on</strong>tague).<br />
linguist(chomsky).<br />
linguist(bresnan).<br />
president(bush).<br />
president(clint<strong>on</strong>).<br />
sax_player(clint<strong>on</strong>).<br />
piano_player(m<strong>on</strong>tague).<br />
And using an initial uppercase letter or underscore to distinguish variables, we have expressi<strong>on</strong>s like<br />
human(X) that have a truth value <strong>on</strong>ly relative to a “c<strong>on</strong>text” – an assignment <strong>of</strong> an individual to the variable.<br />
In prolog, the variables <strong>of</strong> each definite clause are implicitly bound by universal quantifiers:<br />
human(X) :- mathematician(X).<br />
human(X) :- linguist(X).<br />
human(X) :- sax_player(X).<br />
human(X) :- piano_player(X).<br />
sum(0,X,X).<br />
sum(s(X),Y,s(Z)) :- sum(X,Y,Z).<br />
self_identical(X).<br />
socrates_is_mortal.<br />
In this theory, we see 9 different predicates. Like 0-place predicates (=propositi<strong>on</strong>s), these predicates all begin<br />
with lower case letters.<br />
Besides predicates, a theory may c<strong>on</strong>tain terms, where a term is a variable, a name, or a functi<strong>on</strong> expressi<strong>on</strong><br />
that combines with some appropriate number <strong>of</strong> terms. Variables are distinguished by beginning with an<br />
uppercase letter or an underscore. The theory above c<strong>on</strong>tains <strong>on</strong>ly the <strong>on</strong>e variable X. Each axiom has all <strong>of</strong> its<br />
variables “universally bound.” So for example, the axiom self_identical(X) says: for all X, X is identical to<br />
itself. And the axiom before that <strong>on</strong>e says: for all X, X is human if X is a piano player.<br />
In this theory we see nine different names, which are either numerals or else begin with lower case letters:<br />
frege, hilbert, turing, m<strong>on</strong>tague, chomsky, bresnan, bush, clint<strong>on</strong>, 0. Anamecanberegarded<br />
as a 0-place functi<strong>on</strong> symbol. That is, it takes 0 arguments to yield an individual as its value.<br />
In this theory we have <strong>on</strong>e functi<strong>on</strong> symbol that takes arguments: the functi<strong>on</strong> symbol s appears in the two<br />
axioms for sum. These are Peano’s famous axioms for the sum relati<strong>on</strong>. The first <strong>of</strong> these axioms says that, for<br />
all X, thesum<strong>of</strong>0and X is X. The sec<strong>on</strong>d says that, for all X, Y and Z, the sum <strong>of</strong> the successor <strong>of</strong> X and Y is<br />
the successor <strong>of</strong> Z where Z is the sum <strong>of</strong> X and Y. Sothesymbolsstands for the successor functi<strong>on</strong>. This is the<br />
functi<strong>on</strong> which just adds <strong>on</strong>e to its argument. So the successor <strong>of</strong> 0 is 1, s(0)=1, s(s(0))=2, ….Inthisway,<br />
the successor functi<strong>on</strong> symbol takes 1 argument to yield an individual as its value. With this interpretati<strong>on</strong><br />
<strong>of</strong> the symbol s, the two axioms for sum are correct. Remarkably, they are also the <strong>on</strong>ly axioms we need to<br />
13