Artificial Intelligence University Politehnica of Bucharest 2008 2009
Artificial Intelligence University Politehnica of Bucharest 2008 -2009 Adina Magda Florea http: //turing. cs. pub. ro/aifils_08
Lecture No. 5 Theorem proving through resolution refutation n n n Standard form Expression unification Resolution in propositional logic Resolution in predicate logic Resolution strategies Answers through resolution
1. Standard form (clausal) n n n Clause Horn Clause Definite Horn Clause Empty clause Transformation into clausal form
2. Expression unification n n Substitution Unifier Most general unifier Expression Unification algorithm
Algorithm Unify(E 1, E 2): Expression unification 1. if E 1 and E 2 are constants then 1. 1. if E 1=E 2 then return { } 1. 2. return FAIL 2. if E 1 is a variable or E 2 is a variable then 2. 1. Exchange E 1 with E 2 such as E 1 to be a variable 2. 2. if E 1=E 2 then return { } 2. 3. if E 1 occurs in E 2 then return FAIL 2. 4. return {E 1/E 2}
3. if E 1=simb(t 11, …, t 1 n) and E 2=simb(t 21, …t 2 n) then 3. 1 x t 11, y t 21 3. 2 Rest 1 t 12, …, t 1 n , Rest 2 t 22, …t 2 n 3. 3 1 Unify(x, y) 3. 4 if 1= FAIL then return FAIL 3. 5 G 1 Rest 1 / 1, G 2 Rest 2 / 1 3. 6 2 Unify(Rest 1, Rest 2) 3. 7 if 2= FAIL then return FAIL else return ( 1, 2 ) 4. return FAIL end.
3. Resolution in propositional logic n n Resolvent Clauses that resolve Proof principle Proof tree
Algorithm: Resolution refutation in propositional logic. 1. Transform the set of axioms A in clausal form and get S 0 2. Negate theorem, transform the negated theorem in clausal form and add it to S 0 3. repeat 3. 1. Select two clauses C 1 and C 2 from S 3. 2. Compute R = Res(C 1, C 2) 3. 3. if R then add R to S until R = or there are no two other clauses that resolve 4. if R = then theoren is proven 5. else it is not a theorem end.
Example n n n n Mihai has money The car is white The car is beautiful If the car is white or the car is beautiful and Mihai has money then Mihai goes to the mountain B A F (A F) B C
4. Resolution in predicate logic n n n Resolvent Clauses that resolve Factor of a clause
Algorithm: Resolution refutation in predicate logic. 1. Transform the set of axioms A in clausal form and get S 0 2. Negate theorem, transform the negated theorem in clausal form and add it to S 0 3. repeat 3. 1. Select two clauses C 1 and C 2 from S 3. 2. Compute R = {Res(C 1, C 2)} 3. 3. if R then add R to S until R or there are no two other clauses that resolve or a predefined amount of effort has been exhausted 4. if R then theoren is proven 5. else if there are no two other clauses that resolve then it is not a theorem else there is not a definite conclusion end.
Example n n Horses are faster than dogs and there is a greyhound that is faster than every rabbit. We know that Harry is a horse and that Ralph is a rabbit. Derive that Harry is faster than Ralph. Horse(x) Dog(y) Faster(y, z)) Greyhound(y) Rabbit(z) x y Horse(x) Dog(y) Faster(x, y) y Greyhound(y) ( z Rabbit(z) Faster(y, z)) Horse(Harry) Rabbit(Ralph) y Greyhound(y) Dog(y) x y z Faster(x, y) Faster(y, z) Faster(x, z)
A 1. x y Horse(x) Dog(y) Faster(x, y) A 2. y Greyhound(y) ( z Rabbit(z) Faster(y, z)) A 3. Horse(Harry) A 4. Rabbit(Ralph) A 5. y Greyhound(y) Dog(y) A 6. x y z Faster(x, y) Faster(y, z) Faster(x, z) T Faster(Harry, Ralph) C 1. ~Horse(x) ~Dog(y) Faster(x, y) C 2. Greyhound(Greg) C 2’ ~Rabbit(z) Faster(Greg, z) C 3. Horse(arry) C 4. Rabbit(Ralph) C 5. ~Greyhound(y) Dog(y) C 6. ~Faster(x, y) ~Faster(y, z) Faster(x, z) C 7. ~Faster(Harry, Ralph)
5. Resolution strategies n n n Breadth first (level order) strategy Set of support strategy Linear resolution Input linear resolution Unit resolution Elimination strategy
Level order strategy
Level order strategy n n n S 0, L 0 Lk+1 {Res(Ci, Cj)| Ci Lk, Cj Sk} Sk+1 Sk Lk+1 k = 0, 1, 2, …
Linear resolution n S, C 0 S n C 1 {Res(C 0, Ci)| C 0, Ci S} n Ck+1 {Res(Ck, Ci)| Ci {Ck-1, Ck-2, . . } S} k=1, 2, 3, … Input linear resolution n S, C 0 S n C 1 {Res(C 0, Ci)| C 0, Ci S} n Ck+1 {Res(Ck, Ci)| Ci S} k=1, 2, 3, …
Subsumed clauses n n n A clause C subsumes a clause D iff there is a substitution such that C D. D is called subsumed clause. C=P(x) D=P(a) Q(a)
6. Obtaining answers C 1 C 2 C 3
- Slides: 26