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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Stabler - Lx 185/209 2003<br />

(8) Pitfall 1: Prolog’s pro<strong>of</strong> method is not an algorithm, hence not a decisi<strong>on</strong> method. This is the case<br />

because the search for a pro<strong>of</strong> can fail to terminate. There are cases where G, Γ ⊢ A and G, Γ ⊨ A, but<br />

prolog will not find the pro<strong>of</strong> because it gets caught in “infinite recursi<strong>on</strong>.”<br />

Infinite recursi<strong>on</strong> can occur when, in the course <strong>of</strong> proving some goal, we reach a point where we are<br />

attempting to establish that same goal. C<strong>on</strong>sider how prolog would try to prove p given the axioms:<br />

p :- p.<br />

p.<br />

Prolog will use the first axiom first, each time it tries to prove p, and this procedure will never terminate.<br />

We have the same problem with<br />

p :- p, q.<br />

p.<br />

q.<br />

And also with<br />

p :- q, p.<br />

p.<br />

q.<br />

This problem is sometimes called the “left recursi<strong>on</strong>” problem, but these examples show that the problem<br />

results whenever a pro<strong>of</strong> <strong>of</strong> some goal involves proving that same goal. We will c<strong>on</strong>sider this<br />

problem more carefully when it arises in parsing.<br />

Prolog was designed this way for these simple practical reas<strong>on</strong>s:<br />

(i) it is fairly easy to choose problems for which Prolog does terminate, and<br />

(ii) the method described above allows very fast executi<strong>on</strong>!<br />

8

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

Saved successfully!

Ooh no, something went wrong!