Ontologies Reasoning Components Agents Simulations Reasoning with Classical Propositional Logic Jacques Robin.

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Propositional Logic Reading: C , C Logic: Outline Propositional Logic Inference in Propositional Logic First-order logic.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Knowledge and reasoning – second part
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Logical Agents Chapter 7.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Logical Agents Chapter 7 (based on slides from Stuart Russell and Hwee Tou Ng)
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
Propositional Logic: Methods of Proof (Part II)
Logical Agents (NUS) Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 19, 2012.
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
1 Problems in AI Problem Formulation Uninformed Search Heuristic Search Adversarial Search (Multi-agents) Knowledge RepresentationKnowledge Representation.
Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter (previous lecture, Part I) Chapter.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
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.:
1 Logical Agents Chapter 7. 2 A simple knowledge-based agent The agent must be able to: –Represent states, actions, etc. –Incorporate new percepts –Update.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Computing & Information Sciences Kansas State University Wednesday, 13 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 10 of 42 Wednesday, 13 September.
1 Logical Agents Chapter 7. 2 Logical Agents What are we talking about, “logical?” –Aren’t search-based chess programs logical Yes, but knowledge is used.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Russell & Norvig Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean)
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Inference in Propositional Logic (and Intro to SAT) CSE 473.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7 Part I. 2 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Artificial Intelligence Logical Agents Chapter 7.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
CS666 AI P. T. Chung Logic Logical Agents Chapter 7.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
EA C461 Artificial Intelligence
EA C461 – Artificial Intelligence Logical Agent
Resolution in the Propositional Calculus
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
Propositional Classical Deduction
Artificial Intelligence: Agents and Propositional Logic.
CS 416 Artificial Intelligence
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Problems in AI Problem Formulation Uninformed Search Heuristic Search
Presentation transcript:

Ontologies Reasoning Components Agents Simulations Reasoning with Classical Propositional Logic Jacques Robin

Outline  Syntax  Full CPL  Implicative Normal Form CPL (INFCPL)  Horn CPL (HCPL)  Semantics  Cognitive and Herbrand interpretations, models  Reasoning  FCPL Reasoning  Truth-tabel based model checking  Multiple inference rules  INFCPL Reasoning  Resolution and factoring  DPLL  WalkSat  HCPL Reasoning  Forward chaining  Backward chaining

Full Classical Propositional Logic (FCPL): syntax FCPLFormula Syntax FCPLUnaryConnective Connective: enum{  } FCPLBinaryConnective Connective: enum{ , , ,  } FCPLConnective Functor ConstantSymbol Arg 1..2  (a  (b  ((  c  d)  a)  b))

CPL Normal Forms ConstantSymbol INFCPLFormula Functor =  INFCPLClause Functor =  INFCLPLHS Functor =  INFCLPRHS Functor =  Premisse Conclusion Implicative Normal Form (INF) Conjunctive Normal Form (CNF) CNFCPLFormula Functor =  CNFCPLClause Functor =  NegativeLiteral Functor =  Literal ConstantSymbol Semantic equivalence: a  b  c  d   (a  b)  c  d   a   b  c  d * * * **

Horn CLP ConstantSymbol INFCPLFormula Functor =  INFCPLClause Functor =  INFCLPLHS Functor =  INFCLPRHS Functor =  Premisse Conclusion Implicative Normal Form (INF) Conjunctive Normal Form (CNF) CNFCPLFormula Functor =  CNFCPLClause Functor =  NegativeLiteral Functor =  LiteralConstantSymbol * * * * DefiniteClause IntegrityConstraint Fact DefiniteClause IntegrityConstraint Fact context IntegrityConstraint inv IC: Conclusion.ConstantSymbol = false context DefiniteClause inv DC: Conclusion.ConstantSymbol  false context Fact inv Fact: Premisse -> size() = 1 and Premisse -> ConstantSymbol = true context IntegrityConstraint inv IC: Literal->forAll(oclIsKindOf(NegativeLiteral)) context DefiniteClause inv DC: Literal.oclIsKindOf(ConstantSymbol)->size() = 1 context Fact inv Fact: Literal->forAll(oclIsKindOf(ConstantSymbol)) a  b  c  false a  b  c  d true  d  a   b   c  a   b   c  d d

FCPL semantics: cognitive interpretation FCPLFormulaConstantSymbol FCPLConnective FCPLUnaryConnective Connective: enum{  } FCPLBinaryConnective Connective: enum{ , , ,  } TruthValue Value: enum{true,false} FCLPCognitiveInterpretation Syntax Semantics Arg Functor CompoundDomainProperty FormulaMapping AtomicDomainProperty ConstantMapping 1..2  (a  (b  ((  c  d)  a)  b)) csm1(pitIn12) = agent knows there is a pit in coordinates (1,2) csm2(pitIn12) = John is the King of England fm1(pitIn12   pitIn11) = agent knows there is a pit in coordinates (1,2) and no pit in coordinates (1,1) fm1(pitIn12   pitIn11) = John is the Kind of England and John is not the King of France

FCPL semantics: Herbrand interpretation FCPLFormulaConstantSymbol FCPLConnective FCPLUnaryConnective Connective: enum{  } FCPLBinaryConnective Connective: enum{ , , ,  } TruthValue Value: enum{true,false} FCLPHerbrandInterpretation Syntax Semantics Arg Functor ConstantValuation FormulaValuation FCLPHerbrandModel 1..2  (a  (b  ((  c  d)  a)  b)) {cv1(pitIn12) = true, cv1(pitIn11) = true,...} {cv2(pitIn12) = true, cv2(pitIn11) = false,...} {fv1(pitIn12   pitIn11) = true, fv1(pitIn12  pitIn11) = true,...} {fv2(pitIn12   pitIn11) = true, fv2(pitIn12  pitIn11) = false,...}

FCPL semantics FCPLFormulaConstantSymbol FCPLConnective CompoundDomainProperty FCPLUnaryConnective Connective: enum{  } FCPLBinaryConnective Connective: enum{ , , ,  } AtomicDomainProperty TruthValue Value: enum{true,false} FCLPCognitiveInterpretation FCLPHerbrandInterpretation Syntax Semantics Arg Functor ConstantValuationFormulaValuation FCLPHerbrandModel FormulaMapping ConstantMapping 1..2  (a  (b  ((  c  d)  a)  b))

Entailment and models  Entailment |=:  f |= f’ iff:  H i, H i (f) = true  H i (f’) = true  Logical equivalence  :  f  f’ iff f |= f’ and f’ |= f  Herbrand model:  An Herbrand interpretation H i is a (Herbrand) model of formula f iff its truth value corresponds to the application of the truth-table definition of the FCPL connectives to the truth value in H i of the constant symbols that compose f  f valid (or tautology) iff true in all H i (f), ex, a   a  f satisfiable iff true in at least one H i (f)  f unsatisfiable (or contradiction) iff false in all H i (f), ex, a   a Valid formulas Satisfiable formulas Unsatisfiable formulas

Logic-Based Agent Ask Tell Retract Environment Actuators Knowledge Base B: Domain Model in Logic L Inference Engine: Theorem Prover for Logic L Given B as axiom, formula f is a theorem of L? B |= L f ? B  f is valid in L? (Boolean CSP search proof) B   f is unsatisfiable in L? (Refutation proof) Sensors  Strenghts:  Reuse results and insights about correct reasoning that matured over 23 centuries  Semantics (meaning) of a knowledge base can be represented formally as syntax, a key step towards automating reasoning

Truth-table based model checking  To answer: Ask(  )  Enumerate all H i s from domain proposition alphabet  Use truth-table to compute M h (KB) and M h (  )  If M h (KB)  M h (  ), then answer yes, else answer no  Example:  KB =  pit11   breeze11   pit12  breeze12   1 =  pit21   2 =  pit22

FCLP inference rules  Bi-directional (logical equivalences) R 1 : f  g  g  f R 2 : f  g  g  f R 3 : (f  g)  h  f  (g  h) R 4 : (f  g)  h  f  (g  h) R 5 :  f  f R 6 : f  g   g   f R 7 : f  g   f  g R 8 : f  g  (f  g)  (g  f) R 9 :  (f  g)   f   g R 10 :  (f  g)   f   g R 11 : f  (g  h)  (f  g)  (f  h) R 12 : f  (g  h)  (f  g)  (f  h) R 13 : f  f  f %factoring  Directed (logical entailments) R 14 : f  g, f |= g %modus ponens R 15 : f  g,  g |=  f %modus tollens R 16 : f  g |= f %and-elimination R 17 : l 1 ...  l i ... l k, m 1 ...  m j-1   l i  m j-1... m k |= l 1 ...  l i-1  l i-1... l k  m 1 ...  m j-1  m j-1... m k %resolution

Multiple inference rule application Idea:  KB |= f ?  KB 0 = KB  Apply inference rule: KB i |= g  Update KB i+1 = KB i  g  Iterate until f  KB k or until f  KB n and KB n+1 = KB n  Transforms proving KB |= f into search problem  At each step:  Which inference rule to apply?  To which sub-formula of f? Example proof:  KB 0 =  P 1,1  (B 1,1  P 1,2  P 2,1 )  (B 2,1  P 1,1  P 2,2  P 3,1 )   B 1,1  B 2,1  Query:  (P 1,2  P 2,1 )  Cognitive interpretation:  B X,Y : agent felt breeze in coordinate (X,Y)  P X,Y : agent knows there is a pit in coordinate (X,Y)  Apply R 8 to B 1,1  P 1,2  P 2,1 KB 1 = KB 0  (B 1,1  (P 1,2  P 2,1 ))  ((P 1,2  P 2,1 )  B 1,1 )  Apply R 6 to last sub-formula KB 2 = KB 1  (  B 1,1   (P 1,2  P 2,1 ))  Apply R 14 to  B 1,1 and last sub-formula KB 3 = KB 2   (P 1,2  P 2,1 )

Resolution and factoring  Repeated application of only two inference rules:  resolution and factoring  More efficient than using multiple inference rules  search space with far smaller branching factor  Refutation proof:  Derive false from KB   Query  Requires both in normal form (conjunctive or implicative)  Example proof in conjunctive normal form:

Resolution strategies  Search heuristics for resolution-based theorem proving  Two heuristic classes:  Choice of clause pair to resolve inside current KB  Choice of literals to resolve inside chosen clause pair  Unit preference:  Prefer pairs with one unit clause (i.e., literals)  Rationale: generates smaller clauses, eliminates much literal choice in pair  Unit resolution: turn preference into requirement  Set of support:  Define small subset of initial clauses as initial “set of support”  At each step:  Only consider clause pairs with one member from current set of support  Add step result to set of support  Efficiency depend on cleverness of initial set of support  Common domain-independent initial set of support: negated query  Beyond efficiency, results in easier to understand, goal-directed proofs  Linear resolution:  At each step only consider pairs (f,g) where f is either:  (a) in KB 0, or  (b) an ancestor of g in the proof tree  Input resolution:  Specialization of linear resolution excluding (b) case  Generates spine-looking proofs trees

FCPL theorem proving as boolean CSP exhaustive global backtracking search  Put f = KB   Query in conjunctive normal form  Try to prove it unsatisfiable  Consider each literal in f as a boolean variable  Consider each clause in f as a constraint on these variables  Solve the underlying boolean CSP problem by using:  Exhaustive global backtracking search  of all complete variable assignments  showing none satisfies all constraint in f  Initial state: empty assignment of pre-ordered variables  Search operator:  Tentative assignment of next yet unassigned variable L i (i th literal in f)  Apply truth table definitions to propagate constraints in which L i appears (clauses of f involving L)  If propagation violates one constraint, backtrack on L i  If propagation satisfies all constraints:  iterate on L i+1  if L i was last literal in f, fail, KB   Query satisfiable, and thus KB |  Query

FCPL theorem proving as boolean CSP backtracking search: example  Variables = {B 1,1, P 1,2, P 2,1 }  Constraints: {  B 1,1,  P 1,2  B 1,1,  P 2,1  B 1,1,  B 1,1  P 1,2  P 2,1, P 1,2 } V = [?,?,?] C = [?,?,?,?,?] V = [0,?,?] C = [1,?,?,?,?] V = [1,?,?] C = [0,?,?,?,?] V = [0,0,?] C = [1,0,?,?,0] V = [0,1,?] C = [1,0,?,?,1] V = [1,0,?] C = [0,1,?,?,0] V = [1,1,?] C = [0,0,?,?,1] V = [1,1,1] C = [0,0,0,0,1] V = [1,1,0] C = [0,0,1,0,1] V = [1,0,1] C = [0,1,0,0,0] V = [1,0,0] C = [0,1,1,0,0] V = [0,1,1] C = [1,0,0,1,1] V = [0,1,0] C = [1,0,0,0,1] V = [0,0,1] C = [1,0,0,0,0] V = [0,0,0] C = [1,0,0,0,0]

DPLL algorithm  General purpose CSP backtracking search very inefficient for proving large CFPL theorems  Davis, Putnam, Logemann & Loveland algorithm (DPPL):  Specialization of CSP backtracking search  Exploiting specificity of CFPL theorem proving recast as CSP search  To apply search completeness preserving heuristics  Concepts:  Pure symbol S: yet unassigned variable positive in all clauses or negated in all clauses  Unit clause C: clause with all but one literal already assigned to false  Heuristics:  Pure symbol heuristic: assign pure symbols first  Unit propagation:  Assign unit clause literals first  Recursively generate new ones  Early termination heuristic:  After assigning L i = true, propagate C j = true  C j | L i  C j (avoiding truth-table look-ups)  Prune sub-tree below any node where  C j | C j = false  Clause learning

Satisfiability of formula as boolean CSP heuristic local stochastic search  DPLL is not restricted to proving entailment by proving unsatisfiability  It can also prove satisfiability of a FCPL formula  Many problems in computer science and AI can be recast as a satisfiability problem  Heuristic local stochastic boolean CSP search more space scalable than DPLL for satisfiability  However since it is not exhaustive search, it cannot prove unsatisfiability (and thus entailment), only strongly suspect it  WalkSAT  Initial state: random assignment of pre-ordered variables  Search operator:  Pick a yet unsatisfied clause and one literal in it  Flip the literal assignment  At each step, randomly chose between to picking strategies:  Pick literal which flip results in steepest decrease in number of yet unsatisfied clauses  Random pick

Direct x indirect use of search for agent reasoning Agent Decision Problem Domain Specific Agent Decision Problem Search Model: State data structure Successor function Goal function Heuristic function Domain Specific Knowledge Base Model: Logic formulas true  d f  g  h  c... Domain Independent Inference Engine Search Model State data structure Successor function Goal function Heuristic function Domain Independent Search Algorithm Agent Application Developer Reasoning Component Developer

Horn CPL reasoning  Practical limitations of FCPL reasoning:  For experts in most application domain (medicine, law, business, design, troubleshooting):  Non-intuitiveness of FCPL formulas for knowledge acquisition  Non-intuitiveness of proofs generated by FCPL algorithms for knowledge validation  Theoretical limitation of FCPL reasoning:  exponential in the size of the KB  Syntactic limitation to Horn clauses overcome both limitations:  KB becomes base of simple rules If p 1 and... and p n then c, with logical semantics p 1 ...  p n  c  Two algorithms are available, rule forward chaining and rule backward chaining, that are:  Intuitive  Sound and complete for HCPL  Linear in the size of the KB  For most application domains, loss of expressiveness can be overcome by addition of new symbols and clauses:  ex, FCPL KB 1 = p  q  c  d has no logical equivalent in HCPL in terms of alphabet {p,q,c,d}  However KB 2 = (p  q  notd  c)  (p  q  notc  d)  (c  notc  false)  (d  notd  false) is an HCPL formula logically equivalent to KB 1

Propositional forward chaining  Repeated application of modus ponens until reaching a fixed point  At each step i:  Fire all rules (i.e., Horn clauses with at least one positive and one negative literal) with all premises already in KB i  Add their respective conclusions to KB i+1  Fixed point k reached when KB k = KB k-1  KB k = {f | KB 0 |= f}, i.e., all logical conclusions of KB 0  If f  KB k, then KB 0 |= f, otherwise, KB 0 |  f  Naturally data-driven reasoning:  Guided by fact (axioms) in KB 0  Allows intuitive, direct implementation of reactive agents  Generally inefficient for:  Inefficient for specific entailment query  Cumbersome for deliberative agent implementations  Builds and-or proof graph bottom-up

Propositional forward chaining: example

Propositional backward chaining  Repeated application of resolution using:  Unit input resolution strategy with negated query as initial set of support  At each step i:  Search KB 0 for clause of the form p 1 ...  p n  g to resolve with clause g popped from the goal stack  If there are several ones, pick one, push p 1 ...  p n on goal stack, and push other ones alternative stack to consider upon backtracking  If there are none, backtrack (i.e., pop alternative stack)  Terminates:  Successfully when goal stack is empty  As failure when goal stack is non empty but alternative stack is  Naturally goal-driven reasoning:  Guided by goal (theorem to prove)  Allows intuitive, direct implementation of deliberative agents  Generally:  Inefficient for deriving all logical conclusions from KB  Cumbersome implementation of reactive agents  Builds and-or proof graph top-down

Propositional backward chaining: example Goal Stack Q Alternative Stack 

Propositional backward chaining: example Goal Stack P Alternative Stack 

Propositional backward chaining: example Goal Stack L M Alternative Stack 

Propositional backward chaining: example Goal Stack A P M Alternative Stack A B

Propositional backward chaining: example Goal Stack P M Alternative Stack A B

Propositional backward chaining: example Goal Stack A B M Alternative Stack 

Propositional backward chaining: example Goal Stack M Alternative Stack 

Propositional backward chaining: example Goal Stack B L Alternative Stack 

Propositional backward chaining: example Goal Stack  Alternative Stack 

Propositional backward chaining: example Goal Stack  Alternative Stack 

Propositional backward chaining: example Goal Stack  Alternative Stack 

Limitations of propositional logic  Ontological:  Cannot represent knowledge intentionally  No concise representation of generic relations (generic in terms of categories, space, time, etc.)  ex, no way to concisely formalize the Wumpus world rule: “at any step during the exploration, the agent perceiving a stench makes him knows that there is a Wumpus in a location adjacent to his”  Propositional logic:  Requires conjunction of 100,000 equivalences to represent this rule for an exploration of at most 1000 steps of a cavern size 10x10  (stench1_1_1  wumpus1_1_2  wumpus1_2_1)   (stench1000_1_1  wumpus100_1_2  wumpus1000_2_1)   (stench1_10_10  wumpus1_9_10  wumpus1_10_9)   (stench1000_10_10  wumpus100_9_10  wumpus1000_9_10)  Epistemological:  Agent always completely confident of its positive or negative beliefs  No explicit representation of ignorance (missing knowledge)  Only way to represent uncertainty is disjunction  Once held, agent belief cannot be questioned by new evidence (ex, from sensors)