Reduced Ordered Binary Decision Diagrams

Similar documents
Reduced Ordered Binary Decision Diagrams

Symbolic Model Checking with ROBDDs

Decision Procedures for Satisfiability and Validity in Propositional Logic

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

Binary Decision Diagrams Boolean Functions

Comp487/587 - Boolean Formulas

Binary Decision Diagrams

Boolean decision diagrams and SAT-based representations

Part 1: Propositional Logic

Overview. Discrete Event Systems Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for?

Binary Decision Diagrams

Binary Decision Diagrams

COMPRESSED STATE SPACE REPRESENTATIONS - BINARY DECISION DIAGRAMS

Binary Decision Diagrams

Basing Decisions on Sentences in Decision Diagrams

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving III & Binary Decision Diagrams. Sanjit A. Seshia EECS, UC Berkeley

Model Checking for Propositions CS477 Formal Software Dev Methods

A brief introduction to Logic. (slides from

2.5.2 Basic CNF/DNF Transformation

CSC 2429 Approaches to the P vs. NP Question and Related Complexity Questions Lecture 2: Switching Lemma, AC 0 Circuit Lower Bounds

Tecniche di Verifica. Introduction to Propositional Logic

CTL Model Checking. Wishnu Prasetya.

Quantified Boolean Formulas: Complexity and Expressiveness

02 Propositional Logic

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

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

Propositional and Predicate Logic - II

CS357: CTL Model Checking (two lectures worth) David Dill

Labeled Transition Systems

NP and Computational Intractability

Tutorial 1: Modern SMT Solvers and Verification

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

CS156: The Calculus of Computation

Equivalences. Proposition 2.8: The following equivalences are valid for all formulas φ, ψ, χ: (φ φ) φ. Idempotency Idempotency Commutativity

Reduced Ordered Binary Decision Diagram with Implied Literals: A New knowledge Compilation Approach

Boolean circuits. Lecture Definitions

A Collection of Problems in Propositional Logic

Classes of Boolean Functions

Chapter 4: Computation tree logic

Propositional and Predicate Logic - V

SAT, NP, NP-Completeness

Binary Decision Diagrams. Graphs. Boolean Functions

Chapter 4: Classical Propositional Semantics

Chapter 3 Deterministic planning

Conjunctive Normal Form and SAT

Foundations of Artificial Intelligence

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

On the Isomorphism Problem for Decision Trees and Decision Lists

SAT Solvers: Theory and Practice

Notes for Lecture 3... x 4

Compiling Knowledge into Decomposable Negation Normal Form

LOGIC PROPOSITIONAL REASONING

Maximum 3-SAT as QUBO

Non-Deterministic Time

1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions

1 Algebraic Methods. 1.1 Gröbner Bases Applied to SAT

CS156: The Calculus of Computation Zohar Manna Autumn 2008

Automata Theory CS Complexity Theory I: Polynomial Time

Static Program Analysis

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

A note on monotone real circuits

Theoretical Foundations of the UML

CSE 135: Introduction to Theory of Computation NP-completeness

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

Propositional Logic: Models and Proofs

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

Part 1: Propositional Logic

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

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

Chapter 2 Combinational Logic Circuits

Logic and Inferences

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

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

Conjunctive Normal Form and SAT

Propositional Logic: Evaluating the Formulas

Binary Decision Diagrams

On the Complexity of the Reflected Logic of Proofs

CSE20: Discrete Mathematics for Computer Science. Lecture Unit 2: Boolan Functions, Logic Circuits, and Implication

Propositional and First Order Reasoning

Exercises - Solutions

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Intro to Theory of Computation

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

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

De Morgan s a Laws. De Morgan s laws say that. (φ 1 φ 2 ) = φ 1 φ 2, (φ 1 φ 2 ) = φ 1 φ 2.

Lecture Notes on Emptiness Checking, LTL Büchi Automata

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Formal Verification Methods 1: Propositional Logic

Deductive Systems. Lecture - 3

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Binary Decision Diagrams and Symbolic Model Checking

Binary Decision Diagrams

Validating QBF Invalidity in HOL4

Substitution Theorem. Equivalences. Proposition 2.8 The following equivalences are valid for all formulas φ, ψ, χ: (φ φ) φ Idempotency

The Complexity of Minimizing FBDDs

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

On the Relative Efficiency of DPLL and OBDDs with Axiom and Join

3 Propositional Logic

Notes on Computer Theory Last updated: November, Circuits

Transcription:

Reduced Ordered Binary Decision Diagrams Lecture #12 of Advanced Model Checking Joost-Pieter Katoen Lehrstuhl 2: Software Modeling & Verification E-mail: katoen@cs.rwth-aachen.de December 13, 2016 c JPK

Symbolic CTL model checking Explicit representation of transition system: state explosion problem Idea: reformulate model-checking in a symbolic way Concept: represent sets of states and transitions symbolically Approach: binary encoding of states + switching functions for sets Compact representation of switching functions by binary decision diagrams Alternative: conjunctive normal form (basis for SAT-based model checking) c JPK 1

Basic approach let TS = (S,,I, AP,L) be a large finite transition system the set of actions is irrelevant here and has been omitted, i.e., S S For n log S, let injective function enc : S {0,1} n note: enc(s) = {0,1} n is no restriction, as all elements {0,1} n \ enc(s) can be treated as the encoding of pseudo states that are unreachable Identify the states s S = enc 1 ({0,1} n ) with enc(s) {0,1} n And T S by its characteristic function χ T : {0,1} n {0,1} that is χ T (enc(s)) = 1 if and only if s T And S S by the Boolean function : {0,1} 2n {0,1} such that ( enc(s), enc(s ) ) = 1 if and only if s s c JPK 2

Switching functions Let Var = {z 1,...,z m } be a finite set of Boolean variables, m 0 An evaluation is a function η : Var {0,1} let Eval(z 1,...,z m ) denote the set of evaluations for z 1,...,z m shorthand [z 1 = b 1,...,z m = b m ] for η(z 1 ) = b 1,...,η(z m ) = b m f : Eval(Var) {0,1} is a switching function for Var = {z 1,...,z m } Logical operations and quantification are defined as expected f 1 ( ) f 2 ( ) = min{f 1 ( ),f 2 ( )} f 1 ( ) f 2 ( ) = max{f 1 ( ),f 2 ( )} z.f( ) = f( ) z=0 f( ) z=1, and z.f( ) = f( ) z=0 f( ) z=1 c JPK 3

Polynomial-size data structure impossible There is no poly-size data structure for all switching functions Eval(z 1,...,z m ) = 2 m, so #functions Eval(z 1,...,z m ) {0,1} is 2 2m Suppose there is a data structure that can represent K m switching functions by at most 2 m 1 bits Then K m 2 m 1 i=0 2 i = 2 2m 1 +1 1 < 2 2m 1 +1 But then there are at least ( ) 2 2m 2 2m 1 +1 = 2 2m 1 +1 2 2m 2 m 1 1 1 ( ) = 2 2m 1 +1 2 2m 1 1 1 switching functions whose representation needs more than 2 m 1 bits c JPK 4

Possible representations of switching functions Truth tables very space inefficient: 2 n entries for n variables satisfiability and equivalence check: easy; boolean operations also easy... but have to consider exponentially many lines (so are hard)... in Disjunctive Normal Form (DNF) satisfiability is easy: find a disjunct that does have complementary literals negation and conjunction complicated equivalence checking (f = g?) is conp-complete... in Conjunctive Normal Form (CNF) satisfiability problem is NP-complete (Cook s theorem) negation and disjunction complicated c JPK 5

Representing switching functions representation compact? sat equi propositional formula often hard hard easy easy easy DNF sometimes easy hard hard easy hard CNF sometimes hard hard easy hard hard (ordered) truth table never hard hard hard hard hard c JPK 6

There is hope... perhaps Nevertheless there are data structures which yield compact representations for many switching functions that appear in practical applications for hardware circuits, ordered binary decision diagrams (OBDDs) are successful c JPK 7

Representing boolean functions representation compact? sat equ propositional formula often hard hard easy easy easy DNF sometimes easy hard hard easy hard CNF sometimes hard hard easy hard hard (ordered) truth table never hard hard hard hard hard reduced ordered binary decision diagram often easy easy medium medium easy provided appropriate implementation techniques are used c JPK 8

Binary decision tree The BDT for function f on Var = {z 1,...,z m } has depth m outgoing edges for node at level i stand for z i = 0 (dashed) and z i = 1 (solid) For evaluation s = [z 1 = b 1,...,z m = b m ], f(s) is the value of the leaf reached by traversing the BDT from the root using branch z i = b i for at level i The subtree of node v at level i for variable ordering z 1 <... < z m represents f v = f z1 =b 1,...,z i 1 =b i 1 which is a switching function over {z i,...,z m } and where z 1 = b 1,...,z i 1 = b i 1 is the sequence of decisions made along the path from the root to node v c JPK 9

Symbolic representation of a transition system s 0 s 1 a Switching function: (x 1,x 2 s 3 s 2 {a,b},x }{{} 1,x 2) = 1 if and only if s s }{{} s s (x 1,x 2,x 1,x 2 ) = ( x 1 x 2 x 1 x 2 ) ( x 1 x 2 x 1 x 2 ) ( x 1 x 2 x 1 x 2 )... (x 1 x 2 x 1 x 2 ) b c JPK 10

Transition relation as a BDT x 1 x 2 x 2 x 1 x 1 x 1 x 1 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 0 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 A BDT representing for our example using ordering x 1 < x 2 < x 1 < x 2 c JPK 11

Facts about BDTs BDTs are not compact a BDT for switching function f on n variables has 2 n leafs they are as space inefficient as truth tables! BDTs contain quite some redundancy all leafs with value one (zero) could be collapsed into a single leaf a similar scheme could be adopted for isomorphic subtrees The size of a BDT does not change if the variable order changes c JPK 12

Ordered Binary Decision Diagram OBDDs rely on compactifying BDT representations Idea: skip redundant fragments of BDT representations Collapse subtrees with all terminals having same value Identify nodes with isomorphic sub-trees This yields directed acyclic graphs with out-degree two Inner nodes are labeled with variables Leafs are labeled with function values (zero and one) c JPK 13

Ordered Binary Decision Diagram Let be a (total) variable ordering for Var where = (z 1,...,z m ). An -OBDD is a tuple B = (V,V I,V T, succ 0, succ 1, var, val,v 0 ) with a finite set V of nodes, partitioned into V I (inner) and V T (terminals) and a distinguished root (node) v 0 V successor functions succ 0, succ 1 : V I V such that each node v V \ {v 0 } has at least one predecessor i.e., all nodes of the OBDD B are reachable from the root a labeling functions var : V I Var and val : V T {0,1} satisfying for = (z 1,...,z m ) and v V I : var(v) = z i w { succ 0 (v), succ 1 (v)} V I var(w) = z j for j > i c JPK 14

Some example OBDDs c JPK 15

Transition relation as an OBDD x 1 x 2 x 2 x 1 x 1 x 1 x 1 x 2 x 2 x 2 x 2 0 1 0 1 1 0 1 1 An example OBDD representing f for our example using x 1 < x 2 < x 1 < x 2 c JPK 16

Semantics of an OBDD The semantics of -OBDD B is the switching function f B where f B ([z 1 = b 1,...,z m = b m ]) is the value of the resulting leaf when traversing B starting in v 0 and branching according to the evaluation [z 1 = b 1,...,z m = b m ] c JPK 17

Intermezzo: OBDDs versus DFA x 1 0 1 x 1 x 1 1 0 x 2 0 0 1 x 2 x 2 0 1 1 1 0 0 1 each OBDD B is a deterministic automaton A B with f 1 B (1) = L(A B) c JPK 18

Bottom-up characterization of f B Let B be a -OBDD. Switching function f v for node v V : If v V T, then f v is the constant switching function with value val(v) Ifv V I with var(v) = z, thenf v = ( ( ) z f succ0 (v)) z fsucc1 (v) }{{} Shannon expansion Furthermore, f B = f v0 for the root v 0 of B c JPK 19

Consistent co-factors in OBDDs Let f be a switching function for Var Let = (z 1,...,z m ) a variable ordering for Var, i.e., z 1 <... < z m Switching function g is a -consistent cofactor of f if g = f z1 =b 1,...,z i =b i for some i {0,1,...,m} It holds that: 1. for each node v of an -OBDD B, f v is a -consistent cofactor of f B 2. for each -consistent cofactor g of f B there is a node v B with f v = g c JPK 20

Reduced OBDDs A -OBDD B is reduced if for every pair (v,w) of nodes in B: v w implies f v f w (A reduced -OBDD is abbreviated as -ROBDD) In -ROBDDs any -consistent cofactor is represented by exactly one node c JPK 21

Example ROBDDs c JPK 22

Transition relation as an OBDD x 1 x 2 x 2 x 1 x 1 x 1 x 1 x 2 x 2 x 2 x 2 0 1 0 1 1 0 1 1 An example OBDD representing f for our example using x 1 < x 2 < x 1 < x 2 c JPK 23

Transition relation as an ROBDD x 1 x 1 x 2 x 2 x 1 x 1 x 1 x 1 x 1 x 2 x 2 x 2 x 2 x 2 0 1 0 1 (a) ordering x 1 < x 2 < x 1 < x 2 (b) ordering x 1 < x 1 < x 2 < x 2 c JPK 24

Universality and canonicity theorem [Fortune, Hopcroft & Schmidt, 1978] For finite set Var of Boolean variables and a variable ordering for Var: (a) For each switching function f on Var there exists a -ROBDD B with f B = f (b) For any -ROBDDs B and C with f B = f C, B and C are isomorphic, i.e., agree up to renaming of nodes c JPK 25

Proof c JPK 26

The importance of canonicity Absence of redundant vertices if f B does not depend on x i, ROBDD B does not contain an x i node Test for equivalence: f(x 1,...,x n ) g(x 1,...,x n )? generate ROBDDs B f and B g, and check isomorphism Test for validity: for all x 1,...,x n, is f(x 1,...,x n ) = 1? generate ROBDD B f and check whether it only consists of a 1-leaf Test for implication: f(x 1,...,x n ) g(x 1,...,x n )? generate ROBDD B f g and check if it just consists of a 0-leaf Test for satisfiability f is satisfiable if and only if B f has a reachable 1-leaf c JPK 27

Minimality of ROBDDs Let B be an -OBDD for f. Then: B is reduced iff size(b) size(c) for each -OBDD C for f. This follows from the fact that: 1. Each -consistent cofactor of f is represented in any -OBDD for f by at least one node, and 2. A -OBDD B for f is reduced iff there is a 1-to-1 correspondence between the nodes in B and the -consistent cofactors of B. c JPK 28

Reducing OBDDs Generate an OBDD (or BDT) for a boolean expression, then reduce by means of a recursive descent over the OBDD Elimination of duplicate leafs for a duplicate 0-leaf (or 1-leaf), redirect all incoming edges to just one of them Elimination of don t care (non-leaf) vertices if succ 0 (v) = succ 1 (v) = w, delete v and redirect all its incoming edges to w Elimination of isomorphic subtrees if v w are roots of isomorphic subtrees, remove w and redirect all incoming edges to w to v note that the first reduction is a special case of the latter c JPK 29

How to reduce an OBDD? becomes 1 0 0 1 1 0 (special case of) isomorphism rule c JPK 30

How to reduce an OBDD? v w v becomes 0 1 0 1 isomorphism rule c JPK 31

How to reduce an OBDD? v becomes w w elimination rule c JPK 32

Example c JPK 33

Soundness of reduction rules if C arises from a -OBDD B by the elimination or isomorphism rule, then: C is a -OBDD with f B = f C Elimination rule for v with var(v) = z, and w = succ 0 (v) = succ 1 (v): f v = ( ) z f succ0 (v) ( ) z f succ1 (v) Isomorphism rule for v, w with var(v) = var(w) = z yields: f v = = = f w = ( z f w ) (z f w ) = f w ( ) ( ) z f succ0 (v) z f ( ) ( succ1 (v) ) z f succ0 (w) z f succ1 (w) as each reduction rule decreases the # nodes, repeatedly applying them terminates c JPK 34

Completeness of reduction rules -OBDD B is reduced if and only if no reduction rule is applicable to B c JPK 35