1 / 33

L ogics for D ata and K nowledge R epresentation

L ogics for D ata and K nowledge R epresentation. Propositional Logic: Reasoning. Outline. Review Reasoning DP Procedure Properties Decidability Summary. Reasoning Services. Basic reasoning tasks for a PL-based system : Model checking

sabine
Download Presentation

L ogics for D ata and K nowledge R epresentation

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. Logics for Data and KnowledgeRepresentation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  2. Outline • Review • Reasoning • DP Procedure • Properties • Decidability • Summary First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  3. Reasoning Services • Basicreasoning tasks for a PL-based system : • Model checking • Satisfiability reduced to model checking (choose assignment first) • Validity reduced to model checking (try all assignments) • Unsatisfiability reduced to model checking (try all assignments) • Entailment reduced to previous problems • SAT/UNSAT/VAL reduced to SAT/UNSAT/VAL of CNF formulas First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  4. Reasoning Services SAT/UNSAT/VAL reduced to SAT/UNSAT/VAL of CNF formulas See for instance: http://www.satisfiability.org First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  5. Outline • Review • Reasoning • DP Procedure • Properties • Decidability • Summary First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  6. PSAT-Problem (Boolean SAT) • Definition. PSAT = find ν such that ν |= P. • Satisfiability Problem: Is PSAT decidable? • Theorem [Cook,1971] PSAT is NP-completeThe theorem established a “limitative result” of PL (and Logic). A problem is NP-complete when it is very difficult to be computed! First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  7. Background Concepts • To understand the DPLL procedure we first require to know some background concepts: • literal (negative / positive) • clause (unit / empty) • conjunctive normal form (CNF) • the conversion procedure to rewrite a formula to its equivalent CNF. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  8. Literals • A literal is either an atomic proposition or the negation of an atomic proposition, i.e., for all propositional variables P, P and ¬P are literals. • P is a positive literal, ¬P is a negative literal • Examples: ‘inLab-monkey’, ‘airplane’, ‘¬highBox=1mt’, ‘¬inLab-monkey’, ... First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  9. Clauses • A clause is the disjunction of literals. • Example: B∨¬C∨¬D, Being∨¬Being, ... • A unit clause is a clause that contains only a single literal. • Example: B,¬C are unit clauses, B∨¬C isn’t • A empty clause does not contain literals First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  10. Conjunctive Normal Form (CNF) • A proposition is in conjunctive normal form (CNF) if it is a (finite) conjunction of clauses. • Examples: (A∨¬B) ∧ (B ∨¬C ∨¬D),¬A ∧ B, A ∧ (B ∨ C∨¬D), ... • Counter-examples:¬(A ∧ B) : ¬ is the outmost operatorA ∧ (B ∨ C ∧ ¬D) : ∧ is nested within ∨ First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  11. Conversion to CNF Every formula P has a CNF, i.e., P can be converted (in polynomial time) into a proposition Q such that: • Q is in CNF • P and Q are equivalent (i.e., have the same truth table). Proof:See e.g. (Mendelson, 1987) [Prop. 1.4, Ex. 1.41(a)]. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  12. Conversion to CNF(Remark) • A conversion to a CNF that operates as in the theorem above is said to be complete. • The algorithm implementing the conversion to a CNF is based on the tautologies about logical equivalence (or double implication):- double-negation law (i.e. elimination of ¬¬)- De Morgan’s laws- distributive laws- elimination of → and ↔(see the next slide) First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  13. Conversion to CNF Basic Tautologies • ¬(¬α) ↔α double-negation elimination • ¬(α∧β) ↔ (¬α∨¬β) De Morgan’s Law for ∧ • ¬(α∨β) ↔ (¬α∧¬β) De Morgan’s Law for ∨ • (α∧ (β∨γ)) ↔ ((α∧β) ∨ (α∧γ))distributivity of ∧ over ∨ • (α∨ (β∧γ)) ↔ ((α∨β) ∧ (α∨γ))distributivity of ∨ over ∧ • (α →β)↔ (¬α∨β) →-elimination • (α↔β)↔((α →β)∧(β →α)) ↔-elimination First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  14. ExampleConversion to CNF of ‘A↔(B∨C)’ • Eliminate ↔: (A→(B ∨C)) ∧ ((B ∨C) →A) • Eliminate →: (¬A∨B ∨C) ∧ (¬(B ∨C) ∨A) • Move ¬ inwards using de Morgan’s laws:(¬A∨B ∨C) ∧ ((¬B ∧¬C) ∨A) • Apply distributivity of ∨ over ∧ and flatten: (¬A∨B ∨C) ∧ (¬B ∨A) ∧ (¬C ∨A) (*) • (*) in CNF and equivalent to ‘A↔(B∨C)’. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  15. Disjunctive Normal Form (DNF) • Although not necessary to the DPLL procedure, we mention also the DNFs. • Premise: A conjunctive clause is a (finite) conjunction of literals. NB: it is not a clause! • A proposition is in disjunctive normal form (DNF) if it is a (finite) disjunction of conjunctive clauses. • Examples: ¬A ∨ B, A ∨ (B ∧ C ∧ ¬D), ... First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  16. CNFSAT-Problem Definition. CNFSAT = find ν s.t. ν |= P, with P in CNF. CNFSAT-Problem: Is CNFSAT decidable? Like PSAT, CNFSAT is NP-complete. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  17. DPLL Procedure • DPLL employs a backtracking search to explore the space of propositional variables truth-valuations of an proposition P in CNF, looking for a satisfying truth-valuation of P. • DPLL solves the CNFSAT-Problem by searching a truth-assignment that satisfies all clauses in the input proposition. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  18. DPLL ProcedureMain Steps • The DPLL procedure does the following:1. chooses a literal in the input proposition P2. assignes a truth-value (*) to its variable as to satisfy it3. simplifies P by removing all clauses in P which become true under the truth-assignment in step 2. and all literals in P that become false from the remaining clauses4. recursively checks if the simplified proposition obtained in step 3. is satisfiable; if this is the case, then P is satisfiable. Otherwise, the same recursive checking is done assuming the opposite truth value (*). First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  19. DPLL Procedure • Input: a propositin P in CNF. • Output: "P satisfiable" or " P unsatisfiable". • Step 1 : Unit PropagationWhile there is no empty clause and an unit clause exists, select an unit clause and assign a variable in it to satisfy it. • Step 2 : Satisfiability CheckingIf all clauses are satisfied, return "satisfiable". • Steps 3 and 4 : see the next slide. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  20. DPLL Procedure (cont’) • Step 3 : Unsatisfiability CheckingIf an empty clause exists, return "unsatisfiable". • Step 4 : Splitting Rule- Select a variable whose value is not assigned. - Assign True to the variable and call DPLL. If the result is "satisfiable" then return "satisfiable". - Otherwise, assign False to the variable an call DPLL again.Return the result of it. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  21. DPLL ProcedureExample 1 • Take P = A ∧ (A ∨ ¬A) ∧ B • The DPLL procedure does the following:1. chooses a literal in P, e.g., A2. assignes a truth-value to A, e.g., ν(A) = T3.1 simplifies P by removing all clauses in P which become true under ν(A) = T in step 2: remove A and (A∨¬A)[ in fact: by assuming ν(A) = T we have ν(A∨¬A) = T ]3.2 simplifies P by removing all literals in P that become false from the remaining clauses: nothing to remove[ in fact: B is the only remaining clause, and ν(B) = ? ] First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  22. DPLL ProcedureExample 1 (cont’) • 4. recursively checks if the simplified proposition obtained in step 3. is satisfiable:- simplified proposition from step 3: B- is B satisfiable? Yes: just define ν(B) = T, hence ν |= B.4.1 if this is the case, the original formula is satisfiable:- Yes, this is the case: a model for it is ν s.t. ν(A) = T and ν(B) = T; 4.2 otherwise, the same recursive check is done assuming the opposite truth value:- No, not the case, DPLL did terminate in 4.1. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  23. DPLL ProcedureExample 2 • Take P = C ∧ (A ∨ ¬A) ∧ B • The DPLL procedure does the following:1. chooses a literal in P, e.g., C2. assignes a truth-value to C, e.g., ν(C) = T3.1 simplifies P by removing all clauses in P which become true under ν(C) = T in step 2: remove C3.2 simplifies P by removing all literals in P that become false from the remaining clauses: nothing to remove[ the remaining clauses were not assigned a truth-value ] First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  24. DPLL ProcedureExample 2 (cont’) • 4. recursively checks if the simplified proposition obtained in step 3. is satisfiable:- simplified proposition from step 3: (A∨¬A) ∧ B- is (A∨¬A) ∧ B satisfiable? • Call DPLL from step 1:1. choose a literal in (A∨¬A) ∧ B, e.g., A2. assign a truth-value to A, e.g., ν(A) = T3.1 simplify by removing all clauses in (A∨¬A) ∧ B which become true under ν(A) = T: remove (A∨¬A) First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  25. DPLL ProcedureExample 2 (cont’) • 3.2 simplify by removing all literals in (A∨¬A) ∧ B that become false from the remaining clauses: nothing to remove • 4. recursively checks if the simplified proposition obtained in step 3. is satisfiable:- simplified proposition from step 3: B- is B satisfiable? Yes: just define ν(B) = T, hence ν |= B4.1 if this is the case, the original formula is satisfiable:- Yes, this is the case: a model for it is ν s.t. ν(A) = T and ν(B) = T • DPLL terminate with output: "C∧(A∨¬A)∧B satisfiable" First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  26. Outline • Review • Reasoning • DP Procedure • Properties • Observations • Summary First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  27. Observations • Finding solutions to propositional logic formulas is an NP-complete problem. • A DPLL SAT solver employs a systematic backtracking search procedure to explore the (exponentially-sized) space of variable assignments looking for satisfying assignments. • Modern SAT solvers (developed in the last ten years) come in two flavors: "conflict-driven" and "look-ahead". First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  28. Outline • Review • Reasoning • DP Procedure • Properties • Decidability • Summary First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  29. Pros and Cons - Pros • PL is declarative: syntax captures facts. • PL allows disjunctive (partial) /negated knowledge (unlike most databases). • PL is compositional: |=A∧B from |=A and |=B. • PSAT fundamental in important applications. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  30. Pros and Cons - Cons • PL has limited expressive power! (yet useful in lots of applications, see later) • Example 1: In PL you cannot say “pits cause breezes in all adjacent squares” except by writing one sentence for each square. • Example 2 (De Morgan, 1864): inferences like “All horses are animals; therefore, the head of a horse is the head of an animal” cannot be handled in PL. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  31. Example (KB) • AreaManager → Manager • TopManager → Manager • Manager → Employee • TopManager(John) Observe: 1,2,3, 4 are propositions. First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  32. Example (cont’) • Manager(John) • Employee(John) We can’t deduce the following: First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

  33. Example (cont’) • AreaManager(x) → Manager(x) • TopManager(x) → Manager(x) • Manager(x) → Employee(x) • TopManager(John) NB: 1,2,3 are not propositions, because of variables! First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and Rui Zhang

More Related