1 / 49

Automated Reasoning Systems

Automated Reasoning Systems. For first order Predicate Logic. Is F a logical consequence of T ?. 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’’.

finola
Download Presentation

Automated Reasoning Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Automated Reasoning Systems For first order Predicate Logic

  2. Is F a logical consequence of T ? 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 • 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. There CANNOT EXIST AN ALGORITHMthat decides whether T|=F, for any theory T and any formula F. • There exists a reasoning technique, such that for any theory T and formula F, such that T|=F, the reasoning technique provesT |= F. AR: decidability. • Theorem Church ‘36: • BUT: semi-decidable ! • Completeness Theorem of Goedel ‘31: • SO: if F follows from T, then we find a proof, else it is possible that the procedure doesn’t terminate.

  4. 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 ... • 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)

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

  6. ground Horn clause logic AR: general outline (2) . • We study different subsets of predicate 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.

  7. Backward Reasoning Resolution … in a nutshell

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

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

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

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

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

  13. Ex.: p(f(A),y) p(x, g(x)) • 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))) 3) Unification: • Given 2 atomic formulae: • find their most general common instance. • Most general unifier (mgu) : x -> f(A) • y -> g(f(A))

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

  15. 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 z-> f(A) De resolutie step (2): • Predicate logic: • Example: = mgu applied tor(z) q(g(x)) Clauses on which resolution is performed must not have any variables in common.

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

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

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

  19. All formulae in T are of the form: • x1 … xk A B1 B2 … Bn Horn clause logic • 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. Alternatively one can write a Horn Clause: • as: • x1 … xk A B1 B2 … Bn Q  P Q  ~P • x1 … xk A  ~B1  ~B2  …  ~Bn Implicative form Conjunctive form Alternative notation: • This is a special case of the “conjunctive normal form” (only disjunctions and negations), with only 1 positive disjunct.

  21. In Horn clause logic, we limit ourselves to prove formulae F of the form: • where B1, B2, …, Bn are again atoms. x1 … xk B1  B2  … Bn Wich kind of formulaecan we prove? • 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))

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

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

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

  27. Modus ponens is correct: B A  B For any interpretation making both B and A  B true(= any model of {B , A  B} ) A Modus ponens in AR: 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. Increase the number of conjuncts: B1 B2 … Bn A  B1  B2  …  Bn A Generalized Modus ponens • Is obviously still correct (truth tables).

  29. A glimpse at a Forward Reasoning Modus Ponens strategy

  30. Derived := { }; Repeat Select someA  B1  B2  …  Bnfrom T, such that allB1,B2,…,BnDerived, andADerived; Derived:= Derived {A}; Until all atoms ofF=C1  C2  …  Cmare in Derived or no more Selection are possible A forward proof procedure • 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. 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)) 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))}

  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.

  33. Backward reasoning For ground Horn Clause logic

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

  35. Prove that the theory: The example again: 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. We introduce a new predicate symbol: false Refutation proofs:the “false” predicate • 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. In the Horn logic setting F has the form: x1 … xm B1  B2  … Bn “definite” goals: • 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. Again: • x1 … xm false  B1  B2  … Bn x1 … xm false  ~B1  ~B2  …  ~Bn • is equivalent with: x1 … xm ~B1  ~B2  …  ~Bn • As a special case, “false” is the empty disjunction: false  In conjunctive normal form: 0 positivedisjuncts! • Implicative en disjunctive form remain consistent • (an empty disjunction is always false)

  39. The extended theory (to be proven inconsistent) now is: 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)) Back to the example • a ground Horn clause theory !

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

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

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

  43. Goal := false  B1  B2  …  Bn; Repeat Select someBiatom from the body of Goal Select some clauseBi  C1  C2  …  CmfromT ReplaceBiin the body of Goal byC1  C2  …  Cm UntilGoal = false  or no more Selections possible 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!

  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 s o n Another example (propositional) • Prove: p • Observe: non-determinism on both atom selection and on clause selection ! • we only illustrate the clause selection here

  46. false q r false t r false  s r false r false n false o false  false  Search tree traversed bythe backward procedure false p p  q  r q  t q  s r  n r  o s o n

  47. Backward procedure is more efficient • The proof is now goal directed towards the theorem. • no more exploration of irrelevant rules • Different search methodescan 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)

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

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

More Related