Presentation is loading. Please wait.

Presentation is loading. Please wait.

Teorie assiomatico-deduttive (calcolo dei predicati)

Similar presentations


Presentation on theme: "Teorie assiomatico-deduttive (calcolo dei predicati)"— Presentation transcript:

1 Teorie assiomatico-deduttive (calcolo dei predicati)
LOGICA DEI PREDICATI DEL PRIMO ORDINE Simboli ed espressioni non interpretati Interpretazione SINTASSI SEMANTICA Correttezza DIMOSTRAZIONE DI TEOREMI CONSEGUENZA LOGICA Teorie assiomatico-deduttive (calcolo dei predicati) Completezza Dimostrazione automatica di teoremi PRINCIPIO DI RISOLUZIONE clausole PROGRAMMAZIONE LOGICA clausole di Horn

2 Prolog: Non completo, perché applica strategia depth-first con backtracking Non corretto, per assenza occur-check nell'algoritmo di unificazione p(X,X). ?-p(Y,f(Y)). yes Y=f(f(f( ))) Regola di selezione left-most non safe (negazione)

3 Example: The following knowledge is given :
1. Marcus was a man. 2. Marcus was a Pompeian. 3. All Pompeians were Romans. 4. Caesar was a ruler. 5. All Romans were either loyal to Caesar or hated him. 6. Everyone is loyal to someone. 7. People only try to assassinate rulers to whom they are not loyal. 8. Marcus tried to assassinate Caesar. Can we automatically answer the following questions? Was Marcus loyal to Caesar? Did Marcus hate Caesar?

4 Conversion to the First Order Logic:
Representation of facts: 1. Marcus was a man. man(Marcus) 2. Marcus was a Pompeian. Pompeian(Marcus) 4. Caesar was a ruler. ruler(Caesar) 8. Marcus tried to assassinate Caesar. try_assassinate(Marcus, Caesar)

5 Conversion to the First Order Logic (2):
General representation (representation of rules): 3. All Pompeians were Romans. x Pompeian(x)  Roman(x) 5. All Romans were either loyal to Caesar or hated him. ( )  ~(loyal_to(x,Caesar)  hates(x,Caesar)) XOR x Roman(x)  loyal_to(x,Caesar)  hates(x,Caesar) 6. Everyone is loyal to someone. x y loyal_to(x,y) 7. People only try to assassinate rulers to whom they are not loyal. xy person(x)  ruler(y)  try_assassinate(x,y)  ~loyal_to(x,y)

6 The “theorem” ? Was Marcus loyal to Caesar?
Try, for example, to prove that he was not : ~loyal_to(Marcus,Caesar) Did Marcus hate Caesar? Prove that he did: hates(Marcus,Caesar)

7 A proof by refutation using resolution:
Facts 1. , 2. , 4. and 8. were already o.k. (clauses) To show: hates(Marcus,Caesar) Negation: ~hates(Marcus,Caesar) 1. man(Marcus) 2. Pompeian(Marcus) 4. ruler(Caesar) 8 try_assassinate(Marcus, Caesar)

8 Marcus example: RESOLUTION (clauses)
3. x Pompeian(x)  Roman(x) : o.k. ! 6. x y loyal_to(x,y) x loyal_to(x,f(x)) loyal_to(x,f(x)) 7. xy man(x)  ruler(y)  try_assassinate(x,y)  ~loyal_to(x,y) xy ~(man(x)  ruler(y)  try_assassinate(x,y))  ~loyal_to(x,y) xy ~man(x)  ~ruler(y)  ~try_assassinate(x,y)  ~loyal_to(x,y) false  man(x)  ruler(y)  try_assassinate(x,y)  loyal_to(x,y)

9 Axioms in Normal form: 1. man(Marcus) 2. Pompeian(Marcus)
3. Roman(x)  Pompeian(x) 4. ruler(Caesar) 5. loyal_to(x,Caesar)  hates(x,Caesar)  Roman(x) 6. loyal_to(x,f(x)) 7. false  man(x)  ruler(y)  try_assassinate(x,y)  loyal_to(x,y) 8. try_assassinate(Marcus,Caesar)

10 Axioms in Normal form (Horn clauses):
1. man(Marcus) 2. Pompeian(Marcus) 3. Roman(x)  Pompeian(x) 4. ruler(Caesar) 5. loyal_to(x,Caesar)  hates(x,Caesar)  Roman(x) 6. loyal_to(x,f(x)) 7. false  man(x)  ruler(y)  try_assassinate(x,y)  loyal_to(x,y) 8. try_assassinate(Marcus,Caesar) To show: hates(Marcus,Caesar) Negation: ~hates(Marcus,Caesar) Normal Form: false  hates(Marcus,Caesar)

11 Resolution proof (1): (linear-input strategy)
false  hates(Marcus,Caesar) loyal_to(x,Caesar)  hates(x,Caesar)  Roman(x) loyal_to(Marcus,Caesar)  Roman(Marcus) {x/Marcus} 5. Roman(x)  Pompeian(x) loyal_to(Marcus,Caesar)  Pompeian(Marcus) {x/Marcus} 3. Pompeian(Marcus) loyal_to(Marcus,Caesar) {} 2.

12 Resolution proof (2) 7. 1. 4. 8. loyal_to(Marcus,Caesar)
false  man(x)  ruler(y)  try_assassinate(x,y)  loyal_to(x,y) false  man(Marcus)  ruler(Caesar)  try_assassinate(Marcus,Caesar) 7. {x/Marcus,y/Caesar} man(Marcus) false  ruler(Caesar)  try_assassinate(Marcus,Caesar) 1. {} ruler(Caesar) false  try_assassinate(Marcus,Caesar) 4. {} try_assassinate(Marcus,Caesar) false  8. {}


Download ppt "Teorie assiomatico-deduttive (calcolo dei predicati)"

Similar presentations


Ads by Google