Reasoning with Quantified Boolean Formulas

Similar documents
LOGIC PROPOSITIONAL REASONING

Propositional Logic: Evaluating the Formulas

Preprocessing QBF: Failed Literals and Quantified Blocked Clause Elimination

Quantified Boolean Formulas Part 1

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

Comp487/587 - Boolean Formulas

Quantified Boolean Formulas: Complexity and Expressiveness

Propositional and Predicate Logic - II

Validating QBF Invalidity in HOL4

Propositional Logic: Models and Proofs

ECE473 Lecture 15: Propositional Logic

Dependency Schemes in QBF Calculi: Semantics and Soundness

Decision Procedures for Satisfiability and Validity in Propositional Logic

Part 1: Propositional Logic

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

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

Propositional Logic Language

Propositional Logic. Testing, Quality Assurance, and Maintenance Winter Prof. Arie Gurfinkel

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

Shamir s Theorem. Johannes Mittmann. Technische Universität München (TUM)

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

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

Conjunctive Normal Form and SAT

A New 3-CNF Transformation by Parallel-Serial Graphs 1

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

A Collection of Problems in Propositional Logic

Tutorial 1: Modern SMT Solvers and Verification

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic

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

A brief introduction to Logic. (slides from

Logic and Inferences

Conjunctive Normal Form and SAT

Satisfiability Modulo Theories

Formal Verification Methods 1: Propositional Logic

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


Language of Propositional Logic

INF3170 / INF4171 Notes on Resolution

Propositional and Predicate Logic - V

Proof Complexity of Quantified Boolean Formulas

Part 1: Propositional Logic

Normal Forms of Propositional Logic

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

Warm-Up Problem. Is the following true or false? 1/35

The Complexity of Computing the Behaviour of Lattice Automata on Infinite Trees

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Incremental QBF Solving by DepQBF

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

First-order resolution for CTL

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Chapter 4: Classical Propositional Semantics

CS156: The Calculus of Computation

SMT BASICS WS 2017/2018 ( ) LOGIC SATISFIABILITY MODULO THEORIES. Institute for Formal Models and Verification Johannes Kepler Universität Linz

Bounded-width QBF is PSPACE-complete

22c:145 Artificial Intelligence

Finding small unsatisfiable cores to prove unsatisfiability of QBFs

Resolution on Quantified Generalized Clause-sets

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

Foundations of Artificial Intelligence

Conjunctive Normal Form and SAT

CS 512, Spring 2017, Handout 10 Propositional Logic: Conjunctive Normal Forms, Disjunctive Normal Forms, Horn Formulas, and other special forms

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

Non-CNF QBF Solving with QCIR

1 PSPACE-Completeness

A Little Logic. Propositional Logic. Satisfiability Problems. Solving Sudokus. First Order Logic. Logic Programming

Propositional logic. First order logic. Alexander Clark. Autumn 2014

Theory of Computation Space Complexity. (NTU EE) Space Complexity Fall / 1

Propositional Reasoning

INTRODUCTION TO PREDICATE LOGIC HUTH AND RYAN 2.1, 2.2, 2.4

Logic: First Order Logic

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

CS:4420 Artificial Intelligence

3 Propositional Logic

Propositional Resolution Introduction

Critical Reading of Optimization Methods for Logical Inference [1]

Satisfiability and SAT Solvers. CS 270 Math Foundations of CS Jeremy Johnson

Predicate Logic: Sematics Part 1

Propositional logic. Programming and Modal Logic

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

Logic as a Tool Chapter 4: Deductive Reasoning in First-Order Logic 4.4 Prenex normal form. Skolemization. Clausal form.

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

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

A Tableau Calculus for Minimal Modal Model Generation

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

Propositional Resolution Part 1. Short Review Professor Anita Wasilewska CSE 352 Artificial Intelligence

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

Extending DPLL-Based QBF Solvers to Handle Free Variables

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler

An Introduction to SAT Solving

Lecture 9: The Splitting Method for SAT

Introduction to Artificial Intelligence. Logical Agents

Computer-Aided Verification

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson

Umans Complexity Theory Lectures

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation

Classical Propositional Logic

AAA615: Formal Methods. Lecture 2 First-Order Logic

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

Transcription:

Reasoning with Quantified Boolean Formulas Martina Seidl Institute for Formal Models and Verification Johannes Kepler University Linz 1

What are QBF? Quantified Boolean formulas (QBF) are formulas of propositional logic + quantifiers Examples: (x y) ( x y) (propositional logic) x y(x y) ( x y) Is there a value for x such that for all values of y the formula is true? y x(x y) ( x y) For all values of y, is there a value for x such that the formula is true? 2

SAT vs. QSAT aka NP vs. PSPACE SAT φ(x 1, x 2, x 3 ) QBF x 1 x 2 x 3 φ(x 1, x 2, x 3 ) Is there a satisfying assignment? Is there a satisfying assignment tree? 3

The Two Player Game Interpretation of QSAT Interpretation of QSAT as two player game for a QBF x 1 a 1 x 2 a 2 x n a n ψ: Player A (existential player) tries to satisfy the formula by assigning existential variables Player B (universal player) tries to falsify the formula by assigning universal variables Player A and Player B make alternately an assignment of the variables in the outermost quantifier block Player A wins: formula is satisfiable, i.e., there is a strategy for assigning the existential variables such that the formula is always satisfied Player B wins: formula is unsatisfiable 4

Promises of QBF QSAT is the prototypical problem for PSPACE. QBFs are suitable as host language for the encoding of many application problems like verification artificial intelligence knowledge representation game solving In general, QBF allow more succinct encodings then SAT 5

Application of a QBF Solver QBF Solver returns 1. yes/no 2. witnesses 6

The Language of QBF The language of quantified Boolean formulas L P over a set of propositional variables P is the smallest set such that if v P {, } then v L P if φ L P then φ L P if φ and ψ L P then φ ψ L P if φ and ψ L P then φ ψ L P if φ L P then vφ L P if φ L P then vφ L P (variables, truth constants) (negation) (conjunction) (disjunction) (existential quantifier) (universal quantifier) 7

Some Notes on Variables and Truth Constants stands for top always true empty conjunction stands for bottom always false empty disjunction literal: variable or negation of a variable examples: l 1 = v, l 2 = w var(l) = v if l = v or l = v complement of literal l: l var(φ): set of variables occurring in QBF φ 8

Some QBF Terminology Example Let Qvψ with Q {, } be a subformula in a QBF φ. Then ψ is the scope of v Q is the quantifier binding of v quant(v) = Q free variable w in φ: w has no quantifier binding in φ bound variable w in QBF φ: w has quantifier binding in φ closed QBF: no free variables bound var a {}}{ a free variable closed QBF {}}{ bound vars y, z scope of y, z {}}{{}}{ y z ((y z) ( y z))) {}}{ (a x }{{} scope of a 9

Prenex Conjunctive Normal Form (PCNF) A QBF φ is in prenex conjunctive normal form iff φ is in prenex normal form φ = Q 1 v 1... Q n v n ψ matrix ψ is in conjunctive normal form, i.e., ψ = C 1 C n where C i are clauses, i.e., disjunctions of literals. Example x y((x y) ( x y)) }{{}}{{} prefix matrix in CNF 10

Some Words on Notation If convenient, we write a conjunction of clauses as a set, i.e., a clause as a set of literals, i.e., C 1... C n = {C 1,..., C n } l 1... l k = {l 1,..., l k } var(φ) for the variables occurring in φ var(l) for the variable of a literal, i.e., Example var(l) = x iff l = x or l = x x y((x y) ( x y)) x y{{x, y}, { x y}} }{{}}{{}}{{}}{{} prefix matrix in CNF prefix matrix in CNF 11

Semantics of QBFs A valuation function I: L P {T, F} for closed QBFs is defined as follows: I( ) = T ; I( ) = F I( ψ) = T iff I(ψ) = F I(φ ψ) = T iff I(φ) = T or I(ψ) = T I(φ ψ) = T iff I(φ) = T and I(ψ) = T I( vψ) = T iff I(ψ[ /v]) = T and I(ψ[ /v]) = T I( vψ) = T iff I(ψ[ /v]) = T or I(ψ[ /v]) = T Note: For QBFs with free variable an additional valuation function v : P {T, F} is needed. 12

Boolean s p l i t (QBF φ ) switch (φ) case : r e t u r n true ; case : r e t u r n false ; case ψ : r e t u r n ( not s p l i t (ψ ) ) ; case ψ ψ : r e t u r n s p l i t (ψ ) && s p l i t (ψ ) ; case ψ ψ : r e t u r n s p l i t (ψ ) s p l i t (ψ ) ; case QXψ : s e l e c t x X ; X = X\{x} ; i f ( Q == ) r e t u r n ( s p l i t ( QX ψ[x/ ] ) && s p l i t ( QX ψ[x/ ] ) ) ; else r e t u r n ( s p l i t ( QX ψ[x/ ] ) s p l i t ( QX ψ[x/ ] ) ) ; 13

Some Simplifications The following rewritings are equivalence preserving: 1. ; ; 2. φ φ; φ ; φ ; φ φ; 3. (Qx φ) φ, Q {, }, x does not occur in φ; Example ab x c yz d{{a, b, c}, {a, b, }, {c, y, d, }, {x, y, }, {x, c, d, }} abc y d{{a, b, c}, {a, b}, {c, y, d}} 14

Boolean splitcnf ( P r e f i x P, matrix ψ ) i f (ψ == ) : r e t u r n true ; i f ( ψ ) : r e t u r n false ; P = QXP,x X, X = X\{x} ; i f ( Q == ) r e t u r n ( splitcnf ( QX P, ψ ) && splitcnf ( QX P, ψ ) ) ; else r e t u r n ( splitcnf ( QX P, ψ ) splitcnf ( QX P, ψ ) ) ; where ψ : take clauses of ψ, delete clauses with x, delete x ψ : take clauses of ψ, delete clauses with x, delete x 15

Unit Clauses A clause C is called unit in a formula φ iff Definition of Unit Literal Elimination C contains exactly one existential literal the universal literals of C are to the right of the existential literal in the prefix The existential literal in the unit clause is called unit literal. Example ab x c y d{{a, b, c, x}, {a, b}, {c, y, d}, {x, y}, {x, c, d}, {y}} Unit literals: x, y 16

Unit Literal Elimination Definition of Unit Literal Let φ be a QBF with unit literal l and let ψ be a QBF obtained from φ by removing all clauses containing l removing all occurrences of l Then φ ψ Example ab x c y d{{a, b, c, x}, {a, b}, {c, y, d}, {x, y}, {x, c, d}, {y}} After unit literal elimiation: ab c{{a, b, c}, {a, b}} 17

Pure Literals A literal l is called pure in a formula φ iff l occurs in φ the complement of l, i.e., l does not occur in φ Definition of Pure Literal Elimination Example ab x c yz d{{a, b, c}, {a, b}, {c, y, d}, {x, y}, {x, c, d}} Pure: a, d, x, y 18

Pure Literal Elimination Definition of Pure Literal Let φ be a QBF with pure literal l and let ψ be a QBF obtained from φ by Example removing all clauses with l if quant(l) = removing all occurences of l if quant(l) = ab x c yz d{{a, b, c}, {a, b}, {c, y, d}, {x, y}, {x, c, d}} After Pure Literal Elimination: b{{b}, { b}} 19

Universal Reduction Example Let φ be a QBF in PCNF and C φ. Let l C with quant(l) = forall k C with quant(k) = k < l, i.e., all existential variables k of C are to the left of l in the prefix. Then l may be removed from C. C\{l} is called the forall reduct (also universal reduct of C). ab x c yz d{{a, b, c, x}, {a, b, x}, {c, y, d}, {x, y}, {x, c, d}}} After Universal Reduction: ab x c yz d{{a, b, x}, {a, b, x}, {c, y}, {x, y}, {x}}} 20

Boolean splitcnf2 ( P r e f i x P, matrix ψ ) (P, ψ) = simplify(p, ψ) ; i f (ψ == ) : r e t u r n true ; i f ( ψ ) : r e t u r n false ; P = QXP,x X, X = X\{x} ; i f ( Q == ) r e t u r n ( splitcnf2 ( QX P, ψ ) && splitcnf2 ( QX P, ψ ) ) ; else r e t u r n ( splitcnf2 ( QX P, ψ ) splitcnf2 ( QX P, ψ ) ) ; where ψ : take clauses of ψ, delete clauses with x, delete x ψ : take clauses of ψ, delete clauses with x, delete x 21

Resolution for QBF Q-Resolution: propositional resolution + universal reduction (UR). Definition Let C 1, C 2 be clauses with existential literal v C 1 and v C 2. 1. Tentative Q-resolvent: C 1 C 2 := (UR(C 1 ) UR(C 2 )) \ {v, v}. 2. If {x, x} C 1 C 2 then no Q-resolvent exists. 3. Otherwise, Q-resolvent C := (C 1 C 2 ). Q-resolution is a sound and complete calculus. Dual variant for QBFs in QDNF. Universals as pivot are also possible. 22

Q-Resolution Example Exclusive OR (XOR): QBF ψ = x y(x y) ( x y) Truth Table x y Universal-Reduction ψ 0 0 0 0 1 1 Resolution unsat 1 0 1 1 1 0 Q-Resolution Proof x y x y x x y = x ψ = 0 f y (x) = x (counter model) 23

Q-Resolution Example Exclusive OR (XOR): QBF ψ = x y(x y) ( x y) Truth Table x y ψ 0 0 0 0 1 1 1 0 1 1 1 0 unsat y = x ψ = 0 f y (x) = x (counter model) 23

Q-Resolution Example Exclusive OR (XOR): QBF ψ = x y(x y) ( x y) Truth Table x y ψ 0 0 0 0 1 1 1 0 1 1 1 0 unsat Q-Resolution Proof x y x y x x y = x ψ = 0 f y (x) = x (counter model) 23

Q-Resolution Example Exclusive OR (XOR): QBF ψ = x y(x y) ( x y) Truth Table x y Universal-Reduction ψ 0 0 0 0 1 1 1 0 1 unsat 1 1 0 Q-Resolution Proof x y x y x x y = x ψ = 0 f y (x) = x (counter model) 23

Q-Resolution Example Exclusive OR (XOR): QBF ψ = x y(x y) ( x y) Truth Table x y Universal-Reduction ψ 0 0 0 0 1 1 Resolution unsat 1 0 1 1 1 0 Q-Resolution Proof x y x y x x y = x ψ = 0 f y (x) = x (counter model) 23

Q-Resolution Example Exclusive OR (XOR): QBF ψ = x y(x y) ( x y) Truth Table x y ψ 0 0 0 0 1 1 1 0 1 1 1 0 unsat Q-Resolution Proof x y x y x x y = x ψ = 0 f y (x) = x (counter model) 23

Q-Resolution Example Exclusive OR (XOR): QBF ψ = x y(x y) ( x y) Truth Table x y ψ 0 0 0 0 1 1 1 0 1 1 1 0 unsat Q-Resolution Proof x y x y x x y = x ψ = 0 f y (x) = x (counter model) 23

Example: Q-Resolution Input Formula x 1 y 1 x 2 x 3 y 2 x 4 x 5.( x 1 x 5 ) (y 1 x 4 x 5 ) (x 2 y 2 x 4 ) (x 3 y 2 x 4 ) ( x 2 x 3 y 2 ) (x 1 x 4 ) Q-Resolution Proof DAG x 1 x 5 y 1 x 4 x 5 x 2 y 2 x 4 x 3 y 2 x 4 x 2 x 3 y 2 x 1 x 4 x 2 y 2 x 4 x 1 y 1 y 2 y 1 y 2 x 5 y 2 x 4 x 1 y 2 24

Example: Q-Resolution Input Formula x 1 y 1 x 2 x 3 y 2 x 4 x 5.( x 1 x 5 ) (y 1 x 4 x 5 ) (x 2 y 2 x 4 ) (x 3 y 2 x 4 ) ( x 2 x 3 y 2 ) (x 1 x 4 ) x 1 y 1 x 2 x 3 y 2 x 4 x 5.( x 1 x 5 ) (y 1 x 4 x 5 ) (x 2 y 2 x 4 ) Q-Resolution Proof DAG (x 3 y 2 x 4 ) ( x 2 x 3 y 2 ) (x 1 x 4 ) x 1 x 5 y 1 x 4 x 5 x 2 y 2 x 4 x 3 y 2 x 4 x 2 x 3 y 2 x 1 x 4 x 2 y 2 x 4 x 1 y 1 y 2 y 1 y 2 x 5 y 2 x 4 x 1 y 2 24