Proofs (2.7) (How to compute logical consequences of a KB rather that

Slides:



Advertisements
Similar presentations
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
Advertisements

Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Inference Rules Universal Instantiation Existential Generalization
SLD-resolution Introduction Most general unifiers SLD-resolution
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
AR for Horn clause logic Introducing: Unification.
Automated Reasoning Systems For first order Predicate Logic.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Resolution in Propositional and First-Order Logic.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
CPSC 322, Lecture 20Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Computer Science cpsc322, Lecture 20 (Textbook.
CPSC 322 Introduction to Artificial Intelligence September 20, 2004.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.12 [P]: Individuals and Relations Proofs.
Knoweldge Representation & Reasoning
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) March, 8, 2010.
INFERENCE IN FIRST-ORDER LOGIC IES 503 ARTIFICIAL INTELLIGENCE İPEK SÜĞÜT.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) Oct, 26, 2010.
Logical Agents Logic Propositional Logic Summary
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
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 Systems For first order 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.
Computer Science CPSC 322 Lecture 22 Logical Consequences, Proof Procedures (Ch 5.2.2)
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
Logic: Proof procedures, soundness and correctness CPSC 322 – Logic 2 Textbook §5.2 March 7, 2011.
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.
O A procedure: a set of axioms (rules and facts) with identical signature (predicate symbol and arity). o A logic program: a set of procedures (predicates),
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) Oct, 30, 2013.
Knowledge Based Systems
EA C461 Artificial Intelligence
Logic: TD as search, Datalog (variables)
Chapter 7. Propositional and Predicate Logic
Introduction to Logic for Artificial Intelligence Lecture 2
Announcements No office hours today!
Computer Science cpsc322, Lecture 20
Knowledge Representation and Reasoning
Chapter 10: Using Uncertain Knowledge
Completeness of the SLD-Resolution
EA C461 – Artificial Intelligence Logical Agent
Propositional Definite Clause Logic: Syntax, Semantics, R&R and Proofs
The Propositional Calculus
Chapter 11: Learning Introduction
Chapter 7: Beyond Definite Knowledge
Logic: Top-down proof procedure and Datalog
Biointelligence Lab School of Computer Sci. & Eng.
Assignment-2 due now Enterprise Architecture Conference Sat. Oct 27
Soundness of SLD-Resolution
CS 416 Artificial Intelligence
Back to “Serious” Topics…
Biointelligence Lab School of Computer Sci. & Eng.
Logic: Domain Modeling /Proofs + Computer Science cpsc322, Lecture 22
Computer Science cpsc322, Lecture 20
Methods of Proof Chapter 7, second half.
Bottom Up: Soundness and Completeness
Bottom Up: Soundness and Completeness
Soundness of SLD-Resolution
Representations & Reasoning Systems (RRS) (2.2)
Bottom Up: Soundness and Completeness
Presentation transcript:

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

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 KB g 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). Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

Bottom-up Ground Proof Procedure 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. Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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

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

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

Proof (2.7) (cont.) Soundness of bottom-up proof procedure If 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 I of 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 ! Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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. Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

Complexity of the bottom-up proof: 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. Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

yes  a1 … ai-1  b1 … bp  ai+1 … am 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 ai with the clause: ai  b1 … bp is the answer clause yes  a1 … ai-1  b1 … bp  ai+1 … am Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

Top-down Ground Proof Procedure (cont.) 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, …, yn such that y0 is the answer clause yes  q1  …  qk, (query) yi is obtained by resolving yi-1 with a clause in KB, and yn is an answer. Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

Top-down ground proof procedure (cont.) 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” repeat select a conjunct ai from the body of ac choose clause C from KB with ai as head replace ai in the body of ac by the body of C until ac is an answer Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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

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 ?). Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

Nondeterministic Choice 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!) Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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 Vi is a distinct variable and each ti is 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 Vi replaced by ti. Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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

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. Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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

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) Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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 Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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: s(a) r(a) s(b) r(b) Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

q(a), q(b), r(a), s(a), p(a,a) and p(b,a). 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). Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

a1  …  a i-1  b1  …  bp  a i+1  …  am 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 Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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. Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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) Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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). Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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

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 ti are 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. Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge

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] Dr. Djamel Bouchaffra CS 426 Artificial Intelligence, Ch. 2 & 3:A representation & reasoning system, Using definite knowledge