10.06.2013 Views

Logica Matematica Corso di Laurea in Informatica ... - Mbox.dmi.unict.it

Logica Matematica Corso di Laurea in Informatica ... - Mbox.dmi.unict.it

Logica Matematica Corso di Laurea in Informatica ... - Mbox.dmi.unict.it

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.

8.4. PROGRAMMAZIONE LOGICA 183<br />

8.4 Programmazione logica<br />

Esempio 8.4.1. Sia data la seguente storia: Giovanni ama Maria? Se uno si<br />

emoziona quando guarda una ragazza, allora si può <strong>di</strong>re che l’ama. Giovanni<br />

si emoziona se sta vic<strong>in</strong>o a Maria e Maria sorride. Uno sorride quando è<br />

contento. Se a uno fanno un regalo che gli piace, questi è contento. A Maria<br />

piaccioni i <strong>di</strong>schi <strong>di</strong> Baglioni. Giovanni regala a Maria un <strong>di</strong>sco <strong>di</strong> Baglioni e<br />

sta sempre vic<strong>in</strong>o a Maria e non le toglie gli occhi <strong>di</strong> dosso.<br />

Con una opportuna semplificazione e formalizzazione, la storia può essere<br />

resa dalla congiunzione dei seguenti enunciati:<br />

∀x∀y(G(x, y) ∧ E(x) → (R(y) → A(x, y)))<br />

R(m)<br />

V (g, m) ∧ S(m) → E(g)<br />

∀x(C(x) → S(x))<br />

∀x∀z(∃y(R(x, y, z) ∧ P (y, z)) → C(z))<br />

∀x(D(x) → P (x, m))<br />

∃x(D(x) ∧ R(g, x, m))<br />

V (g, m)<br />

V (g, m) → G(g, m),<br />

ovvero <strong>in</strong> forma <strong>di</strong> clausole:<br />

con il goal<br />

1 A(x, y) ← R(y), G(x, y), E(y)<br />

2 R(m) ←<br />

3 E(g) ← V (g, m), S(m)<br />

4 S(z) ← C(z)<br />

5 C(w) ← R(u, v, w), P (v, w)<br />

6 P (j, m) ← D(j)<br />

7 D(d) ←<br />

8 R(g, d, m) ←<br />

9 V (g, m) ←<br />

10 G(g, m) ← V (g, m),<br />

11 ← A(g, m),

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

Saved successfully!

Ooh no, something went wrong!