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

That is, to compute ηθ, first apply θ to the terms <strong>of</strong> η and then add θ itself, and finally remove any <strong>of</strong> the<br />

θ variables that are also η variables and remove any substituti<strong>on</strong>s <strong>of</strong> variables for themselves. Clearly, with<br />

this definiti<strong>on</strong>, every compositi<strong>on</strong> <strong>of</strong> substituti<strong>on</strong>s will itself satisfy the c<strong>on</strong>diti<strong>on</strong>s for being a substituti<strong>on</strong>.<br />

Furthermore, since the compositi<strong>on</strong> ηθ just applies θ to η, A(ηθ) = (Aη)θ for any expressi<strong>on</strong> A.<br />

Example 1. Let<br />

Then<br />

And, <strong>on</strong> the other hand,<br />

η ={X1 ↦ Y1,X2 ↦ Y2}<br />

θ ={Y1 ↦ a1,Y2 ↦ a2}.<br />

ηθ ={X1 ↦ a1,X2 ↦ a2,Y1 ↦ a1,Y2 ↦ a2}.<br />

θη ={Y1 ↦ a1,Y2 ↦ a2,X1 ↦ Y1,X2 ↦ Y2}<br />

Since ηθ = θη, we see that compositi<strong>on</strong> is thus not commutative, although it is associative.<br />

Example 2. Let<br />

η ={X1 ↦ Y1}<br />

θ ={Y1 ↦ X1}.<br />

Then although neither η nor θ is empty, ηθ = θ and θη = η.<br />

Example 3. Let<br />

η ={}<br />

θ ={Y1 ↦ X1}.<br />

Then ηθ = θη = θ.<br />

This empty substituti<strong>on</strong> η ={}is called an “identity element” for the compositi<strong>on</strong> operati<strong>on</strong>. 3<br />

Now we are ready to present a procedure for unifying two expressi<strong>on</strong>s E and F to produce a (most general)<br />

unifier mgu(E, F).<br />

Unificati<strong>on</strong> algorithm:<br />

1. Put k = 0andσ0 ={}.<br />

2. If Eσk = Fσk, stop. σk is a mgu <strong>of</strong> S. Otherwise, compare Eσk and Fσk from left to right to find the<br />

first symbol at which they differ. Select the subexpressi<strong>on</strong> E ′ <strong>of</strong> E that begins with that symbol, and the<br />

subexpressi<strong>on</strong> F ′ <strong>of</strong> F that begins with that symbol.<br />

3. If <strong>on</strong>e <strong>of</strong> E ′ ,F ′ is a variable V and <strong>on</strong>e is a term t, andifVdoes not occur as a (strict) subc<strong>on</strong>stituent <strong>of</strong><br />

t, putσk+1 = σk{V ↦ t}, increment k to k + 1, and return to step 2. Otherwise stop, S is not unifiable.<br />

The algorithm produces a most general unifier which is unique up to a renaming <strong>of</strong> variables, otherwise it<br />

terminates and returns the judgment that the expressi<strong>on</strong>s are not unifiable. 4<br />

Now we are ready to define predicate prolog. All clauses and goals are universally closed, so the language,<br />

inference method, and semantics are fairly simple.<br />

3 In algebra, when we have a binary associative operati<strong>on</strong> <strong>on</strong> a set with an identity element, we say we have a m<strong>on</strong>oid. Sotheset<strong>of</strong><br />

substituti<strong>on</strong>s, the operati<strong>on</strong> <strong>of</strong> compositi<strong>on</strong>, and the empty substituti<strong>on</strong> form a m<strong>on</strong>oid. Another m<strong>on</strong>oid we will discuss below is given<br />

by the set <strong>of</strong> sequences <strong>of</strong> words, the operati<strong>on</strong> <strong>of</strong> appending these sequences, and the empty sequence.<br />

4 Our presentati<strong>on</strong> <strong>of</strong> the unificati<strong>on</strong> algorithm is based <strong>on</strong> Lloyd (1987), and this result about the algorithm is established as Lloyd’s<br />

Theorem 4.3. The result also appears in the classic source, Robins<strong>on</strong> (1965).<br />

15

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

Saved successfully!

Ooh no, something went wrong!