Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.

Slides:



Advertisements
Similar presentations
Resolution Proof System for First Order Logic
Advertisements

Inference Rules Universal Instantiation Existential Generalization
1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 06 : First Order Logic Resolution Prove.
Standard Logical Equivalences
Resolution.
AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic.
Artificial Intelligence
First Order Logic Resolution
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Logic Use mathematical deduction to derive new knowledge.
Resolution
Section 1.3. More Logical Equivalences Constructing New Logical Equivalences We can show that two expressions are logically equivalent by developing.
Chapter 6 Logical Reasoning Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: ResolutionUnificationNormalization.
Using Predicate Logic Chapter 5.
Predicate Logic Terms represent specific objects in the world and can be constants, variables or functions. Predicate Symbols refer to a particular relation.
Propositional Calculus A propositional calculus formula is composed of atomic propositions, which area simply statements that are either true or false.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
AI - Week 16 Logic and Reasoning in AI: Resolution Refutation Lee McCluskey, room 2/07
Inference and Resolution for Problem Solving
Artificial Intelligence
The Semantic Web – WEEK 8: An automatic Proof technique.. The “Layer Cake” Model – [From Rector & Horrocks Semantic Web cuurse] You are here!
Introduction to Logic for Artificial Intelligence Lecture 2 Erik Sandewall 2010.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
For Wednesday Read chapter 10 Prolog Handout 4. Exam 1 Monday Take home due at the exam.
SAT-solving Introduction: logic in AI SAT-solving techniques: Unit-propagationLocal-search.
UNIVERSITI TENAGA NASIONAL 1 CSNB234 ARTIFICIAL INTELLIGENCE Chapter 3 Propositional Logic & Predicate Logic Chapter 3 Propositional Logic & Predicate.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
1 Chapter 8 Inference and Resolution for Problem Solving.
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
First Order Predicate Logic
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Logical Representations and Resolution. Boolean Logic Conjunctive normal form Resolution.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Automated Reasoning Early AI explored how to automate several reasoning tasks – these were solved by what we might call weak problem solving methods as.
CPSC 386 Artificial Intelligence Ellen Walker Hiram College
Reasoning using First-Order Logic
Propositional Logic Predicate Logic
1 Section 9.1 Automatic Reasoning Recall that a wff W is valid iff ¬ W is unsatisfiable. Resolution is an inference rule used to prove unsatisfiability.
For Wednesday Finish reading chapter 10 – can skip chapter 8 No written homework.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
1 Example: The following knowledge is given :The following knowledge is given : 1. Marcus was a man. 2. Marcus was a Pompeian. 3. All Pompeians were Romans.
CIT 856 – Artificial Intelligence
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
Chapter 3 Propositional calculus Predicate calculus Artificial Intelligence Dr.Hassan Al-Tarawneh.
Resolution in the Propositional Calculus
Propositional Logic Resolution
A I (Artificial Intelligence)
Predicate Logic Lecture 7.
Horn Clauses and Unification
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Logic Use mathematical deduction to derive new knowledge.
Biointelligence Lab School of Computer Sci. & Eng.
Horn Clauses and Unification
Horn Clauses and Unification
Horn Clauses and Unification
Horn Clauses and Unification
Predicates and Quantifiers
CSNB234 ARTIFICIAL INTELLIGENCE
RESOLUTION.
Resolution Proof System for First Order Logic
Presentation transcript:

Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of representing large bodies of knowledge 1

Logical Reasoning In order to communicate, we need a formal language in which to express – axioms – theorems – hypotheses – rules Common languages include – propositional logic – 1 st order predicate logic 2

Propositional Logic Propositions are statements that are true or false. – P: Sierra is a dog – Q: Muffy is a cat – R: Sierra and Muffy are not friends Propositions can be combined using logic symbols P  Q  R  P  Q 3

Predicate Logic Formulas have predicates with variables and constants: – man(Marcus) – Pompeian(Marcus) – born(Marcus, 40) More symbols –  for every  x Pompeian(x)  died(x,79) –  there exists  x Pompeian(x) 4

Ancient Pompei 5

Vesuvius 6

Ancient Pompei and Vesuvius 7 What happened to ancient Pompei? Vesuvius erupted and killed everyone. When? 79 A.D.

Predicate Logic Example 1.Pompeian(Marcus) 2.born(Marcus,40) 3.man(Marcus) 4.  x man(x)  mortal(x) 5.  x Pompeian(x)  died(x,79) 6.erupted(Vesuvius,79) 7.  x  t1  t2 mortal(x)  born(x,t1)  gt(t2-t1,150)  dead(x,t2) 8

Dead Guy in gt(now,79) 9

Some Rules of Inference 9.  x  t [alive(x,t)   dead(x,t)]  [  dead(x,t)  alive(x,t)] If x is alive at time t, he’s not dead at time t, and vice versa. 10.  x  t1  t2 died(x,t1)  gt(t2,t1)  dead(x,t2) If x died at time t1 and t2 is later, x is still dead at t2. 10

Prove dead(Marcus,now) 1. Pompeian(Marcus) 2. born(Marcus,40) 3. man(Marcus) 4.  x man(x)  mortal(x) 5.  x Pompeian(x)  died(x,79 ) 6. erupted(Vesuvius,79) 7.  x  t1  t2 mortal(x)  born(x,t1)  gt(t2-t1,150)  dead(x,t2) 8. gt(now,79) 9.  x  t [alive(x,t)   dead(x,t)]  [  dead(x,t)  alive(x,t)] 10.  x  t1  t2 died(x,t1)  gt(t2,t1)  dead(x,t2) 11

Prove dead(Marcus,now) Direct Proof 1. Pompeian(Marcus) 5.  x Pompeian(x)  died(x,79) 8. gt(now,79) 7.  x  t1  t2 died(x,t1)  gt(t2,t1)  dead(x,t2) died(Marcus,79) died(Marcus,79)  gt(now,79) dead(Marcus,now) 12

Proof by Contradiction  dead(Marcus,now)  x  t1  t2 died(x,t1)  gt(t2,t1)  dead(x,t2)  t1  [died(Marcus,t1)  gt(now,t1)] What substitutions were made here? What rule of inference was used? Marcus for x; now for t2 If x  y then  y   x 13

Proof by Contradiction  dead(Marcus,now)  x  t1  t2 died(x,t1)  gt(t2,t1)  dead(x,t2)  t1  [died(Marcus,t1)  gt(now,t1)]  t1  died(Marcus,t1)   gt(now,t1) died(Marcus,79)*  gt(now,79) gt(now,79) *assume we proved this separately contradiction 14

Resolution Theorem Provers for Predicate Logic Given: – F: a set of axioms represented as formulas – S: a conjecture represented as a formula Prove: F logically implies S Technique – Construct  S, the negated conjecture – Show that F’ = F  {  S} leads to a contradiction – Conclude:  {  S} or S 15

Part I: Preprocessing to express in Conjunctive Normal Form 1.Eliminate implication operator  Replace A  B by  (  A,B) Example: man(x)  mortal(x) is replaced by  (  man(x),mortal(x)) or in infix notation  man(x)  mortal(x) 16

Preprocessing Continued 2. Reduce the scope of each  to apply to at most one predicate by applying rules: Demorgan’s Laws   (x1,…,xn) is equivalent to  (  x1,…,  xn)   (x1,…,xn) is equivalent to  (  x1,…,  xn)  (  x)  x  (  x A)   x(  A)  (  x A)   x(  A) 17

Preprocessing Continued Example  [  x  t1  t2 [died(x,t1)  gt(t2,t1)]  dead(x,t2)] Get rid of the implication  [  x  t1  t2  [died(x,t1)  gt(t2,t1)]  dead(x,t2)] Apply the rule for  [   x  t1  t2  (  [died(x,t1)  gt(t2,t1)]  dead(x,t2)) Apply DeMorgan’s Law  x  t1  t2   [died(x,t1)  gt(t2,t1)]   dead(x,t2)  x  t1  t2 died(x,t1)  gt(t2,t1)   dead(x,t2)] 18

Preprocessing Continued 3. Standardize Variables Rename variables so that each quantifier binds a unique variable  x [P(x)   x Q(x)] becomes  x [P(x)   y Q(y)] 19

Preprocessing Continued 4. Eliminate existential qualifiers by introducing Skolem functions. Example  x  y  z P(x,y,z) The variable z depends on x and y. So z is a function of x and y. We choose an arbitrary function name, say f, and replace z by f(x,y), eliminating the .  x  y P(x,y,f(x,y)) 20

Preprocessing Continued 5. Rewrite the result in Conjunctive Normal Form (CNF)  (x1,…,xn) where the xi can be atomic formulas A(x) negated atomic formulas  A(x) disjunctionsA(x)  P(y) This uses the rule  (x1,  (x2, …, xn) =  (  (x1,x2), …,  (x1,xn)) 21

Preprocessing Continued 6. Since all the variables are now only universally quantified, eliminate the  as understood.  x  t1  t2  died(x,t1)   gt(t2,t1)  dead(x,t2) becomes  died(x,t1)   gt(t2,t1)  dead(x,t2) 22

Clause Form The clause form of a set of original formulas consists of a set of clauses as follows. – A literal is an atom or negation of atom. – A clause is a disjunction of literals. – A formula is a conjunction of clauses. Example Clause 1: {A(x),  P(g(x,y),z),  R(z)} (implicit or) Clause 2: {C(x,y), Q(x,y,z)} (another implicit or) 23

Steps in Proving a Conjecture 1.Given a set of axioms F and a conjecture S, let F’ = F   S and find the clause form C of F’. 2.Iteratively try to find new clauses that are logically implied by C. 3.If NIL is one of these clauses you produce, then F’ is unsatisfiable and the conjecture is proved. 4.You get NIL when you produce something that has A and also has  A. 24

Resolution Procedure 1.Convert F to clause form: a set of clauses. 2.Negate S, convert it to clause form, and add it to your set of clauses. 3.Repeat until a contradiction or no progress a. Select two parent clauses. b. Produce their resolvent. c. If the resolvent = NIL, we are done. d. Else add the resolvent to the set of clauses. 25

Resolution for Propositions Let C1 = L1  L2  …  Ln Let C2 = L1’  L2’  …  Ln’ If C1 has a literal L and C2 has the opposite literal  L, they cancel each other and produce resolvent(C1,C2) = L1  L2  …  Ln  L1’  L2’  …  Ln’ with both L and  L removed If no 2 literals cancel, nothing is removed 26

Propositional Logic Example Formulas: P  Q, P  Q, Q  R Conjecture: R Negation of conjecture:  R Clauses: {P  Q,  P  Q,  Q  R,  R} Resolvent(P  Q,  P  Q) is Q. Add Q to clauses. Resolvent(  Q  R,  R) is  Q. Add  Q to clauses. Resolvent(Q,  Q) is NIL. The conjecture is proved. 27

Refutation Graph Original Clauses: {P  Q,  P  Q,  Q  R,  R} P  Q  P  Q  Q  R  R Q  Q NIL 28

Exercise Given P  R and R  Q, prove that P  Q 29

Resolution for Predicates Requires a matching procedure that compares 2 literals and determines whether there is a set of substitutions that makes them identical. This procedure is called unification. C1 = eats(Tom x) C2 = eats(Tom, ice cream) The substituion ice cream/x (read “ice cream for x”) makes C1 = C2. You can substitute constants for variables and variables for variables, but nothing for constants. 30

Proof Using Unification Given  x P(x)  R(x) {  P(x),R(x)}  z R(z)  Q(z) {  R(z),Q(z)} Prove  x P(x)  Q(x) Negation   x P(x)  Q(x)  x  (P(x)  Q(x))  x  (  P(x)  Q(x))  x P(x)   Q(x) P(a)   Q(a)*{P(a)} {  Q(a)} * Skolem function for a single variable is just a constant 31

Refutation Graph with Unification {  P(x),R(x)} {  R(z),Q(z)} Substitution x/z {  P(x),Q(x)} {P(a)} Q(a)  Q(a) NIL Substitution a/x 32

Another Pompeian Example Prove: Marcus hates Caesar 1.man(Marcus) 2.Pompeian(Marcus) 3.  Pompeian(x1)  Roman(x1) 4.ruler(Caesar) 5.  Roman(x2)  loyalto(x2,Caesar)  hate(x2,Caesar) 6.loyalto(x3,f1(x3)) 7.  man(x4)   ruler(y1)   tryassissinate(x4,y1)   loyalto(x4,y1) 8. tryassissinate(Marcus,Caesar) 33

Another Pompeian Example 5. If x2 is Roman and not loyal to Caesar then x2 hates Caesar. 6. For every x3, there is someone he is loyal to. 7. If x4 is a man and y1 is a ruler and x4 tries to assassinate x1 then x4 is not loyal to y1. 8. Marcus tried to assassinate Caesar. 5.  Roman(x2)  loyalto(x2,Caesar)  hate(x2,Caesar) 6. loyalto(x3,f1(x3)) 7.  man(x4)   ruler(y1)   tryassissinate(x4,y1)   loyalto(x4,y1) 8. tryassissinate(Marcus,Caesar) 34

35

36

37

Monkey Solution If we change the conjecture to {  HB(s), HB(s)} the result of the refutation becomes: HB(grasp(climbbox(pushbox(c,s0))) 38

Propositional Logic Resolution Exercise Given: P V Q P -> R Q -> R Prove R 39

Predicate Logic Resolution Exercise Given: Sierra is a dog Muffy is a cat All dogs chase all cats. Prove: Sierra chases Muffy 40

Predicate Logic Resolution Exercise Given: Sierra is a dog Muffy is a cat All dogs chase all cats. Prove: Sierra chases Muffy Negate: {  chase(Sierra, Muffy) } 41 {dog(Sierra)} {cat(Muffy)}  x  y (dog(x) ˄ cat(y)) -> chase(x,y)  x  y  (dog(x) ˄ cat(y))  chase(x,y)  x  y  dog(x)   cat(y)  chase(x,y) {  dog(x),  cat(y), chase(x,y)}

42 {  chase(Sierra, Muffy) } {  dog(x),  cat(y), chase(x,y)} {  dog(Sierra),  cat(Muffy)} {dog(Sierra)} {  cat(Muffy)} cat(Muffy) NIL