20.07.2013 Views

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

SHOW MORE
SHOW LESS

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 />

L0 and L1 is L2. These two axioms entail that there is a list L which is the result <strong>of</strong> appending [the,cat,is]<br />

with [<strong>on</strong>,the,mat]. 9 Prolog can prove this fact:<br />

| ?- append([the,cat,is],[<strong>on</strong>,the,mat],L).<br />

L = [the,cat,is,<strong>on</strong>,the,mat] ? ;<br />

no<br />

The pro<strong>of</strong> <strong>of</strong> the goal,<br />

append([the,cat,is],[<strong>on</strong>,the,mat],[the,cat,is,<strong>on</strong>,the,mat])<br />

can be depicted by the following pro<strong>of</strong> tree:<br />

append([the,cat,is],[<strong>on</strong>,the,mat],[the,cat,is,<strong>on</strong>,the,mat])<br />

append([cat,is],[<strong>on</strong>,the,mat],[cat,is,<strong>on</strong>,the,mat])<br />

append([is],[<strong>on</strong>,the,mat],[is,<strong>on</strong>,the,mat])<br />

append([],[<strong>on</strong>,the,mat],[<strong>on</strong>,the,mat])<br />

This axiomatizati<strong>on</strong> <strong>of</strong> append behaves nicely <strong>on</strong> a wide range <strong>of</strong> problems. It correctly rejects<br />

| ?- append([the,cat,is],[<strong>on</strong>,the,mat],[]).<br />

no<br />

| ?- append([the,cat,is],[<strong>on</strong>,the,mat],[the,cat,is,<strong>on</strong>,the]).<br />

no<br />

We can also use it to split a list:<br />

| ?- append(L0,L1,[the,cat,is,<strong>on</strong>,the,mat]).<br />

L0 = []<br />

L1 = [the,cat,is,<strong>on</strong>,the,mat] ? ;<br />

L0 = [the]<br />

L1 = [cat,is,<strong>on</strong>,the,mat] ? ;<br />

L0 = [the,cat]<br />

L1 = [is,<strong>on</strong>,the,mat] ? ;<br />

L0 = [the,cat,is]<br />

L1 = [<strong>on</strong>,the,mat] ? ;<br />

L0 = [the,cat,is,<strong>on</strong>]<br />

L1 = [the,mat] ? ;<br />

L0 = [the,cat,is,<strong>on</strong>,the]<br />

L1 = [mat] ? ;<br />

L0 = [the,cat,is,<strong>on</strong>,the,mat]<br />

L1 = [] ? ;<br />

no<br />

9 Using the successor functi<strong>on</strong> s and 0 to represent the numbers, so that s(0)=1, s(s(0))=2,…, notice how similar the definiti<strong>on</strong> <strong>of</strong><br />

append is to the following formulati<strong>on</strong> <strong>of</strong> Peano’s axioms for the sum relati<strong>on</strong>:<br />

sum(0,N,N).<br />

sum(s(N0),N1,s(N2)) :- sum(N0,N1,N2).<br />

20

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!