AR: clausal logic The step to Resolution. A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic.

Slides:



Advertisements
Similar presentations
Resolution Proof System for First Order Logic
Advertisements

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),
AR for Horn clause logic Introducing: Unification.
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Introduction to Theorem Proving
Standard Logical Equivalences
Automated Reasoning Systems For first order Predicate Logic.
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.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
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
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.
Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus.
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.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
Inference and Resolution for Problem Solving
Logic in Computer Science Transparency No Chapter 3 Propositional Logic 3.6. Propositional Resolution 3.7. Natural Deduction.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Knoweldge Representation & Reasoning
Inference in First-Order Logic
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Chapter 3 Propositional Logic
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
CS1502 Formal Methods in Computer Science Lecture Notes 10 Resolution and Horn Sentences.
SAT-solving An old AI technique becomes very popular in modern A.I.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: ResolutionUnificationNormalization.
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.
Propositional Resolution Computational LogicLecture 4 Michael Genesereth Spring 2005.
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.
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 19, 2012.
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.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Resolution Strategies One common strategy for applying resolution is called level saturation. Here you try to resolve every pair of clauses from the original.
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.
Automated Reasoning Systems For first order Predicate Logic.
Extra slides for Chapter 3: Propositional Calculus & Normal Forms Based on Prof. Lila Kari’s slides For CS2209A, 2009 By Dr. Charles Ling;
Reasoning using First-Order Logic
For Wednesday Finish reading chapter 10 – can skip chapter 8 No written homework.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
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.
AR for Horn clause logic Introducing: Unification.
Introduction to Logic for Artificial Intelligence Lecture 2
Resolution in the Propositional Calculus
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Artificial Intelligence
Carlos Varela Rensselaer Polytechnic Institute November 10, 2017
Prolog IV Logic, condensed.
Biointelligence Lab School of Computer Sci. & Eng.
RESOLUTION.
Teorie assiomatico-deduttive (calcolo dei predicati)
Resolution Proof System for First Order Logic
Presentation transcript:

AR: clausal logic The step to Resolution

A deeper study: Modus ponens Ground Horn Logic Unification Horn Logic Resolution Clausal Logic Clausal Logic

3 Representation-power of Horn clauses  Most predicate logic formulae can easily be rewritten in Horn clauses.  Examples:  x cat(x)  dog(x)  pet(x)  x poodle(x)  dog(x)  small(x) pet(x)  cat(x) pet(x)  dog(x) dog(x)  poodle(x) small(x)  poodle(x)  BUT:  x human(x)  male(x)  female(x)  x dog(x)  ~abnormal(x)  has_4_legs(x) ????

4 Clausal form  Generalized form of the formulae:  x1 …  xk A1  A2 …  Am  B1  B2 …  Bn  Horn clauses are a special case with m = 1  We assume that S = T  {~F} consists only of clausal formulae.  Goal: prove that S is inconsistent.

5 Example: Moore’s problem BlueorRed Blue or Red  Given 3 blocks:  Prove that there is a blue block next to a red block!

6 Moore’s problem (2): This would require a case-analysis!  In clausal form: blue(Block1)red(Block3) blue(Block2)  red(Block2) next_to(Block1,Block2)next_to(Block2,Block1)next_to(Block2,Block3)next_to(Block3,Block2)  Prove:  or false  next_to(b1,b2)  blue(b1)  red(b2) is inconsistent.  b1  b2 next_to(b1,b2)  blue(b1)  red(b2)  PROBLEM: Modus ponens is not suitable for blue(Block2)  red(Block2)

7 high_qualified(x)  phd(x) earn_early(x)  ~phd(x) rich(x)  high_qualified(x) rich(x)  earn_early(x) (1)(2)(3)(4) Introducing negation in bodies is equivalent:  Example:  Prove: rich(I)  Why equivalent?  (2) is equivalent to earn_early(x)  phd(x) since A  ~B  A  B

8 Disjunction versus negation in general:  x1 …  xk A1  A2 …  Am  B1  B2 …  Bn  is equivalent to:  x1 …  xk A1  B1  B2 …  Bn  ~A2  …  ~Am  or to:  x1 …  xk Ai  B1  B2 …  Bn  ~A1 ....  ~Am  Proof: A  ~B  A  B and basic relations between ,  and ~ A  ~B  A  B

9 The resolution principle A1  A2  …  Am  B1  …  B  …  Bn C1 ...  B  …  Ck  D1  D2  …  Dl A1  A2  …  Am  C1 ....  Ck  B1 ....  Bn  D1  D2  …  Dl B1 ....  Bn  D1  D2  …  Dl  Propositional case:  Correctness: clear due to:  make from all other disjuncts negated body atoms,  apply generalized modus ponens,  move all these negated body atoms back as disjuncts in the head.

10 Resolution: predicate logic  where  = mgu(B,B’).  Correctness:  with a help of the correctness result for the ground case, applied to all instances of this rule A1  A2  …  Am  B1  …  B  …  Bn C1 ...  B’  …  Ck  D1  D2  …  Dl (A1  A2  …  Am  C1 ....  Ck)   (B1 ....  Bn  D1  D2  …  Dl)  (B1 ....  Bn  D1  D2  …  Dl) 

11 Also in other forms:  In conjunctive normal form:  with  = mgu(B,B’). A1  A2  …  Am  ~B1  …  ~B  …  ~Bn C1 ...  B’  …  Ck  ~D1  ~D2  …  ~Dl (A1  A2  …  Am  C1 ....  Ck)   (~B1 ....  ~Bn  ~D1  ~D2  …  ~Dl)  (~B1 ....  ~Bn  ~D1  ~D2  …  ~Dl) 

12 Once again Moore’s example blue(Block2)  red(Block2) red(Block2)  next_to(Block2,b2)  red(b2) blue(Block1)red(Block3) blue(Block2)  red(Block2) next_to(Block1,Block2)next_to(Block2,Block1)next_to(Block2,Block3)next_to(Block3,Block2) red(Block2)  next_to(Block2,Block3) red(Block3) red(Block2) next_to(Block2,Block3) false  next_to(b1,Block2)  blue(b1) false  next_to(b1,b2)  blue(b1)  red(b2) false  next_to(Block1,Block2) blue(Block1) false  next_to(Block1,Block2) false  next_to(b1,b2)  blue(b1)  red(b2)

13 Ph.D. example rich(x) false  rich(I) false  factoring earn_early(x)  highly_qualified(x) rich(y)  highly_qualified(y) rich(x)  rich(x) earn_early(x)  rich(x) rich(y)  earn_early(y) highly_qualified(y)  phd(y) earn_early(x)  phd(x) highly_qualified(x)  phd(x) earn_early(x)  phd(x) rich(x)  highly_qualified(x) rich(x)  earn_early(x) (1)(2)(3)(4) false  rich(I)

14 Factoring: in general  Both:  with:  is mgu(B,B’) A1  A2  …  Am  B1  …  B  …  B’ …  Bn (A1  A2  …  Am  B1  …  B  …  …  Bn)   as:  with:  is mgu(A,A’). A1  …  A  …  A’ …  Am  B1  …  Bn (A1  …  A  …  …  Am  B1  …  Bn) 

15 Why do we need factoring? p  q p  q false  p q false  p  q q  p (p  q)  (p  ~q)  (~p  q)  (~p  ~q)  Without factoring resolution is not complete !  Example: prove {(p  ~p)  (q  ~q)} inconsistent  Normalization:  Clausal form: p  p q  q p  q q  p You can never get false  !!!!

16 Reason?  The length of a formula = the number of atoms (false not included): A1  A2  …  Am  B1  …  B  …  Bn C1 ...  B’  …  Ck  D1  D2  …  Dl (A1  A2  …  Am  C1 ....  Ck)   (B1 ....  Bn  D1  D2  …  Dl)  (B1 ....  Bn  D1  D2  …  Dl) LengthNM N + M - 2  In the previous example all formulas had length 2 You can NEVER get false  (length 0) !

17 The resolution procedure :=initial theory (inconsistency to be shown); S:= initial theory (inconsistency to be shown); Consistent:= false; Inconsistent:= false; While not(Consistent) and not(Inconsistent) do If false   S Then Inconsistent := true Else If S contains no pair (F,G) resolvable and not yet resolved yet resolved Then Consistent:= true Then Consistent:= true Else SELECT a pair (F,G) from S, resolvable and not yet resolved; and not yet resolved; H:= factor( resolvent (F,G) ); H:= factor( resolvent (F,G) ); S:= S  H S:= S  H End-while

18 Behavior under Horn clause resolution : false ... … ... false  false ... … ... false ... …  Linear resolution !

19 Behavior under General resolution : General resolution ! … ... false 

20 Linear resolution:  The most important differences with Horn clauses:  With Horn clauses the proofs are always LINEAR !  we start with the “goal”  we apply a Horn clause to compute a new goal  etc.  Clausal resolution is NOT linear  Also: factoring is sometimes needed  Linear resolution (a proof is a linear sequence of resolution steps starting with a goal) is one of the most important strategies to make the resolution process efficient.

21 Non-determinism in the resolution procedure  SELECT a pair (F,G) : makes it a VERY non- deterministic procedure.  The control problem for resolution is extremely difficult.  A proof is no longer 1 (linear) branch in a tree, but a subgraph of all possible resolutions.  Is it correct? Is it complete? ? Is there a complete strategy ???

22 Correctness / Completeness ?  Completeness: There exists a complete strategy (standard example: the Herbrand theorem prover).  Correctness:  If the procedure returns Inconsistent:  Then false  is added  Then false  is logically entailed by S (since the resolution step is correct).  Thus, in all models of S false  is also true  Thus, S has no models

23 … ... Correctness/Completeness 2 ?  If the procedure returns Consistent:  Then ALL POSSIBLE resolution steps were done without discovering false .  Now assume that the set was inconsistent.  There exists a COMPLETE strategy: that after some time derives false   But it performs (a part of) the same resolution steps !! Our strategy also produced Our strategy also produced false  … ... …  … false 

AR for full predicate logic Normalization to clausal form

25 What else is needed for full predicate logic? NOTHING!  Clausal logic is equivalent to full predicate logic:  every theory T in FOL (first order predicate logic) can automatically be converted in a clausal theory T’, such that: T is inconsistent iff T’ is inconsistent

26 Propositional: via conjunctive normal form:  Every formula is equivalent to a formula of the form: (A1 ...  An)  (B1  …  Bm)  …  (C1  …  Ck)  where all Ai, Bi, …, Ci are either atomic or ~atomic.  Idea: p  q p  q push all ~ as deep as possible apply distributivity of  and  p  q  q  p q  ~p  Finally: p1  …  pn  ~q1  … ~qm p1  …  pn  q1  …  qm

27 Predicate case: main steps Sometimes requires new variable names. Ex.:  x p(x)   x q(x)  x  z p(x)  q(z) Note:  x cloudy(x)   x sunny(x) is not equivalent to  x cloudy(x)  sunny(x)  Prenix normal form (Q1 x) (Q2 y) …(Qn z) F  or  has no quantifiers !  Conjunctive normal form: (Q1 x) (Q2 y) …(Qn z) (.. .. )  (.. .. ) ..  (.. .. )  These 2 steps are interleaved.

28 Predicate case: continued Skolem functions: as many arguments as enclosing  -variables  Skolem normal form: transform to: (  x) (  y) …(  z) (.. .. )  (.. .. ) ..  (.. .. )   x rich(x) is replaced by rich(Sk), with Sk being a new constant (‘skolem constant’) that does not appear in the alphabet.  More complex: if  appears nested inside  :  ‘Everyone has a heart’  x person(x)   y heart(y)  has(x,y)  Not correct:  x person(x)  heart(H)  has(x,H)  Correct:  x person(x)  heart(H(x))  has(x,H(x))

29 Predicate case: continued  Clausal form:  x  y  z (p(x)  ~q(y)  ~r(y))  (r(A)  q(z))  (r(A)  q(z))  ~s(x,y)  ~s(x,y) S = {  x  y (p(x)  ~q(y)  ~r(y)),  z (r(A)  q(z)),  z (r(A)  q(z)),  x  y ~s(x,y) }  x  y ~s(x,y) } S = {p(x)  q(y)  r(y), r(A)  q(z)), r(A)  q(z)), false  s(x,y) } false  s(x,y) }  Disjunctions:

30 Explicit Procedure: 1. Eliminate  en . 2. Move the negations inside: ~(~p)  p, ~(p  q)  ~p  ~q, (analogously for  ) ~  x   x ~, ~  x   x ~ 3. Standardize variable names (make them different). PRENEX NORMAL FORM 4. Move quantifiers to front. INTRODUCE SKOLEMS 5. Eliminate . CONJUNCTIVE FORM 6. Disjunctions inside. DISJUNC. SET 7. Drop . 8. Drop . CLAUSAL FORM 9. ~atoms to the other side.

31 Marcus example:  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)  x loyal_to(x,f(x)) loyal_to(x,f(x))  Facts 1., 2., 4. and 8. were already o.k.:  ex.: ruler(Caesar)  3.  x Pompeian(x)  Roman(x) : o.k. !  6.  x  y loyal_to(x,y)  7.  x  y man(x)  ruler(y)  try_assassinate(x,y)  ~loyal_to(x,y)

32 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) To show: hates(Marcus,Caesar) Negation: ~hates(Marcus,Caesar) Normal Form: false  hates(Marcus,Caesar)

33 Resolution proof (1): 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.

34 Resolution proof (2) 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.{}

35 Example from Group Theory:  Let  be a group operation.  Prefix notation: p(x,y,z)  x  y = z  Definition of a monoid, with left-neutral and left inverse element:   is defined for all elements of the set:  x  y  z p(x,y,z)   is associative:(x  y)  z = x  (y  z) uv  x  y  z  u  v  w (p(x,y,u)  p(y,z,v))  (p(u,z,w)  p(x,v,w)) (1) (2)

36 Example from Group Theory (2):   has a left neutral and a left inverse element:  x (  y p(x,y,y)   y  z p(z,y,x)  Theorem: there exists also a right inverse ! (3)  x (  y p(x,y,y)   y  z p(y,z,x) (4)  To be proved automatically by resolution.

37 Normalization: (1)  x  y  z p(x,y,z)  Steps: 1,2,3,4: o.k.  Step 5: skolemization:  x  y p(x,y,m(x,y))  Steps: 6,7: o.k.  Step 8: clausal form: p(x,y,m(x,y))

38 Normalization (continued): (2)  x  y  z  u  v  w (p(x,y,u)  p(y,z,v))  (p(u,z,w)  p(x,v,w))  Step 1: eliminate  and  :  x  y  z  u  v  w (p(x,y,u)  p(y,z,v))  ((p(u,z,w)  p(x,v,w))  (p(x,v,w)  p(u,z,w))) ((p(u,z,w)  p(x,v,w))  (p(x,v,w)  p(u,z,w)))  x  y  z  u  v  w (p(x,y,u)  p(y,z,v))  ((~p(u,z,w)  p(x,v,w))  (~p(x,v,w)  p(u,z,w))) ((~p(u,z,w)  p(x,v,w))  (~p(x,v,w)  p(u,z,w)))  x  y  z  u  v  w ~(p(x,y,u)  p(y,z,v))  ((~p(u,z,w)  p(x,v,w))  (~p(x,v,w)  p(u,z,w))) ((~p(u,z,w)  p(x,v,w))  (~p(x,v,w)  p(u,z,w)))

39 Normalization (continued):  x  y  z  u  v  w ~(p(x,y,u)  p(y,z,v))  ((~p(u,z,w)  p(x,v,w))  (~p(x,v,w)  p(u,z,w))) ((~p(u,z,w)  p(x,v,w))  (~p(x,v,w)  p(u,z,w)))  x  y  z  u  v  w (~p(x,y,u)  ~p(y,z,v))  ((~p(u,z,w)  p(x,v,w))  (~p(x,v,w)  p(u,z,w))) ((~p(u,z,w)  p(x,v,w))  (~p(x,v,w)  p(u,z,w)))  Step 2: move negation inside:  Steps: 3,4,5 o.k.  Step 6: move disjunctions inside:  x  y  z  u  v  w ((~p(x,y,u)  ~p(y,z,v))  (~p(u,z,w)  p(x,v,w)))  ((~p(x,y,u)  ~p(y,z,v))  (~p(x,v,w)  p(u,z,w))) A  (B  C) A  (B  C) = (A  B)  (A  C) A  B A  C

40 Normalization (continued):  x  y  z  u  v  w ((~p(x,y,u)  ~p(y,z,v))  (~p(u,z,w)  p(x,v,w)))  ((~p(x,y,u)  ~p(y,z,v))  (~p(x,v,w)  p(u,z,w)))  x  y  z  u  v  w ((~p(x,y,u)  ~p(y,z,v))  (~p(u,z,w)  p(x,v,w)))  ((~p(x,y,u)  ~p(y,z,v))  (~p(x,v,w)  p(u,z,w)))  + remove redundant parentheses: ( )  x  y  z  u  v  w (~p(x,y,u)  ~p(y,z,v)  ~p(u,z,w)  p(x,v,w))  (~p(x,y,u)  ~p(y,z,v)  ~p(x,v,w)  p(u,z,w))  Steps 7,8: eliminate  en  : ~p(x,y,u)  ~p(y,z,v)  ~p(x,v,w)  p(u,z,w) ~p(x,y,u)  ~p(y,z,v)  ~p(u,z,w)  p(x,v,w)