Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.

Slides:



Advertisements
Similar presentations
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Advertisements

Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
Logic Concepts Lecture Module 11.
Properties of SLUR Formulae Ondřej Čepek, Petr Kučera, Václav Vlček Charles University in Prague SOFSEM 2012 January 23, 2012.
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.
3/25  Monday 3/31 st 11:30AM BYENG 210 Talk by Dana Nau Planning for Interactions among Autonomous Agents.
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
Existential Graphs and Davis-Putnam April 3, 2002 Bram van Heuveln Department of Cognitive Science.
The Theory of NP-Completeness
Methods of Proof Chapter 7, second half.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Knoweldge Representation & Reasoning
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
Satisfiability Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Boolean Satisfiability and SAT Solvers
Quantified Formulas - Decision Procedure Daniel Kroening, Ofer Strichman Presented by Changki Hong 07 NOV 08.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
LDK R Logics for Data and Knowledge Representation Modeling First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia.
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Logical Agents Logic Propositional Logic Summary
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
LDK R Logics for Data and Knowledge Representation Modal Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
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.:
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
CS6133 Software Specification and Verification
Logics for Data and Knowledge Representation
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Solving the Logic Satisfiability problem Solving the Logic Satisfiability problem Jesus De Loera.
LDK R Logics for Data and Knowledge Representation Propositional Logic Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia,
Satisfiability and SAT Solvers CS 270 Math Foundations of CS Jeremy Johnson.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
SAT Solving As implemented in - DPLL solvers: GRASP, Chaff and
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
Inference in Propositional Logic (and Intro to SAT) CSE 473.
1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
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.
REU 2007-ParSat: A Parallel SAT Solver Christopher Earl, Mentor: Dr. Hao Zheng Department of Computer Science & Engineering Introduction Results and Conclusions.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Exercises: First Order Logics (FOL)
Logics for Data and Knowledge Representation
Lecture 2 Propositional Logic
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Logics for Data and Knowledge Representation
Methods of Proof Chapter 7, second half.
Presentation transcript:

Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese

Outline  Review of PL: Syntax and semantics  Reasoning in PL  Typical tasks  Calculus  Problems with reasoning  Calculus using tableaux  The DPLL Procedure for PSAT  Main steps  The algorithm  Examples  Observations about the DPLL  Conclusions on PL  Pros and cons  Examples 2

Summary about PL so far  PROPOSITIONS  Propositional logic (PL) is the simplest logic which deals with propositions (no individuals, no quantifiers)  Propositions are something true or false  SYNTAX  We need to provide a language, including the alphabet of symbols and formation rules to articulate complex formulas (sentences)  A propositional theory is formed by a set of PL formulas  SEMANTICS  Providing semantics means providing a pair (M, ⊨ ), namely a formal model satisfying the theory  A truth valuation ν is a mapping L  {T, F}  Logical implication (  )  Normal Forms: CNF - DNF 3 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Reasoning Services  Basic reasoning tasks for a PL-based system:  Model checking (EVAL)  Satisfiability (SAT) reduced to model checking (we choose an assignment first)  Validity (VAL) reduced to model checking (try for all possible assignments)  Unsatisfiability (unSAT) reduced to model checking (try for all possible assignments)  Entailment (ENT) reduced to previous problems NOTE: SAT/UNSAT/VAL on generic formulas can be reduced to SAT/UNSAT/VAL on CNF formulas See for instance: 4 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Reasoning in PL  Reasoning in PL is the simplest case of reasoning  We use truth tables  In model checking we just verify a given assignment ν  In SAT we try with all possible assignments but we stop when we find the first one which makes the formula true. 5 Given ν(A) = T, ν(B) = F is the formula A  B true? YES! Is A  B satisfiable? With ν(A)=T, ν(B)=F we have ν(A  B) = F With ν(A)=F, ν(B)=T we have ν(A  B) = F With ν(A)=T, ν(B)=T we have ν(A  B) = T STOP! REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Calculus  Semantic tableau is a decision procedure to determine the satisfiability of finite sets of formulas.  There are rules for handling each of the logical connectives thus generating a truth tree.  A branch in the tree is closed if a contradiction is present along the path (i.e. of an atomic formula, e.g. B and  B)  If all branches close, the proof is complete and the set of formulas are unsatisfiable, otherwise are satisfiable.  With refutation tableaux the objective is to show that the negation of a formula is unsatisfiable. 6 Γ = {(A  B), B} B A   B A BB closed REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Rules of the semantic tableaux  Conjunctions lie on the same branch  Disjunctions generate new branches  The initial set of formulas are considered in conjunction and are put in the same branch of the tree (  ) A  B(  ) A  B A A | B B (  )   A A A   A 7  (A  B)  B B A   B A closed BB  (A   B) REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

What is the problem in reasoning in PL? (I)  Given a proposition P with n atomic formulas, we have 2 n possible assignments ν !  SAT is NP-complete In the worst case reasoning time is exponential in n (in the case we test all possible assignments), but potentially less if we find a way to look for “good” assignments (if there is at least an assignment such that ν ⊨ P. We stop when we find it.) NOTE: the worst case is when the formula is unsatisfiable  Testing validity (VAL) of a formula P is even harder, since we necessarily need to try ALL the assignments. We stop when we find a ν such that ν ⊭ P 8 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

What is the problem in reasoning in PL? (II)  Reducing unSAT to SAT Unsatisfiability is the opposite of SAT. We stop when we find an assignment ν such that ν ⊨ P.  SAT, VAL, unSAT are search problems  How complex is the task?  Notice that what makes reasoning exponential are disjunctions (  ) because we need to test all possible options  Trivially, in case of conjunctions (  ) all the variables must be true  IMPORTANT: Often (when we do not use individuals or quantifiers) we can reduce reasoning in complex logics to reasoning in PL 9 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

PSAT-Problem (Boolean SAT)  Definition: PSAT = find ν such that ν ⊨ P (Satisfiability problem)  Is PSAT decidable? YES, BUT EXPENSIVE! Theorem [Cook,1971] PSAT is NP-complete The theorem established a “limitative result” of PL (and Logic). A problem is NP-complete when it is very difficult to be computed!  DPLL (Davis-Putnam-Logemann-Loveland, 1962)  It is the most widely used algorithm for PSAT  It works on CNF formulas  It can take from constant to exponential time 10 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

CNFSAT-Problem  Definition: CNFSAT = find ν s.t. ν ⊨ P, with P in CNF  Is CNFSAT decidable? YES, BUT STILL EXPENSIVE! Like PSAT, CNFSAT is NP-complete.  Converting a formula in CNF  It is always possible to convert a generic formula in CNF, but in exponential time (polynomial in most of the cases).  It causes an exponential blow up in the length of the formula. 11 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

The DPLL Procedure  DPLL employs a backtracking search to explore the space of propositional variables truth-valuations of a 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 θ i in the input proposition P = θ 1  …  θ n  The basic intuition behind DPLL is that we can save time if we first test for some assignments before others 12 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL Procedure: Main Steps 1. It identifies all literal in the input proposition P 2. It assigns a truth-value to each variable to satisfy them 3. It simplifies P by removing all clauses in P which become true under the truth- assignments at step 2 and all literals in P that become false from the remaining clauses (this may generate empty clauses) 4. It 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 (*). 13 B  ¬C  (B  ¬A  C)  (¬ B  D) B  ¬C  (B  ¬A  C)  (¬ B  D) ν(B) = T; ν(C) = F D DYES, it is satisfiable for ν(D) = T. NOTE: ν(A) can be T/F REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL algorithm  Input: a proposition P in CNF  Output: true if "P satisfiable" or false if "P unsatisfiable" boolean function DPLL(P) { if consistent(P) then return true; if hasEmptyClause(P) then return false; foreach unit clause C in P do P = unit-propagate(C, P); foreach pure- literal L in P do P = pure-literal-assign(L, P); L = choose-literal(P); return DPLL(P  L) OR DPLL(P   L); } 14 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL algorithm  Input: a proposition P in CNF  Output: true if "P satisfiable" or false if "P unsatisfiable" boolean function DPLL(P) { if consistent(P) then return true; if hasEmptyClause(P) then return false; foreach unit clause C in P do P = unit-propagate(C, P); foreach pure- literal L in P do P = pure-literal-assign(L, P); L = choose-literal(P); return DPLL(P  L) OR DPLL(P   L); } 15 It tests the formula P for consistency, namely it does not contain contradictions (e.g. A   A) and all clauses are unit clauses. REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL algorithm  Input: a proposition P in CNF  Output: true if "P satisfiable" or false if "P unsatisfiable" boolean function DPLL(P) { if consistent(P) then return true; if hasEmptyClause(P) then return false; foreach unit clause C in P do P = unit-propagate(C, P); foreach pure- literal L in P do P = pure-literal-assign(L, P); L = choose-literal(P); return DPLL(P  L) OR DPLL(P   L); } 16 An empty clause does not contain literals. It can be due to previous iterations of the algorithm where some simplifications has been done. If any of them exists then P is unsatisfiable. REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL algorithm  Input: a proposition P in CNF  Output: true if "P satisfiable" or false if "P unsatisfiable" boolean function DPLL(P) { if consistent(P) then return true; if hasEmptyClause(P) then return false; foreach unit clause C in P do P = unit-propagate(C, P); foreach pure- literal L in P do P = pure-literal-assign(L, P); L = choose-literal(P); return DPLL(P  L) OR DPLL(P   L); } 17 (a) It assigns the right truth value to each literal (true for positives and false for negatives). (b) It simplifies P by removing all clauses in P which become true under the truth- assignment and all literals in P that become false from the remaining clauses. REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL algorithm  Input: a proposition P in CNF  Output: true if "P satisfiable" or false if "P unsatisfiable" boolean function DPLL(P) { if consistent(P) then return true; if hasEmptyClause(P) then return false; foreach unit clause C in P do P = unit-propagate(C, P); foreach pure- literal L in P do P = pure-literal-assign(L, P); L = choose-literal(P); return DPLL(P  L) OR DPLL(P   L); } 18 For all literals which appear pure in the formula (i.e. with only one polarity) assign the corresponding value: - true if positive literal - false if negative Not all DPLL versions perform this step. REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL algorithm  Input: a proposition P in CNF  Output: true if "P satisfiable" or false if "P unsatisfiable" boolean function DPLL(P) { if consistent(P) then return true; if hasEmptyClause(P) then return false; foreach unit clause C in P do P = unit-propagate(C, P); foreach pure- literal L in P do P = pure-literal-assign(L, P); L = choose-literal(P); return DPLL(P  L) OR DPLL(P   L); } 19 The splitting rule: Select a variable whose value is not assigned yet. Recursively call DPLL for the cases in which the literal is true or false. REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL Procedure: Example 1 P = A ∧ (A ∨ ¬A) ∧ B  There are still variables and clauses to analyze, go ahead  P does not contain empty clauses, go ahead  It assigns the right truth-value to A and B: ν (A) = T, ν (B) = T  It simplifies P by removing all clauses in P which become true under ν (A) = T and ν (B) = T This causes the removal of all the clauses in P  It simplifies P by removing all literals in the clauses of P that become false from the remaining clauses: nothing to remove  It assigns values to pure literals. nothing to assign  All variables are assigned: it returns true 20 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL Procedure: Example 2 P = C ∧ (A ∨ ¬A) ∧ B  There are still variables and clauses to analyze, go ahead  P does not contain empty clauses, go ahead  It assigns the right truth-value to C and B: ν (C) = T, ν (B) = T  It simplifies P by removing all clauses in P which become true under ν (C) = T and ν (B) = T. P is then simplified to (A ∨ ¬A)  It simplifies P by removing all literals in the clauses of P that become false from the remaining clauses: nothing to remove  It assigns values to pure literals: nothing to assign  It selects A and applies the splitting rule by calling DPLL on  A ∧ (A ∨ ¬A) AND ¬A ∧ (A ∨ ¬A) which are both true (the first call is enough). It returns true 21 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

DPLL Procedure: Example 3 P = A ∧ ¬B ∧ (¬A ∨ B)  There are still variables and clauses to analyze, go ahead  P does not contain empty clauses, go ahead  It assigns the right truth-value to A and B ν (A) = T, ν (B) = F  It simplifies P by removing all clauses in P which become true under ν (A) = T and ν (B) = F. P is simplified to (¬A ∨ B)  It simplifies P by removing all literals in the clauses of P that become false from the remaining clauses: the last clause becomes empty  It assigns values to pure literals: nothing to assign  All variables are assigned but there is an empty clause: it returns false 22 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

The branching literal  The branching literal is the literal considered in the backtracking step (the one chosen for the splitting rule)  The DPLL algorithm (and corresponding efficiency) highly depends on the choice of the branching literal  DPLL as a family of algorithms:  One for each possible way of choosing the branching literal  The running time can be constant or exponential depending on the choice of the branching literals  Researches mainly focus on smart choices for the branching literal 23 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Final observations on the DPLL  There are several versions of the DPLL. We presented one.  Finding solutions to propositional logic formulas is an NP-complete problem  A DPLL SAT solver:  works on formulas in CNF  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“ approaches 24 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Using DPLL for reasoning tasks  Model checkingDoes ν satisfy P? ( ν ⊨ P?) Check if ν (P) = true  Satisfiability Is there any ν such that ν ⊨ P? Check that DPLL(P) succeeds and returns a ν  UnsatisfiabilityIs it true that there are no ν satisfying P? Check that DPLL(P) fails  Validity Is P a tautology? (true for all ν ) Check that DPLL(  P) fails NOTE: typical DPLL implementations take two parameters: the proposition P and a model ν. Therefore, in case of model checking the real call would be DPLL(P, ν) and check that it succeeds 25 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Pros and Cons of PL PROS  PL is declarative: the syntax captures facts  PL allows disjunctive (partial) and negated knowledge (unlike most databases)  PSAT is fundamental in important applications 26 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS CONS  PL has limited expressive power (yet useful in lots of applications)  No enumerations  No qualifiers (exists, for all)  No instances

Example (KB) Consider the following propositions: AreaManager → ManagerTopManager → Manager Manager → EmployeeTopManager(John) Since we cannot reason on instances, we can’t deduce the following: Manager(John), Employee(John) 27 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Example (KB) Consider the following: AreaManager(x) → Manager(x)Manager(x) → Employee(x) TopManager(x) → Manager(x)TopManager(John) They are not propositions because of the variables. 28 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS

Example (DB) If we codify it as a database: - No negations - No disjunctions the reasoning is polynomial. 29 REVIEW :: REASONING IN PL :: THE DPLL PROCEDURE :: OBSERVATIONS :: CONCLUSIONS