28.04.2013 Views

3.3 Teoria de la demostració - La Salle

3.3 Teoria de la demostració - La Salle

3.3 Teoria de la demostració - La Salle

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.

Exercici 3.4<br />

I<strong>de</strong>ntifiqueu en els següents conjunts <strong>de</strong> substitucions quin és un unificador més<br />

general i quin no (si n'hi ha algun que no ho sigui) i <strong>de</strong>mostreu-ho tot seguint <strong>la</strong><br />

<strong>de</strong>finició. d'unif. més general.<br />

a) σ 1 = {X/Y, f(a,g(b,h(X,a,c)))/Z} σ 2 = {Y/X, f(a,g(b,h(Y,a,c)))/Z}, que unifiquen els<br />

predicats { P(X, f(a,g(b,h(X,a,c)))) , P(Y, f(a,g(b,h(X,a,c)))) }<br />

Tots dos són unificadors més generals.<br />

b) σ 1 = {a/X, f(a,b,g(T))/Y, g(f(a,b,c)/Z} σ 2 = {a/X, f(a,b,g(f(a,b,c)))/Y,g(f(a,b,c)/Z,<br />

f(a,b,c)/T}, que unifiquen els predicats {P(a,f(a,b,g(T)),Z), P(X,Y, g(f(a,b,c)))}<br />

σ1 és un unificador més general i σ2 un unificador qualsevol.<br />

σ2 = { a/X, f(a,b,g(T))/Y, g(f(a,b,c)/Z} º { f(a,b,c)/T) } = { a/X, f(a,b,g(f(a,b,c)))/Y,<br />

g(f(a,b,c)/Z, f(a,b,c)/T }}<br />

Exercici 3.5<br />

Quins <strong>de</strong>ls següents conjunts <strong>de</strong> clàusules són unificables? Si ho són, doneu un<br />

unificador més general i un que no ho sigui. Utilitzeu l'algorisme d'unificació <strong>de</strong><br />

Robinson per a trobar un unificador més general.<br />

a){ Q(a,X), Q(a,a) }<br />

És unificable.<br />

σ1= { a/X } no hi ha un unificador que no sigui general<br />

b){ Q(a,X,f(X)), Q(a,Y,Y) }<br />

No és unificable perquè substituiríem una variable per una funció en què <strong>la</strong><br />

variable ocorre dins <strong>la</strong> funció.<br />

c) { Q(X,Y,Z), Q(U,h(V,V),U) }<br />

És unificable.<br />

σ1= { U/X, h(V,V)/Y, U/Z } és un unificador més general.<br />

σ2= { U/X, h(a,a)/Y, U/Z, a/V} no és un unificador més general.<br />

d) { P(a,X,h(g(Z)), P(Z,f(X),h(a)) }<br />

No és unificable perquè substituiríem una variable per una funció en què <strong>la</strong><br />

variable ocorre dins <strong>la</strong> funció.<br />

e) { Pare(X,Y), Pare(fill(jordi,anna),jordi) }<br />

És unificable.<br />

σ1= { fill(jordi,anna)/X, jordi/Y } no hi ha un unificador que no sigui general<br />

f) { P(X,g(Y),Z,h(Y,Z),W,k(X,Y,W)), P(R,S,e(S),T,f(S,T),U) }<br />

És unificable.<br />

σ1= { R/X, g(Y)/S, e(g(Y))/Z, h(Y,e(g(Y)))/T, f(g(Y),h(Y,e(g(Y))))/W,<br />

k(R,Y,f(g(Y),h(Y,e(g(Y))))))/U } és un unificador més general.<br />

g) { P(X,g(X,f(a,b),Z)), P(Z,g(f(a,b),X,Z)) }<br />

És unificable.<br />

180

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

Saved successfully!

Ooh no, something went wrong!