1 / 30

Chapter 2 & 3 (Part 2): A Representation & Reasoning System & Using Definite Knowledge

Chapter 2 & 3 (Part 2): A Representation & Reasoning System & Using Definite Knowledge. Proofs (2.7) (How to compute logical consequences of a KB rather that testing whether a given formula is a KB logical consequence?) Functions Symbols: Language Extension (2.8)

jamar
Download Presentation

Chapter 2 & 3 (Part 2): A Representation & Reasoning System & Using Definite Knowledge

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. Chapter 2 & 3 (Part 2):A Representation & Reasoning System & Using Definite Knowledge Proofs (2.7) (How to compute logical consequences of a KB rather that testing whether a given formula is a KB logical consequence?) Functions Symbols: Language Extension (2.8) Representing Abstract Concepts (3.5) D. Poole, A. Mackworth, and R. Goebel, Computational Intelligence: A Logical Approach, Oxford University Press, January 1998

  2. Proofs (2.7) • A proof is a mechanically derivable demonstration that a formula logically follows from a knowledge base. • Given a proof procedure, KB g means g can be derived from knowledge base KB. • Recall KBg means g is true in all models of KB. • A proof procedure is sound (w.r.t. a semantics) if KB g implies KB g (every thing that can be derived from KB is a logical consequence of KB). • A proof procedure is complete (w.r.t a semantics) if there is a proof of each logical consequence of KB: That is, if KB g implies KB g (there is a proof of g). CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  3. Proof (2.7) (cont.) • Bottom-up Ground Proof Procedure • One rule of derivation, a generalized form of modus ponens: • If “h  b1 …  bm”is a clause in the knowledge base, and each bi has been derived from KB, then h can be derived from KB. • You are forward chaining on this clause (going forward from what is known but not backward from the query!). • (This rule also covers the case when m = 0. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  4. (C: consequence set) Proof (2.7) (cont.) • Bottom-up proof procedure If g C then g is proven CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  5. Proof (2.7) (cont.) • Example a b ^ c. b d ^ e. b g ^ e. c e. d. e. fa ^ g. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  6. Proof (2.7) (cont.) • Example (cont.) {} {d} {e,d} {c,e,d} {b,c,e,d} {a,b,c,e,d} CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  7. Proof (2.7) (cont.) • Soundness of bottom-up proof procedureIf KB g then KB g. (every atom in C is a logical consequence of KB) Suppose there is a g (atom) such that KB g and KB g. Let g be the first atom added to C that’s not true in every model of KB. Suppose g isn’t true in model Iof KB.There must be a clause in KB of form: g  b1 …  bm where: Each bi is true in I (since g is the first) and g is false in I. So this clause is false in I. Therefore I isn’t a model of KB. Contradiction: thus no such g exists ! CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  8. Proof (2.7) (cont.) • Fixed Point • The C generated at the end of the bottom-up algorithm is called a fixed point (any further application of the rule won’t change C). • Let I be the interpretation in which every element of the fixed point is true and every other atom not in C is false Then I is a model of KB. Proof: suppose h  b1 …  bm in KB is false in I. The only way this could happen is if b1,b2…,bm C and h C. Thus h can be added to C. Contradiction to C being the fixed point. In conclusion, there can be no clause in KB that is false in the interpretation I (e.g., I is a model) • I is called a Minimal Model. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  9. Proof (2.7) (cont.) • Completeness of the bottom-up proof • If KB g then KB g. Suppose KB g. Then g is true in all models of KB. Thus g is true in the minimal model (defined by the fixed point). Thus g is generated by the bottom up algorithm. Thus KB g. • Complexity of the bottom-up proof: • The bottom-up proof algorithm halts and is linear w.r.t. to the size of the knowledge base. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  10. Proof (2.7) (cont.) • Top-down Proof Procedure • Idea: search backward from a query to determine if it is a logical consequence of KB. • An answer clause is of the form: yes a1a2 … am • The SLD (Selector Function on Definite Clauses) Resolution of this answer clause on atom aiwith the clause: aib1…bp is the answer clause yes a1…ai-1b1…bpai+1…am CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  11. Proof (2.7) (cont.) • Top-down Ground Proof Procedure (cont.) • Derivations • An answer is an answer clause with m = 0. That is, it is the answer clause yes  . • A derivation of query “?q1…qk” from KB is a sequence of answer clauses y0; y1, …, ynsuch that • y0 is the answer clause yes q1 … qk, (query) • yi is obtained by resolving yi-1 with a clause in KB, and • ynis an answer. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  12. Proof (2.7) (cont.) • Top-down ground proof procedure (cont.) • Search backward from a query to determine if it is a logical consequence of the given clauses Solve(q1^ ^… ^qk)ac:=“yes q1^ ^… ^qk”repeatselect a conjunct ai from the body of acchoose clause C from KB with ai as head replace ai in the body of ac by the body of Cuntil ac is an answer CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  13. Proof (2.7) (cont.) • Example a b ^c. bd ^e. bg^e. ce. d. e. fa ^g. ?a. (query) CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  14. Proof (2.7) (cont.) • Example (cont.) ac:=yes a. yesb ^c. (select b and choose b d ^e) yesd ^ e^c. (or g ^e: failure: no rule chosen headed by g!) yese ^c. yesc. yese. yes. “The two operations involved are “select” (What to Do ?) and “choose” (How to Do ?). CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  15. Proof (2.7) (cont.) • Nondeterministic Choice • “Don’t-care nondeterminism”: If one selection doesn’t lead to a solution, there is no point in trying other alternatives. Select [no resources available: requests should not be kept waiting! No backtracking] • “Don’t-know nondeterminism”: If one choice doesn’t lead to a solution, other choices may, but this search may be prohibitive. Choose (NP≠ P: no polynomial oracle does exist!) CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  16. Proof (2.7) (cont.) • Reasoning with Variables • An instance of an atom or a clause is obtained by uniformly substituting terms for variables. • A substitution is a finite set of the form {V1/ t1, …, Vn/ tn}, where each Viis a distinct variable and each tiis a term. • The application of a substitution  ={V1/ t1, …, Vn / tn} to an atom or clause e, written e, is the instance of e with every occurrence of Vireplaced by ti. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  17. Proof (2.7) (cont.) Application Examples Z CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  18. Proof (2.7) (cont.) • Unifiers • Substitution is a unifier of e1 and e2 if e1 = e2. • Substitution is a most general unifier (mgu) of e1 and e2 if •  is a unifier of e1 and e2; and • if substitution ’ also unifies e1 and e2, then e’is an instance of efor all atoms e. • If two atoms have a unifier, they have a most general unifier. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  19. Proof (2.7) (cont.) • Unification Example CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  20. Proof (2.7) (cont.) • Most General Unifiers • Example: Atoms e1= p(X,Y) and e2=p(Z,Z) have as unifiers: 1={X/b, Y/b, Z/b}, 2={X/c, Y/c, Z/c} and 3={X/Z, Y/Z}. The 3 unifier is mgu, since: • 3 unifies e1 and e2 • If 1= ’then e1’=p(b,b)is an instance of e13=p(Z,Z) Similarly, e2’=p(b,b)is an instance of e23=p(Z,Z) If 2= ’then e1’=p(c,c)is an instance of e13=p(Z,Z) Similarly, e2’=p(c,c)is an instance of e23=p(Z,Z) CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  21. Proof (2.7) (cont.) • Proofs using Bottom-up Procedure with Variables • A ground instance of a clause is obtained by uniformly substituting constants appearing in a KB or in any query for the variables in the clause CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  22. Proof (2.7) (cont.) • Example q(a). q(b). r(a). s(W) r(W). p(X,Y) q(X) ^ s(Y). The set of all ground instances is: q(a). q(b). r(a). s(a) r(a) s(b) r(b) CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  23. Proof (2.7) (cont.) • Example (cont’d) p(a,a)  q(a) ^ s(a). p(a,b)  q(a) ^ s(b). p(b,a)  q(b) ^ s(a). p(b,b)  q(b) ^ s(b) the bottom-up proof procedure will derive: q(a), q(b), r(a), s(a), p(a,a) and p(b,a). CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  24. Proof (2.7) (cont.) • Definite Resolution with Variables: Top-down Derivation • A generalized answer clause is of the form yes(t1,…,tk) a1 a2… am where t1, …, tk are terms and a1, …, am are atoms. • The SLD resolution of this generalized answer clause on ai with the clause a  b1… bp • where ai and a have most general unifier , is the clause: (yes (t1, …, tk)  a1… a i-1 b1… bp a i+1… am CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  25. : Proof (2.7) (cont.) • To solve query ?B with variables V1, …, Vk Set ac to generalized answer clause yes(V1, …, Vk) B; while ac is not an answer do \\ (yes .) is false Suppose ac is yes(t1, …, tk)  a1 a2 …  am Select atom ai in the body of ac; Choose clause a  b1 …  bp in KB; Rename all variables in a  b1 … bp to have new names; Let  be the most general unifier of ai and a. Fail if they don’t unify; Set ac to (yes(t1, …, tk)  a1 …  ai-1 b1 … bp ai+1 … am) end while. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  26. Proof (2.7) (cont.) • Example1 Consider the database of Figure 2.3 (page 44) and the query: You want to know: Which room is two doors east of r107 ? You translate the query ? two_doors_east(R,r107) into: yes(R) (class exercise). two_doors_east(R,r107) CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  27. Proof (2.7) (cont.) Solution: ?two_doors_east(R, r107). yes(R)two_doors_east(R, r107) % this is ac % resolve with two_doors_east(E1,W1)imm_east(E1,M1) ^ imm_east(M1,W1) % substitution: {E1/R, W1/r107} yes(R)imm_east(R,M1) ^ imm_east(M1, r107) % select leftmost conjunct and resolve with imm_east(E2,W2)imm_west(W2,E2) % substitution : {E2/R, W2/M1} ( mgu for ai and a) yes(R)imm_west(M1, R) ^ imm_east(M1, r107) % select leftmost conjunct and resolve with imm_west(r109,r111) ***** % substitution: {M1/r109, R/r111} yes(r111)imm_east(r109, r107) % resolve with imm_east(E3,W3)imm_west(W3,E3) % substitution: {E3/r109, W3/r107} yes(r111)imm_west(r107, r109) % resolve with imm_west(r107, r109) and substitution: {} yes(r111). CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  28. Example2 (Class Exercise) Resolve and Substitute: {Y1/A} Resolve with connected_to(w6,w5) CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  29. Function Symbols: Language Extension (2.8) • Often we want to refer to individuals in terms of components. • Examples:You may want to say that some course is held at 11:30am. You do not want to have to choose a constant for each different time. • We extend the notion of term . So that a term can be f (t1, …, tn) where f is a function symbol and the tiare terms. • In an interpretation and with a variable assignment, term f (t1, …, tn) denotes an individual in the domain. • With one function symbol and one constant we can refer to infinitely many individuals. Example:before(T1,T2), true if T1 is before T2 in a day. CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

  30. Representing Abstract Concept: Lists (3.5) • A list is an ordered sequence of elements. • Let’s use the constant nil to denote the empty list, and the function cons(H, T) to denote the list with first element H and rest-of-list T. These are not built-in. • The list containing david, alan and randy is Cons(david, cons(alan, cons(randy, nil))) • append(X, Y, Z) is true if list Z contains the elements of X followed by the elements of Y append(nil, Z, Z). append(cons(A, X), Y, cons(A, Z))  append(X, Y, Z). Example: X=abc Y=123 Z=abc123 if append(X,Y,Z) is true cons(A,X)=[A,abc] cons(A,Z)=[A,abc123] cons(A,Z)=cons(A,X)Y if Append(X,Y,Z) is true which means: [A,abc123]=[A,abc123] CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

More Related