Resolution_Part_4

# Resolution_Part_4 - Unification vs. Matching Are p(X) and...

This preview shows pages 1–3. Sign up to view the full content.

Unification vs. Matching Are p(X) and p(f(X)) unifiable? e=[X/f(X)] X=f(f(f(f(f(. .... ?! This is not allowed in unification. Proper unification requires occurs check: a variable X can not be substituted by a term t if X occur in t. This is not done in Prolog’s matching for efficiency reasons. Therefore it is referred to as ‘matching’ in Prolog, and not ‘unification’. York University- CSE 3401 22 04_Resolution

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Given two clauses in the form: A 0 ..A i ..A m :-B 1 ...B n . and C 1 ...C k :- D 1 ..D j ..D l . If e is a unifier of A i and D j (i.e. e(A i )=e(D j )) Then the resolvent of the above two clauses is: e(A 0 ).. e(A i-1 )e(A i+1 ).. e(A m ) e(C 1 )..e(C k ) :- e(B 1 ).. e(B n ) e(D 1 ).. e(D j-1 )e(D j+1 ).. e(D l ). Example: C 1 : p(Y):- r(X, Y), q(Y, Z). C 2 : :- p(f(1)). Unifier of p( f(1) ) and p( Y ): e=[Y/f(1)] The resolvent of C 1 and C 2 : :- r( X, f(1) ), q( f(1), Z ). York University- CSE 3401
This is the end of the preview. Sign up to access the rest of the document.

## Resolution_Part_4 - Unification vs. Matching Are p(X) and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online