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

Loading the axioms <strong>of</strong> people.pl, displayed <strong>on</strong> page 13 above, prolog will use these rules to establish c<strong>on</strong>sequences<br />

<strong>of</strong> the theory. We can ask prolog to prove that Frege is a mathematician by typing<br />

mathematician(frege). at the prolog prompt. Prolog will resp<strong>on</strong>d with yes. We can also use a variable<br />

to ask prolog what things X are mathematicians (or computers). If the loaded axioms do not entail that any X<br />

is a mathematician (or computer), prolog will say: no. If something can be proven to be a mathematician (or<br />

computer), prolog will show what it is. And after receiving <strong>on</strong>e answer, we can ask for other answers by typing<br />

asemi-col<strong>on</strong>:<br />

| ?- mathematician(X).<br />

X = frege ? ;<br />

X = hilbert ? ;<br />

X = turing ? ;<br />

X = m<strong>on</strong>tague ? ;<br />

no<br />

| ?- mathematician(fido).<br />

no<br />

Prolog establishes these claims just by finding substituti<strong>on</strong>s <strong>of</strong> terms for the variable X which make the goal<br />

identical to an axiom. So, in effect, a variable in a goal is existentially quantified. The goal ?-p(X) is, in effect,<br />

a request to prove that there is some X such that p(X). 5<br />

| ?- mathematician(X),linguist(X),piano_player(X).<br />

X = m<strong>on</strong>tague ? ;<br />

no<br />

| ?-<br />

We can display a pro<strong>of</strong> as follows, this time showing the clause and bindings used at each step:<br />

goal theory workspace<br />

?-human(X) , Γ ⊢ ?-human(X)<br />

?-human(X) , human(X ′ ):-mathematician(X ′ ) ⊢ ?-mathematician(X) {X ′ ↦ X}<br />

?-human(X) , mathematician(frege) ⊢ {X ↦ frege}<br />

5More precisely, the prolog pro<strong>of</strong> is a refutati<strong>on</strong> <strong>of</strong> ¬(∀X) p(X), and this is equivalent to an existential claim: ¬(∀X) p(X) ≡<br />

(∃X)¬p(X).<br />

17

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

Saved successfully!

Ooh no, something went wrong!