1 / 48

Intelligent Systems

Intelligent Systems. Propositional Logic. Agenda. Motivation Propositional Logic Inference by Enumeration Validity and Satisfiability Logical Equivalence Proof Methods – Resolution Soundness and Completeness Horn Clauses Forward Chaining Backward Chaining

Download Presentation

Intelligent 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. Intelligent Systems Propositional Logic

  2. Agenda • Motivation • Propositional Logic • Inference by Enumeration • Validity and Satisfiability • Logical Equivalence • Proof Methods – Resolution • Soundness and Completeness • Horn Clauses • Forward Chaining • Backward Chaining • Efficient Propositional Inference – The DPLL Algorithm • Limitations of Propositional Logic • Summary

  3. Motivation – Why Logics? • Origins of Logic • Ancient Greece • Philosophers argued about themes, but who was right in the end? • When Socrates claimed that one statement followed from another, was it actually true? • Logics today • Verification (e.g. Circuits) • Proofs • Robotics • ...others • Logics are formal languages for representing information such that conclusionscan be drawn. • Syntax defines the sentences in the language. • Semantics define the "meaning" of sentences, i.e., defines the truth of each sentence w.r.t. each possible world (model)

  4. Motivation – Basic Ideas • Entailment means that one thing follows from another KB╞α • Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true • E.g., the KB containing “Innsbruck is in Tirol” and “Tirol is in Austria” entails “Innsbruck is in Austria” • E.g., the KB containing x+y = 4 entails 4 = x+y • Entailment is a relationship between sentences (i.e., syntax) that is based on semantics

  5. Motivation – Models/Interpretations • Possible worlds – environments in which the agent might or might not be in • Models – mathematical abstractions, formally structured worlds with respect to which truth of sentences can be evaluated • m is a model of a sentence α if α is true in m • M(α)is the set of all models of α • KB ╞ α iffM(KB)  M(α) • Knowledge base KB entails sentence α if and only if all models of the KB are models of α

  6. Motivation – Inference • KB ├iα : sentence α can be derived from KB by procedure i, i proves α • Soundness: i is sound if whenever KB ├iα, it is also true that KB╞ α • Completeness: i is complete if whenever KB╞ α, it is also true that KB ├iα • A sound and complete procedure answers any question whose answer follows from what is known by the KB correctly.

  7. Solution – Propositional Logic Syntax • Propositional logic is the simplest logic and illustrates basic ideas of logic • The proposition symbols P1, P2,…are sentences (formulae) • If S is a sentence, S is a sentence (negation) • If S1 and S2 are sentences, S1 S2 is a sentence (conjunction) • If S1 and S2 are sentences, S1 S2 is a sentence (disjunction) • If S1 and S2 are sentences, S1 S2 is a sentence (implication) • If S1 and S2 are sentences, S1 S2 is a sentence (biconditional)

  8. Solution – Propositional Logic Semantics • Each model specifies true/false values for each proposition symbol (8 possible models) • E.g. P1,2 P2,2 P3,1 false true false • Rules for evaluating truth with respect to an interpretation m: S is true iff S is false S1 S2 is true iff S1 is true and S2 is true S1 S2 is true iff S1 is true or S2 is true S1 S2 is true iff S1 is false or S2 is true S1 S2 is false iff S1 is true and S2 is false S1 S2 is true iff S1S2 is true and S2S1 is true • Simple recursive process evaluates an arbitrary sentence w.r.t. an interpretation, e.g., P1,2  (P2,2 P3,1) : true  (true  false) = true  true = true

  9. Solution – Propositional Logic Truth Tables

  10. Solution – Propositional Logic α1 = "[1,2] is safe"

  11. Procedure - Inference by Enumeration • Depth-first enumeration of all models is sound and complete • PL-TRUE evaluates a sentence recursively wrt. to an interpretation • EXTEND(s,v,m) extends the partial model m by assigning value v to symbol s. • For n symbols, time complexity is O(2n), space complexity is O(n)

  12. Definition - Validity and Satisfiability A sentence is valid if it is true in all models, e.g., True, A A, A  A, (A  (A  B))  B Validity is connected to inference via the Deduction Theorem: KB ╞ α if and only if (KB α) is valid A sentence is satisfiable if it is true in some model e.g., A B, C A sentence is unsatisfiable if it is true in no models e.g., A A Satisfibility is connected to inference via the following KB ╞ α if and only if (KBα) is unsatisfiable

  13. Definition - Logical equivalence • Two sentences are logically equivalent iff they are true in same models: α ≡ ß iff α╞ β and β╞ α

  14. Procedure - Proof Methods • Proof methods divide into (roughly) two kinds • Application of inference rules • Legitimate (sound) generation of new sentences from old ones • Proof = a sequence of inference rule applications • Can use inference rules as operators in a standard search algorithm • Typically requires transformation of sentences into a normal form • Model checking • Truth table enumeration (always exponential in n) • Improved backtracking, e.g., Davis-Putnam-Logemann-Loveland (DPLL) • Heuristic search in model space (sound but incomplete) e.g., min-conflicts-like hill-climbing algorithms

  15. Procedure - Resolution Conjunctive Normal Form (CNF) conjunction of disjunctions of literals often called clauses E.g., (A B)  (B C D) • Resolution inference rule (for CNF): li… lk, m1 … mn li … li-1 li+1  … lkm1 … mj-1 mj+1... mn where li and mj are complementary literals. E.g., P1,3P2,2, P2,2 P1,3 • Resolution is sound and complete for propositional logic

  16. Procedure - Conversion to CNF B1,1 (P1,2 P2,1) • Eliminate , replacing α  β with (α  β)  (β  α). (B1,1 (P1,2 P2,1))  ((P1,2 P2,1)  B1,1) • Eliminate , replacing α  β with α β. (B1,1 P1,2 P2,1)  ((P1,2 P2,1)  B1,1) • Move  inwards using de Morgan's rules: (B1,1  P1,2 P2,1)  ((P1,2 P2,1)  B1,1) • Apply distributivity law ( over ) and flatten: (B1,1 P1,2 P2,1)  (P1,2  B1,1)  (P2,1 B1,1)

  17. Definition - Soundness Whenever KB ├r α, it is also true that KB╞ α li… lk, m1 … mn li … li-1 li+1  … lkm1 … mj-1 mj+1... mn li and mj are complementary literals. (li … li-1 li+1  … lk)  li mj  (m1 … mj-1 mj+1... mn) (li … li-1 li+1  … lk)  (m1 … mj-1 mj+1... mn) using the rule (a   b)  (b  a) which can be written also as (a  b)  ( a  b).

  18. Definition - Completeness • Whenever KB╞ α, it is also true that KB ├rα • KB ╞ α if and only if (KBα) is unsatisfiable • Ground resolution theorem • If a set of clauses is unsatisfiable, then the resolution closure of those clauses contains the empty clause. • Proof by contradiction • AssumeKB ╞ α and that the closure does not contain the empty clause.

  19. Procedure - Forward and backward chaining • Horn clauses: disjunction of literals of which at most one is positive • Important because Horn clauses can be written as an implication whose premise is a conjuction of positive literals and whose conclusion is a single positive literal • Definite clauses: exactly one positive literal • Positive literal forms the head • Negative literals form the body • Inference with Horn clauses can be done by forward or backward chaining in a time that is linear in the size of the KB.

  20. Procedure - Forward chaining • Fire any rule whose premises are satisfied in the KB • Add its conclusion to the KB, until query is found

  21. Procedure - Forward chaining algorithm • agenda: true symbols not yet processed • count: how many premises are unknown • for each new symbol processed, count is reduced by one for each implication in whose premise this symbol appears • Count = 0  conclusion can be added to the agenda • Forward chaining is sound and complete for Horn KB

  22. Example - Forward Chaining

  23. Example - Forward Chaining

  24. Example - Forward Chaining

  25. Example - Forward Chaining

  26. Example - Forward Chaining

  27. Example - Forward Chaining

  28. Example - Forward Chaining

  29. Example - Forward Chaining

  30. Procedure - Backward chaining • Work backwards from the query q • To prove q by BC, check if q is known already, or prove by BC all premises of some rule concluding q • Avoid loops: check if new sub-goal is already on the goal stack • Avoid repeated work: check if new sub-goal has already been proved true, or has already failed

  31. Example – Backward Chaining

  32. Example – Backward Chaining

  33. Example – Backward Chaining

  34. Example – Backward Chaining

  35. Example – Backward Chaining

  36. Example – Backward Chaining

  37. Example – Backward Chaining

  38. Example – Backward Chaining

  39. Example – Backward Chaining

  40. Example – Backward Chaining

  41. Explanation: Forward vs. Backward chaining • FC is data-driven, automatic, unconscious processing, • e.g., object recognition, routine decisions • May do lots of work that is irrelevant to the goal !!! • BC is goal-driven, appropriate for problem-solving, • e.g., Where are my keys? How do I get into a PhD program? • Complexity of BC can be much less than linear in size of KB (only relevant facts are considered)

  42. Procedure: Efficient propositional inference • Two families of efficient algorithms for propositional inference • Complete backtracking search algorithms • DPLL algorithm (Davis, Putnam, Logemann, Loveland) • Incomplete local search algorithms • WalkSAT algorithm (Incomplete, local search algorithm)

  43. Procedure: The DPLL algorithm Determine if an input propositional logic sentence (in CNF) is satisfiable. Improvements over truth table enumeration • Early termination • A clause is true if any literal is true (disjunction of literals) • A sentence is false if any clause is false (conjunction of clauses) • Pure symbol heuristic • Pure symbol: always appears with the same "sign" in all clauses. • e.g., In the three clauses (A B), (B C), (C  A), A and B are pure, C is impure. • If a sentence has a model then the it has a model with the pure symbols assigned so as to make their literals true. • Unit clause heuristic • Unit clause: only one literal in the clause • The only literal in a unit clause must be true.

  44. Procedure: The DPLL algorithm

  45. Procedure: The DPLL algorithm

  46. KB contains “physics” sentences for every single square For every time t and every location [x,y], Rapid proliferation of clauses Limitation of propositional logic

  47. Summary • Logical agents apply inference to a knowledge base to derive new information and make decisions • Basic concepts of logic: • syntax: formal structure of sentences • semantics: truth of sentences w.r.t. models • entailment: necessary truth of one sentence given another • inference: deriving sentences from other sentences • soundness: derivations produce only entailed sentences • completeness: derivations can produce all entailed sentences • Resolution is complete for propositional logic • Forward, backward chaining are linear-time, complete for Horn clauses • Propositional logic lacks expressive power

  48. Bibliography • S. Russell, P. Norvig: Artificial Intelligence – A Modern Approach

More Related