230 likes | 436 Views
Propositional logic. It represents real-world facts as logical propositions in well formed formulas. It presented as an atomic propositions, and complex sentences can be created using AND, OR, and other operators. Example It is raining RAINING It is sunny SUNNY
E N D
Propositional logic It represents real-world facts as logical propositions in well formed formulas. It presented as an atomic propositions, and complex sentences can be created using AND, OR, and other operators. CS 301 AI nd ES
Example It is raining RAINING It is sunny SUNNY It is windy WINDY If it is raining, then it is not sunny RAINING ¬SUNNY CS 301 AI nd ES
Classical sentences Socrates is a man SOCRATESMAN Plato is a man PLATOMAN MAN (SOCRATES) MAN (PLATO) Now is reflects the structure of representation reflects the structure of knowledge itself. CS 301 AI nd ES
Predicate logic In represents the logic there are objects, properties, functions (Relations) are involved. It serves a useful way of representing and manipulating some of kinds of knowledge. CS 301 AI nd ES
Resolution • Resolution is a technique for proving theorems in predicate calculus • Resolution proves a theorem by negating the statement to be proved and adding the negated goal to the set of axioms that are known or have been assumed to be true CS 301 AI nd ES
Example • We wish to prove that “Fido will die” from the statements that “Fido is a dog” and “all dogs are animals” and “all animals will die” CS 301 AI nd ES
Equivalent Reasoning by Resolution • Convert these predicates to clause form CS 301 AI nd ES
Apply Resolution • Negate the conclusion that fido will die ¬die(fido) ¬dog(x) V animal(x) ¬animal(y) V die(y) [Y/X] dog(fido) ¬dog(y) V die(y) [fido/Y] die(fido) ¬die(fido) a Null clauseHence fido will die CS 301 AI nd ES
Steps in Resolution • Put the premises or axioms into clause form • Add the negations of what is to be proved in clause form, to the set of axioms • Resolve these clauses together, producing new clauses that logically follow from them • Produce a contradiction by generating the empty clause • The substitutions used to produce the empty clause are those under which the opposite of the negated goal is true CS 301 AI nd ES
Marcus was a man Man (Marcus) Marcus was a Pompeian Pompeian(Marcus) All Pompeian were Romans x:Pompeian(x) Roman(x) Ceaser was a ruler Ruler(Ceaser) All Romans were either loyal to Ceaser or Hated him x: Roman(x) loyalto(x,Caesar) V hate (x, Caesar) Everyone is loyal to someone x: y: loyalto (x,y) People only try to assassinate rulers they are not loyol to x: y : Person(x) ᴧ ruler(y) ᴧ tryassassinate (x,y ¬loyalto(x,y) CS 301 AI nd ES
Marcus tried to assassinate Caesar. Tryassassinate (Marcus, Caeser) CS 301 AI nd ES
Question : Was Marcus loyal to Ceasar? Prove this : Marcus was not loyal to Ceasar (If we got Marcus was not loyal to Ceasor otherwise Marcus was Loyal. ) Proven 1. Man (Marcus) 2. Pompeian(Marcus) 3. x:Pompeian(x) Roman(x) 4. Ruler(Ceaser) 5. x: Roman(x) loyalto(x,Caesar) V hate (x, Caesar) 6. x: y: loyalto (x,y) 7. x: y : Person(x) ᴧ ruler(y) ᴧ tryassassinate (x,y)¬loyalto(x,y) 8. Tryassassinate (Marcus, Caeser) All men are people 9. x: man (x) person(x) ] [ CS 301 AI nd ES
Another Example Anyone passing the Artificial Intelligence exam and winning the lottery is happy. But anyone who studies or is lucky can pass all their exams. Gopal did not study but he is lucky. Anyone who is lucky wins the lottery. Is Gopal happy? CS 301 AI nd ES
Another Example Anyone passing the AI Exam and winning the lottery is happy X:[pass(x,AI) Λ win(x, lottery) happy(x)] Anyone who studies or is lucky can pass all their exams X : Y [studies(x) V lucky(x) pass(x,y)] gopal did not study but he is lucky ¬ study(gopal) Λ lucky(gopal) Anyone who is lucky wins the lottery X: [lucky(x) win(x,lottery)] CS 301 AI nd ES
Change to clause Form • ¬pass(X,AI) V ¬win(X,lottery) V happy(X) • ¬study(Y) V pass(Y,Z) • ¬lucky(W) V pass(W,V) • ¬study(gopal) • Lucky(gopal) • ¬lucky(u) V win(u,lottery) • Add negation of the conclusion ¬happy(gopal) CS 301 AI nd ES
¬pass(X,AI) V ¬win(X,lottery) V happy(X) win(u,lottery) V ¬lucky(u) u/v ¬pass(u,AI) V happy(u) V ¬lucky(u) gopal/u ¬happy(gopal) ¬pass(gopal,AI) V ¬lucky(gopal) lucky(gopal) ¬ pass(gopal,AI) gop/v,AI/w ¬lucky(v) V pass(V,W) ¬lucky(gopal) lucky(gopal) CS 301 AI nd ES NULL
Example • Consider the following logic program. GRANDFATHER (x, y) FATHER (x, z) , PARENT (z, y) PARENT (x, y) FATHER (x, y) PARENT (x, y) MOTHER (x, y) FATHER ( abraham, robert) FATHER ( robert, mike) • In FOL above program is represented as a set of clauses as: S = { GRANDFATHER (x, y) V ~FATHER (x, z) V ~ PARENT (z, y), PARENT(x, y) V ~ FATHER (x, y), PARENT(x, y) V ~ MOTHER (x, y), FATHER ( abraham, robert), FATHER ( robert, mike) }
Example • Let us number the clauses of S as follows: i.GRANDFATHER(x, y) V ~FATHER(x, z) V ~PARENT(z, y) ii. PARENT(x, y) V ~ FATHER (x, y) iii. PARENT(x, y) V ~ MOTHER (x, y), iv. FATHER ( abraham, robert) v. FATHER ( robert, mike) Question : “Is abraham a grandfather of mike ?"
Ground Query “Is abraham a grandfather of mike ?" GRANDFATHER (abraham, mike). • In FOPL, ~GRANDFATHER(abraham, mike) is negation of goal { GRANDFATHER (abraham, mike). • Include {~goal} in the set S and show using resolution refutation that S {~ goal} is unsatisfiable in order to conclude the goal. • Let ~ goal is numbered as ( vi) in continuation of first five clauses of S listed above. vi. ~ GRANDFATHER (abraham, mike) • Resolution tree is given on next slide:
Resolution ( i ) ( vi ) {x / abraham, y / mike} ( iv) ~ FATHER(abraham, z) V ~PARENT(z, mike) {z / robert} ~ PARENT (robert, mike) ( ii) ~ FATHER (robert, mike) (v) Answer: Yes
Unevaluated nodes Alpha-beta pruning example F Minimax without pruning Depth-first search Visit C, A, F, Visit G, heuristics evaluates to 2Visit H, heuristics evaluates to 3 Back up {2,3} to F. max(F)=3 Back up to A. β(A)=3. Temporary min(A) is 3. 3 is the ceiling for node A's score. Visit B according to depth-first order. Visit I. Evaluates to 5. Max(B)>=5. α(B)=5. It does not matter what the value of J is, min(A)=3. β-prune J. Alpha-beta pruning improves search efficiency of minimax without sacrificing accuracy. J G H I