Foundations of Artificial Intelligence

Similar documents
Foundations of Artificial Intelligence

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

Foundations of Artificial Intelligence

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011

Part 1: Propositional Logic

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

Tutorial 1: Modern SMT Solvers and Verification

Comp487/587 - Boolean Formulas

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

Logical Inference. Artificial Intelligence. Topic 12. Reading: Russell and Norvig, Chapter 7, Section 5

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Formal Verification Methods 1: Propositional Logic

Lecture 9: The Splitting Method for SAT

CS156: The Calculus of Computation

Decision Procedures for Satisfiability and Validity in Propositional Logic

CS:4420 Artificial Intelligence

Logic and Inferences

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Lecture 2 Propositional Logic & SAT

Deliberative Agents Knowledge Representation I. Deliberative Agents

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Dieter Fox, Henry Kautz )

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Subbarao Kambhampati, Dieter Fox, Henry Kautz )

WHAT IS AN SMT SOLVER? Jaeheon Yi - April 17, 2008

Propositional and First Order Reasoning

Clause/Term Resolution and Learning in the Evaluation of Quantified Boolean Formulas

Worst-Case Upper Bound for (1, 2)-QSAT

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Theory of Computer Science. Theory of Computer Science. E4.1 Overview E4.2 3SAT. E4.3 Graph Problems. E4.4 Summary.

Propositional Logic: Methods of Proof (Part II)

Artificial Intelligence

Logical Agents. Chapter 7

Intelligent Agents. Pınar Yolum Utrecht University

Proof Methods for Propositional Logic

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Propositional Logic: Methods of Proof. Chapter 7, Part II

A brief introduction to Logic. (slides from

Class Assignment Strategies

Propositional and Predicate Logic - V

An instance of SAT is defined as (X, S)

Logical Agents. Santa Clara University

Planning as Satisfiability

CS 380: ARTIFICIAL INTELLIGENCE

Propositional Reasoning

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving

Topics in Model-Based Reasoning

LOGIC PROPOSITIONAL REASONING

Propositional Logic: Methods of Proof (Part II)

Propositional Calculus

Lecture Notes on SAT Solvers & DPLL

Propositional Logic: Evaluating the Formulas

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

Agenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World

Propositional and Predicate Logic. jean/gbooks/logic.html

CS156: The Calculus of Computation Zohar Manna Autumn 2008

Artificial Intelligence Chapter 7: Logical Agents

Proof Complexity Meets Algebra

Chapter 7 Propositional Satisfiability Techniques

CS 188: Artificial Intelligence Spring 2007

Propositional Logic: Methods of Proof (Part II)

Logical agents. Chapter 7. Chapter 7 1

Price: $25 (incl. T-Shirt, morning tea and lunch) Visit:

CSE507. Introduction. Computer-Aided Reasoning for Software. Emina Torlak courses.cs.washington.edu/courses/cse507/17wi/

Lecture 9: Search 8. Victor R. Lesser. CMPSCI 683 Fall 2010

Theory of Computer Science. Theory of Computer Science. E5.1 Routing Problems. E5.2 Packing Problems. E5.3 Conclusion.

Propositional Logic: Models and Proofs

Pythagorean Triples and SAT Solving

Artificial Intelligence

Foundations of Artificial Intelligence

Introduction to Artificial Intelligence. Logical Agents

Foundations of Artificial Intelligence

1 Efficient Transformation to CNF Formulas

Lecture 1: Logical Foundations

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

Classical Propositional Logic

Advanced Topics in LP and FP

Algebraic Dynamic Programming. Solving Satisfiability with ADP

Kecerdasan Buatan M. Ali Fauzi

Propositional logic. Programming and Modal Logic

Algorithms and Complexity of Constraint Satisfaction Problems (course number 3)

Self-assessment due: Monday 3/18/2019 at 11:59pm (submit via Gradescope)

Artificial Intelligence

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

Theory of Computer Science. Theory of Computer Science. E3.1 Overview. E3.2 Cook-Levin Theorem E3.3 3SAT. E3.4 Summary. Further Reading (German)

Theory of Computer Science

Satisfiability Modulo Theories

SAT Solvers: Theory and Practice

Solving SAT Modulo Theories

Computational Logic Chapter 2. Propositional Logic

Foundations of Artificial Intelligence

A Method for Generating All the Prime Implicants of Binary CNF Formulas

Sums of Products. Pasi Rastas November 15, 2005

Chapter 7 Propositional Satisfiability Techniques

Introduction. Chapter Context

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

Logical agents. Chapter 7. Chapter 7 1

COMP3702/7702 Artificial Intelligence Week 5: Search in Continuous Space with an Application in Motion Planning " Hanna Kurniawati"

Detecting Backdoor Sets with Respect to Horn and Binary Clauses

Logical Agents. Chapter 7

Transcription:

Foundations of Artificial Intelligence 31. Propositional Logic: DPLL Algorithm Malte Helmert and Gabriele Röger University of Basel April 24, 2017

Propositional Logic: Overview Chapter overview: propositional logic 29. Basics 30. Reasoning and Resolution 31. DPLL Algorithm 32. Local Search and Outlook

Motivation

Propositional Logic: Motivation Propositional logic allows for the representation of knowledge and for deriving conclusions based on this knowledge. many practical applications can be directly encoded, e.g. constraint satisfaction problems of all kinds circuit design and verification many problems contain logic as ingredient, e.g. automated planning general game playing description logic queries (semantic web)

Propositional Logic: Algorithmic Problems main problems: reasoning (Θ = ϕ?): Does the formula ϕ logically follow from the formulas Θ? equivalence (ϕ ψ): Are the formulas ϕ and ψ logically equivalent? satisfiability (SAT): Is formula ϕ satisfiable? If yes, find a model. German: Schlussfolgern, Äquivalenz, Erfüllbarkeit

The Satisfiability Problem The Satisfiability Problem (SAT) given: propositional formula in conjunctive normal form (CNF) usually represented as pair V, : find: V set of propositional variables (propositions) set of clauses over V (clause = set of literals v or v with v V ) satisfying interpretation (model) or proof that no model exists SAT is a famous NP-complete problem (Cook 1971; Levin 1973).

Relevance of SAT The name SAT is often used for the satisfiability problem for general propositional formulas (instead of restriction to CNF). General SAT can be reduced to CNF (conversion in time O(n)). All previously mentioned problems can be reduced to SAT (conversion in time O(n)). SAT algorithms important and intensively studied this and next chapter: SAT algorithms

Systematic Search: DPLL

SAT vs. CSP SAT can be considered as constraint satisfaction problem: CSP variables = propositions domains = {F, T} constraints = clauses However, we often have constraints that affect > 2 variables. Due to this relationship, all ideas for CSPs are applicable to SAT: search inference variable and value orders

The DPLL Algorithm The DPLL algorithm (Davis/Putnam/Logemann/Loveland) corresponds to backtracking with inference for CSPs. recursive call DPLL(, I ) for clause set and partial interpretation I result is consistent extension of I ; unsatisfiable if no such extension exists first call DPLL(, ) inference in DPLL: simplify: after assigning value d to variable v, simplify all clauses that contain v forward checking (for constraints of potentially higher arity) unit propagation: variables that occur in clauses without other variables (unit clauses) are assigned immediately minimum remaining values variable order

The DPLL Algorithm: Pseudo-Code function DPLL(, I ): if : [empty clause exists unsatisfiable] return unsatisfiable else if = : [no clauses left interpretation I satisfies formula] return I else if there exists a unit clause {v} or { v} in : [unit propagation] Let v be such a variable, d the truth value that satisfies the clause. := simplify(, v, d) return DPLL(, I {v d}) else: [splitting rule] Select some variable v which occurs in. for each d {F, T} in some order: := simplify(, v, d) I := DPLL(, I {v d}) if I unsatisfiable return I return unsatisfiable

The DPLL Algorithm: simplify function simplify(, v, d) Let l be the literal for v that is satisfied by v d. Let l be the complementary (opposite) literal to l. := {C C such that l / C} := {C \ { l} C } return

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (1) 2a. X F {{Y }, { Y }} = {{X, Y, Z}, { X, Y }, {Z}, {X, Y }} 1. unit propagation: Z T {{X, Y }, { X, Y }, {X, Y }} 2. splitting rule: 3a. unit propagation: Y T { } 2b. X T {{ Y }} 3b. unit propagation: Y F {}

Example (2) = {{W, X, Y, Z}, {X, Z}, {Y, Z}, {Z}} 1. unit propagation: Z T {{W, X, Y }, {X }, {Y }} 2. unit propagation: X T {{W, Y }, {Y }} 3. unit propagation: Y T {{W }} 4. unit propagation: W T {}

Example (2) = {{W, X, Y, Z}, {X, Z}, {Y, Z}, {Z}} 1. unit propagation: Z T {{W, X, Y }, {X }, {Y }} 2. unit propagation: X T {{W, Y }, {Y }} 3. unit propagation: Y T {{W }} 4. unit propagation: W T {}

Example (2) = {{W, X, Y, Z}, {X, Z}, {Y, Z}, {Z}} 1. unit propagation: Z T {{W, X, Y }, {X }, {Y }} 2. unit propagation: X T {{W, Y }, {Y }} 3. unit propagation: Y T {{W }} 4. unit propagation: W T {}

Example (2) = {{W, X, Y, Z}, {X, Z}, {Y, Z}, {Z}} 1. unit propagation: Z T {{W, X, Y }, {X }, {Y }} 2. unit propagation: X T {{W, Y }, {Y }} 3. unit propagation: Y T {{W }} 4. unit propagation: W T {}

Example (2) = {{W, X, Y, Z}, {X, Z}, {Y, Z}, {Z}} 1. unit propagation: Z T {{W, X, Y }, {X }, {Y }} 2. unit propagation: X T {{W, Y }, {Y }} 3. unit propagation: Y T {{W }} 4. unit propagation: W T {}

Example (2) = {{W, X, Y, Z}, {X, Z}, {Y, Z}, {Z}} 1. unit propagation: Z T {{W, X, Y }, {X }, {Y }} 2. unit propagation: X T {{W, Y }, {Y }} 3. unit propagation: Y T {{W }} 4. unit propagation: W T {}

Example (2) = {{W, X, Y, Z}, {X, Z}, {Y, Z}, {Z}} 1. unit propagation: Z T {{W, X, Y }, {X }, {Y }} 2. unit propagation: X T {{W, Y }, {Y }} 3. unit propagation: Y T {{W }} 4. unit propagation: W T {}

Properties of DPLL DPLL is sound and complete. DPLL computes a model if a model exists. Some variables possibly remain unassigned in the solution I ; their values can be chosen arbitrarily. time complexity in general exponential important in practice: good variable order and additional inference methods (in particular clause learning) Best known SAT algorithms are based on DPLL.

DPLL on Horn Formulas

Horn Formulas important special case: Horn formulas Definition (Horn formula) A Horn clause is a clause with at most one positive literal, i.e., of the form (n = 0 is allowed.) x 1 x n y or x 1 x n A Horn formula is a propositional formula in conjunctive normal form that only consists of Horn clauses. German: Hornformel foundation of logic programming (e.g., PROLOG) hot research topic in program verification

DPLL on Horn Formulas Proposition (DPLL on Horn formulas) If the input formula ϕ is a Horn formula, then the time complexity of DPLL is polynomial in the length of ϕ. Proof. properties: 1. If is a Horn formula, then so is simplify(, v, d). (Why?) all formulas encountered during DPLL search are Horn formulas if input is Horn formula 2. Every Horn formula without empty or unit clauses is satisfiable: all such clauses consist of at least two literals Horn property: at least one of them is negative assigning F to all variables satisfies formula...

DPLL on Horn Formulas (Continued) Proof (continued). 3. From 2. we can conclude: if splitting rule applied, then current formula satisfiable, and if a wrong decision is taken, then this will be recognized without applying further splitting rules (i.e., only by applying unit propagation and by deriving the empty clause). 4. Hence the generated search tree for n variables can only contain at most n nodes where the splitting rule is applied (i.e., where the tree branches). 5. It follows that the search tree is of polynomial size, and hence the runtime is polynomial.

Summary

Summary satisfiability basic problem in propositional logic to which other problems can be reduced here: satisfiability for CNF formulas Davis-Putnam-Logemann-Loveland procedure (DPLL): systematic backtracking search with unit propagation as inference method DPLL successful in practice, in particular when combined with other ideas such as clause learning polynomial on Horn formulas (= at most one positive literal per clause)