0% found this document useful (0 votes)
20 views

Resolution Extra Examples

REpresentations in AI

Uploaded by

meghanaghogare
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
20 views

Resolution Extra Examples

REpresentations in AI

Uploaded by

meghanaghogare
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
Knowledge Representation Using Predicates Logic 1.Logical Representation Scheme We are only going to look at one logical representation scheme, namely, first-order predicate logic. Predicate lagic is more powerful than propositional logic as it allows for quantification. Facts are represented as logical propositions and additional information is deduced from these facts using backward chaining or resolution. Converting facts to logical propositions ‘The first step is to convert facts in English to logical propositions called well-formed formulas (wis). The wits include the following symbols: Implies: > And: A, Orv Not: ~ For all: ¥ The exists: 3 Example: Consider the following facts on Italian history: eenNogsepe Marcus was a man. Marcus was a Pompeian. All Pompeians were Roman. ‘Caesar was a ruler. All Romans were either loyal to Caesar or hated him ‘Everyone is loyal to someone. People only try to assassinate rulers that they are not loyal to. Marcus tried to assassinate Caesar. All men are people. These facts can be represented in predicate logic as the following wits: SPeNonaene man(Marcus) Pompeian(Marcus) ‘vx: Pompeian(x) > Roman(x) ruler(Caesar) ‘yx: Roman(x) — loyalto(x,Caesar) V hate(x,Caesar) ‘vx 3y: loyalto(x,y) ‘vx vy: person(x) / ruler(y) / tryassassinate(x,y) — ~loyalto(xy) tryassassinate(Marcus,Caesar) ‘vx: man(x) — person(x) 3.2. Backward Chaining ‘Suppose that given the facts 1 to 9 in the previous section, we want to answer the question “Was Marcus loyal to Caesar"? We can prove this using backward chaining. Backward chaining matches a clause to the right-hand side of a rule (wif with an implies) and then attempts to prove the clauses on the left-hand of the rule. Alternatively, a clause can be matched against a ‘Single clause. Since wf 7 has a ~loyalto on the right-hand side we will attempt to prove ~loyalto(Marcus, Caesar): ~loyalto(Marcus, Gaesar) 17 person(Marcus) /\ ruler(Caesar) /\ tryassasinate(Marcus, Caesar) 18 person(Marcus) | ruler(Caesar) Using backward chaining we have proved that Marcus is not loyal to Caesar. Exercise 3 1. Consider the following facts: 4. John likes all kinds of food. 2. Apples are food. 3. Chicken is food 4. Anything anyone eats and is not killed by is food. 5. Bill eats peanuts and is still alive. 6. Sue eats everything Bill eats. a) Convert these facts to wffs in predicate logic. b) Using backward chaining prove the “John likes peanuts’. 2. Consider the following facts: Steve only likes easy courses. Science courses are hard. All the courses in the basketweaving department are easy. BK301 is a basketweaving course. Pope a) Convert these facts to wffs in predicate logic. b) Use backward chaining to answer the question “What course would Steve like?” ‘Computable Functions and Predicates It may be neceseary to compute functions as part of a fac. In these cases a computable predicate 's used. A computable predicate may include computable funciions such as +, ~ * ‘etc. For example, gt(x-y.10) —bigger(x) contains the computable predicate gf which performs the greater than function. Note that this computable predicate uses the computable function ‘subtraction. Example: Consider the following statements: Marcus was a man. Marcus was Pompeian. Marcus was born in 40 A.D. All men are mortal. All Pompeians died when the voleane erupted in 79 A.D. No mertal lives longer than 150 years. Itis now 1991 Alive means not dead. If someone dies, he is dead at all later times. ‘The wifs for these facts are: man (Marcus) Pompeian(Marcus) born(Marous,40) vx: man(x) —» mortal(x) eruptedivoleano,79) /\ vx: Pompeian(x) —> died(x.79) x Vts Yte: mortal(x) A born(x.ts) A gtit2-t1,150) > dead(x.te) now= 1991 vx Wt: [alive(x,t) + ~dead(xt)] A [-dead(x) —alive(x,t)] vx Wt; Vtaidied(x,ts) \ gt.) —-dead(x.ta) ‘Suppose we want to answer the question "Is Marcus alive now?”. We can do this by either proving alive(Marcus,now) or ~alive(Marcus,now). Let us try the latter: ‘dead(Marcus,now)} | nagation operation dead(Narcus.now) 19 died\Marcus.t) A gt(now.s) 5 erupiedielesno-79)/ Pempeian(Marcts) gn0¥,79) taste annow.75) 1 ‘9t(1991,79) J compute ot nil Resolution In the previous sections facts were proved or queries were answered using backward chaining. In this section we will examine the use of resolution for this purpose. Resolution proves facts ‘and answers queries by refutation. This involves assuming the facvquery is untrue and reaching a contradiction which indicates that the opposite must be true. The wis must firstly be firstly converted to clause form before using resolution. The algorithm for converting wfis to clause form and the resolution algorithm are listed below. Algorithm: Converting wits to Clause Form 1 2. 10. Remove all implies, i.e. — by applying the following: a — bis equivalent to ~a Vb. Use the following rules to reduce the scope of each negation operator to a singleterm: © -(a)=a Each quantifier must be linked to a unique variable. For example, consider Wx: p(x) V ‘vx: q(x). In this both quantifiers are using the same variable and one must changed to another variable: Vx: p(x) V vy: aty). Move all quantifiers, in order, to the left of each wif. Remove existential quantifiers by using Skolem constants or functions. For example, 3x: P(x) becomes (51) and vx 3y: g(x,y) is replaced with Vx: q(s2(x), x). Drop the quantifier prefix. Apply the associative property of disjunctions: aV (b Vc) = (a/b) Vc andremove brackets giving a/b Vc. Remove all disjunctions of conjunctions from predicates, i.e. create conjunctions of disjunctions instead, by applying the following rule iteratively: (a/\b) c= (ac) A (DV ). Create a separate clause for each conjunction. Rename variables in the clauses resulting from step 9. to ensure that no two clauses refer to the same variable. Algorithm: Resolution 1. Convert the wis to clause form. 2. Add the fact (or query) P to be proved to the set of clauses: Negate P. ii, Convert negated P to clause form. Add the result of ii to the set of clauses. 3. Repeat Select two clauses. Resolve the clauses using unification. If the resolvent clause is the empty clause, then a contradiction hasbeen reached. If not add the resolvent to the set of clauses. Until (a contradiction is found OR no progress can be made) Consider the following wits: man(Marcus) Pompeian(Marcus) vx: Pompeian(x) > Romani(x) ruler(Caesar) x: Roman{x) — loyalto(x,Caesar) V hate(x,Caesar) vx ay: loyalto(xy) vx vy: person(x) /\ ruler(y) /\ tryassassinate(x,y) — ~loyalto(x,y) tryassassinate(Marcus, Gaesar) x: man(x) — person(x) SOENeNsena Converting these to clause form gives: man(Marcus) Pompeian(Marcus) ~Pompeian(x) V Roman(x) ruler(Caesar) ~Roman(x1) V loyalto(x1 Caesar) V hate(x1,Caesar) loyalto(x2,s1(x2)) ~person(x3) V ~ruler(y) V ~tryassassinate(x3.y) V ~loyalto(x3.y) tryassassinate(Marcus, Caesar) ~man(x4) V person(x4) Senonseons 11. ~died(x5,14) V ~gt(t5.t4) V dead(x5,t5) We want to prove ~alive(Marcus,now). We negate this and convert it clause form: alive(Marcus, now) and find a contradication: alive(Marcus,now) 110 dead(Marcus,now) ww ~died(Marcus.t4) V~gt(now,t4) 16 ~Pompeian(Marcus) V~gt(now,79) 12 ~at(now,t4) 18 ~gt (191,79) 1 Exercise 4 1. Consider the following facts: 1. John likes all kinds of food. 2. Apples are food. 3. Chicken is food 4. Anything anyone eats and is not killed by is food. eats peanuts and is stil alive. 6. Sue eats everything Bill eats. a) Convert the wits for these facts (which you created in Exercise 3) to clause form. b) Using resolution prove that “John likes peanuts". 2. Consider the following facts: Steve only likes easy courses. Science courses are hard. All the courses in the basketweaving department are easy. BK301 is a basketweaving course. Beppe a) Convert the wits for these facts (which you created in Exercise 3) to clause form. b) Use resolution to answer the question “What course would Steve like?”

You might also like