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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

124 CAPITOLO 5. CALCOLO DELLA RISOLUZIONE<br />

Esercizio 5.2.9. Trovare una <strong>in</strong>put-refutazione dell’<strong>in</strong>sieme S = {¬p ∨ ¬q ∨<br />

¬r, ¬p ∨ ¬q ∨ r, q ∨ ¬u, u ∨ ¬p, p}.<br />

Trovare una <strong>in</strong>put-refutazione dell’<strong>in</strong>sieme S = {p∨q∨r, ¬r∨p∨q, ¬q∨p, ¬p}<br />

con top p ∨ q ∨ r e spiegare perché è preve<strong>di</strong>bile che esista.<br />

Esercizio 5.2.10. Trovare tutte le <strong>in</strong>put-refutazioni dell’<strong>in</strong>sieme S = {¬p ∨<br />

¬q ∨ ¬r, ¬p ∨ r ∨ ¬q, q ∨ ¬r, r ∨ ¬p, ¬q ∨ ¬r, p} e rappresentarle con gli alberi<br />

<strong>di</strong> tutte le <strong>in</strong>put-derivazioni con top fissato.<br />

Esercizio 5.2.11. Riscrivere gli <strong>in</strong>siemi <strong>di</strong> clausole <strong>di</strong> Horn dei precedenti<br />

esercizi nella notazione della programmazione logica e svolgerli nella forma<br />

<strong>di</strong> <strong>in</strong>terrogazioni <strong>di</strong> programmi.<br />

Esercizio 5.2.12. Dato il programma<br />

p ← q, t<br />

u ← r<br />

r ← p, q<br />

t ← q<br />

q ←<br />

<strong>di</strong>mostrare che il goal ← p è sod<strong>di</strong>sfatto, e che anche ← q, r lo è.<br />

Esercizio 5.2.13. Dimostrare che anche i goal ← u e ← t sono sod<strong>di</strong>sfatti,<br />

e che questo significa che non solo l’<strong>in</strong>terpretazione pos<strong>it</strong>iva sod<strong>di</strong>sfa il<br />

programma, ma che è l’unica che lo sod<strong>di</strong>sfa.<br />

Esercizio 5.2.14. Dimostrare che se <strong>in</strong> un programma ci sono solo fatti, solo<br />

i goal che unificano con quei fatti sono sod<strong>di</strong>sfatti, e che se <strong>in</strong> un programma<br />

ci sono solo leggi nessun goal è sod<strong>di</strong>sfatto; questo significa che per ogni goal<br />

← p l’<strong>in</strong>sieme <strong>di</strong> ¬p e delle clausole del programma è sod<strong>di</strong>sfacibile; quale è<br />

l’<strong>in</strong>terpretazione che lo sod<strong>di</strong>sfa?<br />

Esercizio 5.2.15. Verificare che per il programma<br />

u ← r<br />

r ← p, u<br />

p ← u<br />

u ←<br />

il goal ← u non è sod<strong>di</strong>sfatto se si impone <strong>di</strong> prendere <strong>in</strong> considerazione le<br />

clausole <strong>di</strong> programma solo nell’or<strong>di</strong>ne <strong>in</strong> cui sono scr<strong>it</strong>te.

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

Saved successfully!

Ooh no, something went wrong!