Automated Reasoning Systems For first order Predicate Logic.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Inference Rules Universal Instantiation Existential Generalization
SLD-resolution Introduction Most general unifiers SLD-resolution
Logic Programming Automated Reasoning in practice.
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
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
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.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
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.
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
Logic Concepts Lecture Module 11.
Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus.
1 Applied Computer Science II Resolution in FOL Luc De Raedt.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
CSE (c) S. Tanimoto, 2008 Propositional Logic
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Inference and Resolution for Problem Solving
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
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Chapter 3 Propositional Logic
Artificial Intelligence
Artificial Intelligence Chapter 17 Knowledge-Based Systems Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Artificial Intelligence Chapter 14 Resolution in the Propositional Calculus Artificial Intelligence Chapter 14 Resolution in the Propositional Calculus.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Inference is a process of building a proof of a sentence, or put it differently inference is an implementation of the entailment relation between sentences.
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.
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.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Logical Agents Logic Propositional Logic Summary
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.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
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.
CS6133 Software Specification and Verification
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Answer Extraction To use resolution to answer questions, for example a query of the form  X C(X), we must keep track of the substitutions made during.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Knowledge Representation and Reasoning
Resolution in the Propositional Calculus
Artificial Intelligence Chapter 17 Knowledge-Based Systems
Knowledge-Based Systems Chapter 17.
Artificial Intelligence Chapter 17 Knowledge-Based Systems
Logic Use mathematical deduction to derive new knowledge.
Biointelligence Lab School of Computer Sci. & Eng.
Biointelligence Lab School of Computer Sci. & Eng.
Artificial Intelligence Chapter 17. Knowledge-Based Systems
Artificial Intelligence Chapter 17 Knowledge-Based Systems
Presentation transcript:

Automated Reasoning Systems For first order Predicate Logic

2 AR: general context.  Given is a knowledge base in predicate logic: T  is a set of formulae in first order logic  formally also called: a “Theory’’  Given is also an additional first order formula: F  Is F a logical consequence of T ?  Notation: T |= F (T implies F)  Find reasoning techniques that allow to decide on this for EACH F and T.  Requirements:  correctness -- completeness -- efficiency

3 AR: decidability.  There CANNOT EXIST AN ALGORITHM that decides whether T |= F, for any theory T and any formula F.  Theorem Church ‘36:  There exists a reasoning technique, such that for any theory T and formula F, such that T |= F, the reasoning technique proves T |= F.  SO: if F follows from T, then we find a proof, else it is possible that the procedure doesn’t terminate.  BUT: semi-decidable !  Completeness Theorem of Goedel ‘31:

4  Wrong !  Let: T = {smart(Kelly)} en F = strong(Kelly)  Although strong(Kelly)  ~strong(Kelly) is always true, we have:  neither: {smart(Kelly)} |= strong(Kelly)  nor: {smart(Kelly)} |= ~strong(Kelly)  The theorems of Church and Goedel are contradicting: We can try to prove F and ~F in parallel, and according to Goedel’s theorem one of these must succeed after a finite time. Wait a second...

5 AR: general outline (1).  First we sketch the most generally used approach for automated reasoning in first-order logic:  backward resolution  The different technical components will only be explained in full detail in a second pass (outline (2)).

6 AR: general outline (2).  We study different subsets of predicate logic:  ground Horn clause logic  Horn clause logic  Clausal logic  full predicate logic  In each case we study semi-deciding procedures.  Each extension requires the introduction of new techniques.

Backward Reasoning Resolution … in a nutshell

8 Backward resolution:  0) The task: an example.  1) Proof by inconsistency.  2) Conversion to clausal form.  3) Unification.  4) The resolution step.  5) (Backward) resolution proofs.

9 0) The TASK (example):  Are axioms: describe knowledge about some world.  z ~ q(z)  y p(f(y))  x p(x)  q(x)  r(x) T  How to prove such theorems in general?  u r(f(u))  In this world, is always true ? F p = parent f = father r = rich q = old

10 1) Proof by inconsistency  u r(f(u)) F  Don’t prove F directly:  But add the negation of F to the axioms and prove that this extension is inconsistent. ~  u r(f(u))  z ~ q(z)  y p(f(y))  x p(x)  q(x)  r(x)  NEW TASK:  is inconsistent.  the 4 axioms are never true in 1 same interpretation.

11 2) Clausal form: = Normalize the formulae to a (more simple) standard form. Notice: “  x  y …  z “ can be dropped.  Each set of axioms can be transformed into a new set of formulae, that contains only formulae of the form:  x  y…  z p(…)  q(…)  … r(…)  t(…)  s(…)  …  u(…) which is inconsistent if and only if the original set was inconsistent.  only left; only right   only left;  only right  no ~ ; no 

12 Example: Ps: usually requires much more work! : is already in clausal form: ( P  P  true )  ~  u r(f(u))  u false  r(f(u))   z ~ q(z)  z false  q(z)   y p(f(y))   x p(x)  q(x)  r(x)  x q(x)  r(x)  p(x)

13 3) Unification:  Given 2 atomic formulae:  Ex.: p(f(A),y) p(x, g(x))  find their most general common instance.  Ex.: x must become: f(A)  g(x) must become: g(f(A))  y must become: g(f(A)) p(f(A), g(f(A)))  Most general unifier (mgu) : x -> f(A)  y -> g(f(A))

14 4) The resolution step  Proposition logic: P  Q P Q ~Q ~Q~P P1  P2  …  Pn  Q1 ...  Qm R1  …  Rk  P1  S1  …  Sl P2  …  Pn  R1  …  Rk  Q1 ...  Qm  S1  …  Sl Q  P P  true Q  true Q  P false  Q false  P

15 De resolutie step (2):  Predicate logic:  Example: p(x,f(A))  q(g(x)) r(z)  p(B,z) r(f(A))  q(g(B)) mgu(p(x,f(A)), p(B,z)) = x -> B x -> B z -> f(A) z -> f(A) = mgu applied to r(z)  q(g(x)) Clauses on which resolution is performed must not have any variables in common.

16 5) Resolution proofs:  In order to prove a set of clauses inconsistent:  select 2 of them, for which resolution is possible  apply resolution and add the result to the set  if you obtain the clause false  : STOP ! This means inconsistency of the last set AND inconsistency of the original set AND that F was implied by T

17 Example: q(x)  r(x)  p(x) false  r(f(u)) false  q(z) p(f(y)) q(f(u))  p(f(u)) x -> f(u) false  p(f(u)) z -> f(u) false  false  y -> u So: inconsistent !

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

19 Horn clause logic  x1 …  xk A  B1  B2 …  Bn  All formulae in T are of the form:  where A, B1, B2,…,Bn are atoms.  An atom is a formula of the form p(t1,…,tm), with p a predicate symbol and t1,…,tm terms.  Horn clause formulae are universally quantified over all variables that occur in them.  B1,…,Bn are called body-atoms of the Horn clause; A is the head of the Horn clause.  n may be 0: in this case we say that the Horn clause is a fact.

20 Alternative notation: Implicative form Conjunctive form  x1 …  xk A  B1  B2 …  Bn  x1 …  xk A  ~B1  ~B2  …  ~Bn  Alternatively one can write a Horn Clause:  as: Q  P  Q  ~P Q  ~P  This is a special case of the “conjunctive normal form” (only disjunctions and negations), with only 1 positive disjunct.

21 Wich kind of formulae can we prove?  x1 …  xk B1  B2  …  Bn  In Horn clause logic, we limit ourselves to prove formulae F of the form:  where B1, B2, …, Bn are again atoms.  All variables are existentially quantified !

22 A very simple example:  Bosmans is a showmaster (1)  Showmasters are rich (2)  Rich people have big houses (3)  Big houses need a lot of maintenance (4)  Goal: automatically deduce that Bosmans’ house needs a lot of maintenance.

23 Representatie in Horn logica:  Bosmans is a showmaster (1)  Showmasters are rich (2)  Rich people have big houses (3)  Big houses need a lot of maintenance (4)  To prove: showmaster(Bosmans)  p rich(p)  showmaster(p)  p big(house(p))  rich(p)  p lot_maint(house(p))  big(house(p)) Lot_maint(house(Bosmans))

AR for ground Horn clause logic Backward (and forward) reasoning proof procedures based on generalized Modus Ponens

25 Restricting to ground Horn clauses: showmaster(Bosmans) rich(Bosmans)  showmaster(Bosmans) big(house(Bosmans))  rich(Bosmans) lot_maint(house(Bosmans))  big(house(Bosmans))  So, for now: Horn clauses without variables:  Example: lot_maint(house(Bosman))  Prove:

26 Easy with modus ponens ! big(house(Bos))  rich(Bos) big(house(Bos))  3 applications of modus ponens: showm(Bos) rich(Bos)  showm(Bos) rich(Bos)  gives the desired conclusion. lot_maint(house(Bos))  big(house(Bos)) lot_maint(house(Bos))

27 Modus ponens in AR: B A  B A For any interpretation making both B and A  B true (= any model of {B, A  B} )  Modus ponens is correct: A is also true in this interpretation (see truth tables)  Problem: how to organize this into a procedure which is also complete (for ground Horn clauses)?

28 Generalized Modus ponens B1 B2 … Bn A  B1  B2  …  Bn A  Increase the number of conjuncts:  Is obviously still correct (truth tables).

A glimpse at a Forward Reasoning Modus Ponens strategy

30 A forward proof procedure Derived := { }; Repeat Select some A  B1  B2  …  Bn from T, such that all B1, B2, …, Bn  Derived, and A  Derived; and A  Derived; Derived:= Derived  {A}; Derived:= Derived  {A}; Until all atoms of F = C1  C2  …  Cm are in Derived or no more Selection are possible or no more Selection are possible  Given theory T and formula F:  If all atoms from F are in Derived at termination, then T implies F, otherwise it doesn’t.

31 Extended example:  One possible derivation: Step 0: Derived := { } Step 1: Derived := {showm(Bos)} Step 2: Derived := Derived  {belg(Bos)} Step 3: Derived := Derived  {european(Bos)} Step 4: Derived := Derived  {rich(Bos)} Step 5: Derived := Derived  {big(house(Bos))} End : Derived := Derived  {lot_maint(house(Bos))} european(Bos)  belg(Bos) rich(Bos)  showm(Bos)  european(Bos) big(house(Bos))  rich(Bos) lot_maint(house(Bos))  big(house(Bos)) showm(Bos) belg(Bos)

32 Remarks:  Correctness: generalized modus ponens is correct  Completeness: intuition:  for a finite ground Horn clause theory, only a finite number of ground atoms are implied  these are all derived after finite time  Efficiency:  can be extremely slow !  If T contains many Horn clauses unrelated to F, then the procedure derives many irrelevant (for F ) atoms.

Backward reasoning For ground Horn Clause logic

34 Inconsistency: T implies F iff Each model of T makes F true iff Each model of T makes ~F false iff T  {~F} has no model iff T  {~F} is inconsistent  A theory T is inconsistent if it has NO model. Let T be a theory and F a formula. T implies F if and only if T  {~F} is inconsistent.  Theorem:  Proof:

35 The example again:  Prove that the theory: showm(Bos) belg(Bos) european(Bos)  belg(Bos) rich(Bos)  showm(Bos)  european(Bos) big(house(Bos))  rich(Bos) lot_maint(house(Bos))  big(house(Bos)) ~ lot_maint(house(Bos))  is inconsistent.  Problem: this is NOT a Horn clause theory !?

36 Refutation proofs: the “false” predicate false  We introduce a new predicate symbol:  We agree that false has the truth value ‘false’ under every interpretation.  Imagine that we defined false as : false  p  ~p for some predicate p

37 “definite” goals:  In the Horn logic setting F has the form:  x1 …  xm B1  B2  …  Bn  So what is the form of ~F? ~(  x1 …  xm B1  B2  …  Bn)   x1 …  xm ~(B1  B2  …  Bn)   x1 …  xm false  ~(B1  B2  …  Bn)   x1 …  xm false  B1  B2  …  Bn A  ~B  A  B  Observe: ~F is again a Horn clause !!

38 In conjunctive normal form:  Again:  x1 …  xm false  B1  B2  …  Bn  is equivalent with:  x1 …  xm false  ~B1  ~B2  …  ~Bn  x1 …  xm ~B1  ~B2  …  ~Bn 0 positive disjuncts !  As a special case, “false” is the empty disjunction: false   Implicative en disjunctive form remain consistent  (an empty disjunction is always false)

39 Back to the example  a ground Horn clause theory ! showm(Bos) belg(Bos) european(Bos)  belg(Bos) rich(Bos)  showm(Bos)  european(Bos) big(house(Bos))  rich(Bos) lot_maint(house(Bos))  big(house(Bos)) false  lot_maint(house(Bos))  The extended theory (to be proven inconsistent) now is:

40 Modus ponens generalized some more:  Ordinary Modus ponens is the special case with:  n = i = 1 and m =0  Correctness: via truth tables A  B1  B2  …  Bi  …  Bn Bi  C1  C2  …  Cm A  B1  B2  …  C1  C2  …  Cm  …  Bn

41 Some backward reasoning steps in the example:  and so on... false  lot_maint(house(Bos)) lot_maint(house(Bos))  big(house(Bos)) false  big(house(Bos)) big(house(Bos))  rich(Bos) false  rich(Bos)

42 The backward procedure: the idea  Convert F into a definite goal: false  B1  B2  …  Bi  …  Bn  Apply generalized modus ponens to the body-atoms Bi of the goal, using the Horn clauses of T  until: is deduced. false   Then: a false formula ia a consequence of T  {~F} we have proven inconsistency of T  {~F}

43 Backwards procedure  On top of this you need to apply backtracking over the selected clauses and the selected body atoms.  If the algorithm stops because it has tried all these alternatives: F was not implied! Goal := false  B1  B2  …  Bn ; Repeat Select some Bi atom from the body of Goal Select some clause Bi  C1  C2  …  Cm from T Select some clause Bi  C1  C2  …  Cm from T Replace Bi in the body of Goal by C1  C2  …  Cm Until Goal = false  or no more Selections possible

44 Back to the example Step 0: Goal := false  lot_maint(house(Bos)) select: lot_maint(house(Bos))  big(house(Bos)) Step 1: Goal := false  big(house(Bos)) select: big(house(Bos))  rich(Bos) Step 2: Goal := false  rich(Bos) select: rich(Bos)  showm(Bos)  european(Bos) Step 3: Goal := false  showm(Bos)  european(Bos) select: showm(Bos) Step 4: Goal := false  european(Bos) select: european(Bos)  belg(Bos) Step 5: Goal := false  belg(Bos) select: belg(Bos) Step 6: Goal := false 

45 p  q  r q  t q  s r  n r  o son Another example (propositional)  Prove: p  Observe: non-determinism on both atom selection and on clause selection !  we only illustrate the clause selection here

46 Search tree traversed by the backward procedure p  q  r q  t q  s r  n r  o son false  p false  q  r false  t  r false  s  r false  r false  n false  o false 

47 Backward procedure is more efficient  The proof is now goal directed towards the theorem.  no more exploration of irrelevant rules  Different search methodes can be used to traverse this search tree.  Atom-selection may influence efficiency too:  ex.: by detecting a failing branch sooner  but has no impact on whether or not we find a solution (in case there are only finitely many ground Horn clauses) (in case there are only finitely many ground Horn clauses)

48 Completeness:  Example: false  p p  p (1) p (2)  Possible derivations: false  p (1) (1) ……(1) false  (2)  Is only complete if the search tree is traversed using a complete search method.

49 Representation-power of ground Horn clauses  Is  a subset of propositional logic. showm(Bos) showm_Bos big(house(Bos)) big_house_Bos  Example:  In general, more expressive logics are needed.  Essence: with variables, one formula may be equivalent to a very large number of propositional formulae.