Boolean Affine Approximation with Binary Decision Diagrams

Similar documents
An example of Lagrangian for a non-holonomic system

Chapter 8: MULTIPLE CONTINUOUS RANDOM VARIABLES

Toda s Theorem: PH P #P

1 :: Mathematical notation

The Maze Generation Problem is NP-complete

Polynomial and Rational Functions

8. BOOLEAN ALGEBRAS x x

Two NP-hard Interchangeable Terminal Problems*

A Generalization of a result of Catlin: 2-factors in line graphs

An Explicit Lower Bound of 5n o(n) for Boolean Circuits

Polynomial and Rational Functions

Math 20C. Lecture Examples.

ES.1803 Topic 16 Notes Jeremy Orloff

Binary Decision Diagrams

Chapter 3. Systems of Linear Equations: Geometry

The Dot Product

Space Coordinates and Vectors in Space. Coordinates in Space

Foundations of Databases

Bloom Filters and Locality-Sensitive Hashing

Blocks of Hypergraphs applied to Hypergraphs and Outerplanarity

arxiv: v1 [math.co] 30 May 2016

The Inverse Function Theorem

Announcements Wednesday, September 06

8.1 Exponents and Roots

Section 3.1. ; X = (0, 1]. (i) f : R R R, f (x, y) = x y

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

Concept of Stress at a Point

Estimation of Efficiency with the Stochastic Frontier Cost. Function and Heteroscedasticity: A Monte Carlo Study

Dynamics ( 동역학 ) Ch.2 Motion of Translating Bodies (2.1 & 2.2)

Alternative non-linear predictive control under constraints applied to a two-wheeled nonholonomic mobile robot

Exploiting Source Redundancy to Improve the Rate of Polar Codes

SAT based BDD solver for Quantified Boolean Formulas

10.2 The Unit Circle: Cosine and Sine

On Shortest Single/Multiple Path Computation Problems in Fiber-Wireless (FiWi) Access Networks

We have examined power functions like f (x) = x 2. Interchanging x

CHAPTER 3 THE COMMON FACTOR MODEL IN THE POPULATION. From Exploratory Factor Analysis Ledyard R Tucker and Robert C. MacCallum

3 - Vector Spaces Definition vector space linear space u, v,

Reduced Ordered Binary Decision Diagrams

Differentiation 9 examples using the product and quotient rules

1 Introduction. Control 2:

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 2

Section 6: PRISMATIC BEAMS. Beam Theory

Announcements Wednesday, September 06. WeBWorK due today at 11:59pm. The quiz on Friday covers through Section 1.2 (last weeks material)

Non-linear consolidation of soil with vertical and horizontal drainage under time-dependent loading

MAT 1275: Introduction to Mathematical Analysis. Graphs and Simplest Equations for Basic Trigonometric Functions. y=sin( x) Function

EXERCISES Chapter 7: Transcendental Functions. Hyperbolic Function Values and Identities

Logics for Bisimulation and Divergence

Chapter 4: Techniques of Circuit Analysis

NP and NP-Completeness

Note on Mathematical Development of Plate Theories

Scalar multiplication and algebraic direction of a vector

Math 249B. Geometric Bruhat decomposition

A Proof System for Separation Logic with Magic Wand

You don't have to be a mathematician to have a feel for numbers. John Forbes Nash, Jr.

Trichotomy Results on the Complexity of Reasoning with Disjunctive Logic Programs

Geometry review, part I

Lesson 3: Free fall, Vectors, Motion in a plane (sections )

Interpretable Matrix Factorization with Stochasticity Constrained Nonnegative DEDICOM

Hamiltonicity and Fault Tolerance

Basing Decisions on Sentences in Decision Diagrams

Critical Reading of Optimization Methods for Logical Inference [1]

Week 3 September 5-7.

Artificial Neural Networks. Part 2

Network Flow Problems Luis Goddyn, Math 408

Econ 201: Problem Set 3 Answers

Chapter 6. Self-Adjusting Data Structures

Integer Parameter Synthesis for Real-time Systems

Decision tables and decision spaces

1.3 LIMITS AT INFINITY; END BEHAVIOR OF A FUNCTION

10.5 Graphs of the Trigonometric Functions

Patterns of Non-Simple Continued Fractions

2 The Bhaduri-Marglin model

Review Topics for MATH 1400 Elements of Calculus Table of Contents

Support Vector Machines

N-bit Parity Neural Networks with minimum number of threshold neurons

Part 1: Propositional Logic

Reduced Ordered Binary Decision Diagrams

Randomized Smoothing Networks

Sequential Synthesis Using S1S

The optimal pebbling number of the complete m-ary tree

CS 151 Complexity Theory Spring Solution Set 5

arxiv: v1 [math.gt] 2 Nov 2010

CIRCUIT COMPLEXITY AND PROBLEM STRUCTURE IN HAMMING SPACE

5. Biconnected Components of A Graph

reader is comfortable with the meaning of expressions such as # g, f (g) >, and their

Linear Algebra Math 221

HALF-SPACE KINETIC EQUATIONS WITH GENERAL BOUNDARY CONDITIONS. 1. Introduction

Propositional Logic Language

A Unit-Derivation for the Vacuum Field

11.4 Polar Coordinates

Symbolic Model Checking with ROBDDs

A proof of topological completeness for S4 in (0,1)

CALCULATION OF STEAM AND WATER RELATIVE PERMEABILITIES USING FIELD PRODUCTION DATA, WITH LABORATORY VERIFICATION

Logic, Sets, and Proofs

Session R4F Methods to Formulate and to Solve Problems in Mechanical Engineering

Some Classes of Invertible Matrices in GF(2)

FACULTY OF MATHEMATICAL STUDIES MATHEMATICS FOR PART I ENGINEERING. Lectures AB = BA = I,

Why do Golf Balls have Dimples on Their Surfaces?

Mathematics 309 Conic sections and their applicationsn. Chapter 2. Quadric figures. ai,j x i x j + b i x i + c =0. 1. Coordinate changes

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

Transcription:

Boolean Affine Approimation ith Binar Decision Diagrams Kein Henshall Peter Schachte Harald Søndergaard Leigh Whiting Department of Computer Science and Softare Engineering The Uniersit of Melbourne, Vic 3010, Australia keinhenshall@gmailcom schachte@csseunimelbeduau harald@csseunimelbeduau leighhiting@gmailcom Abstract Selman and Kaut s ork on knoledge compilation has established ho approimation (strengthening and/or eakening) of a propositional knoledgebase can be used to speed up quer processing, at the epense of completeness In the classical approach, the knoledge-base is assumed to be presented as a propositional formula in conjunctie normal form (CNF), and Horn functions are used to oerand under-approimate it (in the hope that man queries can be ansered efficientl using the approimations onl) Hoeer, other representations are possible, and functions other than Horn can be used for approimations, as long as the hae deductioncomputational properties similar to those of the Horn functions Zanuttini has suggested that the class of affine Boolean functions ould be especiall useful in knoledge compilation and has presented arious affine approimation algorithms Since CNF is akard for presenting affine functions, Zanuttini considers both a sets-of-models representation and the use of modulo 2 congruence equations Here e consider the use of reduced ordered binar decision diagrams (ROBDDs), a representation hich is more compact than the sets of models and hich (unlike modulo 2 congruences) can epress an source knoledge-base We present an ROBDD algorithm to find strongest affine upper-approimations of a Boolean function and e argue its correctness 1 Introduction A recurrent theme in artificial intelligence is the efficient use of (propositional) knoledge-bases A promising approach, hich as initiall proposed b Selman & Kaut (1996), is to quer (and perform deductions from) upper and loer approimations of the gien knoledge-base B choosing approimations that allo more efficient inference, it is often possible to quickl determine that some logical consequence of the knoledge-base entails the quer, and therefore so does the original knoledge-base, aoiding the costl inference from the original When this fails, it ma be possible to quickl sho that the quer is not entailed b some implicant, and therefore not entailed b the full knoledge-base Onl hen both of these fail must the full knoledge-base be used for inference This approach to deduction is particularl Copright c 2009, Australian Computer Societ, Inc This paper appeared at the Fifteenth Computing: The Australasian Theor Smposium (CATS 2009), Wellington, Ne Zealand Conferences in Research and Practice in Information Technolog, Vol 94 Rod Done and Prabhu Manem, Ed Reproduction for academic, not-for profit purposes permitted proided this tet is included attractie if the knoledge-base is relatiel stable (that is, man queries are handled beteen each time the knoledge-base changes), because in that case, the amortised cost of calculating the approimations is small It is usuall assumed that Boolean functions are represented in clausal form, and that approimations are Horn (Selman & Kaut 1996, del Val 2005) The reason is that inference from Horn knoledge-bases ma be eponentiall more efficient than from unrestricted knoledge-bases Hoeer, it has been noted that there are man other ell-understood classes that hae computational properties that include some of the attractie properties of the Horn class Zanuttini (2002a, 2002b) discusses the use of other classes of Boolean functions for approimation and points out that affine approimations hae certain adantages oer Horn approimations, most notabl the fact that the do not blo out in sie This is certainl the case hen affine functions are represented in the form of modulo-2 congruence equations The more general sets-of-models representation is also considered b Zanuttini In this paper, e consider a third, general, representation, namel reduced ordered binar decision diagrams (ROBDDs) We proe some important properties of affine functions and their ROBDD representation Utilising these properties e design a ne ROBDD algorithm for deriing strongest affine consequences (also knon as affine enelopes) Schachte and Søndergaard (2006, 2007) hae preiousl gien ROBDD algorithms for finding monotone, Krom, and Horn enelopes, but also noticed that hile those algorithms could be epressed as instances of a common scheme, the same scheme did not appl to affine functions A different, less compositional, approach is needed in this case The rest of this paper proceeds as follos In Section 2 e recapitulate the definition of the Boolean affine class, and e establish some of its important properties We also briefl introduce ROBDDs, but mainl to fi our notation, as e assume that the reader is familiar ith Boolean functions and their representation as decision diagrams Section 3 recalls the model-based affine enelope algorithm, and deelops an ROBDD-based algorithm, hose correctness rests on results established in Section 22 Section 4 describes our testing methodolog, including our algorithm for generating random ROBDDs, and presents our results Section 5 discusses related ork and applications, and concludes 2 Propositional Classes, Approimation and ROBDDs We use ROBDDs (Brace, Rudell & Brant 1990, Brant 1986) to represent Boolean functions

Horiama & Ibaraki (2002) hae recommended ROBDDs as suitable for implementing knoledge bases Our choice of ROBDDs as a data structure is due to the fact that it offers a canonical representation for an Boolean function a representation that is highl suitable for inductie reasoning Zanuttini (2002a) suggests using modulo 2 congruence equations to represent affine Boolean functions, and proes a polnomial compleit bound for computing affine enelopes in this representation Hoeer, using a specialised representation has a cost in implementation compleit here affine and non-affine Boolean functions must be used together For eample, the algorithm for ealuating hether one ROBDD entails another is er straightforard, hereas ealuating hether a set of congruence equations entails a Boolean function in some other representation ould be more complicated Similarl, sstems hich repeatedl construct an affine approimation, manipulate it as a general Boolean function, and then approimate the result again, hae much simpler implementations ith a single uniersal representation than ith a specialised affine representation plus a uniersal representation For our purposes, computing enelopes as ROBDDs permits us to use the same representation for approimation to man different Boolean classes Additionall, ROBDD-based inference is fast, and in particular, checking hether a aluation is a model, or finding a model, of an n- place function gien b an ROBDD requires a path traersal of length no more than n 21 Boolean functions Let B = {0,1} and let V be a denumerable set of ariables A aluation µ : V B is a (total) assignment of truth alues to the ariables in V Let I = V B denote the set of V-aluations A partial aluation µ : V B { } assigns truth alues to some ariables in V, and to others Let I p = V B { } We use the notation µ[ i], here V and i B, to denote the aluation µ updated to map to i, that is, { i if = µ[ i]() = µ() otherise A Boolean function oer V is a function ϕ : I B We let B denote the set of all Boolean functions oer V The ordering on B is the usual: iff = 0 = 1 B is ordered pointise, so that the ordering relation corresponds eactl to classical entailment, = It is conenient to oerload the smbols for truth and falsehood Thus e let 1 denote the largest element of B (that is, λµ1) as ell as of B Similarl 0 denotes the smallest element of B (that is, λµ0) as ell as of B A aluation µ is a model for ϕ, denoted µ = ϕ, if ϕ(µ) = 1 We let models(ϕ) denote the set of models of ϕ Conersel, the unique Boolean function that has eactl the set M as models is denoted fn(m) A Boolean function ϕ is said to be independent of a ariable hen for all aluations µ, µ[ 0] = ϕ iff µ[ 1] = ϕ Eistential quantification is defined as follos Let ϕ be a Boolean function and M = models(ϕ), then (ϕ) = fn({µ[ 0] µ M} {µ[ 1] µ M}) and uniersal quantification can be defined duall (e ill not need it here) Clearl (ϕ) is independent of In the contet of an ordered set of n ariables of interest, 1,, n, e ma identif ith µ the binar sequence bits(µ) of length n: µ( 1 ),, µ( n ) hich e ill rite simpl as a bit-string of length n Similarl e ma think of, and rite, the set of aluations M as a set of bit-strings: bits(m) = {bits(µ) µ M} As it could hardl create confusion, e shall present aluations ariousl as functions or bitstrings We denote the ero aluation, hich maps i to 0 for all 1 i n, b 0 We use the Boolean connecties (negation), (conjunction), (disjunction) and + (eclusie or, or or ) These connecties operate on Boolean functions, that is, on elements of B Traditionall the are oerloaded to also operate on truth alues, that is, elements of B Hoeer, e deiate at this point, as the distinction beteen or and its bit-ise analogue ill be critical in hat follos Hence e denote the B (bit) ersion b We etend this to aluations and bit-strings in the natural a: (µ 1 µ 2 )() = µ 1 () µ 2 () and e let 3 denote the or of three operation λµ 1 µ 2 µ 3 µ 1 µ 2 µ 3 We follo Zanuttini (2002a) in further oerloading and using the notation M µ = µ M = {µ µ µ M} We read M µ as M translated b µ Note that for an set M, the function λµm µ is an inolution: (M µ ) µ = M A final oerloading results in the folloing definition For ϕ B, and µ I, let ϕ µ = fn(m µ ) here M = models(ϕ) The distributed ersion of is defined b {ϕ1, ϕ n } = ϕ 1 ϕ n 22 The affine class An affine function is one hose set of models is closed under pointise application of 3 (Schaefer 1978) Affine functions hae a number of attractie properties, as e shall see Sntacticall, a Boolean function is affine iff it can be ritten as a conjunction of affine equations c 1 1 + c 2 2 + + c n n = c 0 here c i {0, 1} for all i {0,, n} 1 This is ell knon, but for completeness e proe it belo, as Proposition 22 The affine class contains 1 and is closed under conjunction Hence the concept of a unique best affine upper-approimation is ell defined, and the function that takes a Boolean function and returns its best affine upper-approimation is an upper closure operator (Ward 1942, Ore 1943) For conenience, let us introduce a name for this operator: Definition 21 Let ϕ be a Boolean function The affine enelope, aff(ϕ), of ϕ is defined: aff(ϕ) = {ψ ϕ = ψ and ψ is affine} 1 In some circles, such as the crptograph/coding communit, the term affine is used onl for a function that is 0 or 1, or can be ritten c 1 1 + c 2 2 + + c n n + c 0 (the latter is hat Post (1941) called an alternating function) The resulting set of affine functions is not closed under conjunction

There are numerous other classes of interest, including isotone, antitone, Krom, Horn, contra-dual Horn, k-horn (Dechter & Pearl 1992), and k-quasi-horn functions, for hich the concept of an enelope is elldefined, as each class is closed under conjunction 2 Zanuttini (2002a) eploits the close connection beteen ector spaces and the sets of models of affine functions A set S B k of bitstrings is a ector space iff 0 S and S is closed under The net proposition suggests ho one can simplif the task of doing model-closure under 3 Proposition 21 (Zanuttini 2002a) Gien a nonempt set of models M and a aluation µ M, M is closed under 3 iff M µ is a ector space Proof: Let µ be an arbitrar element of M Clearl M µ contains 0, so the right-hand side of the claim amounts to M µ being closed under For the if direction, assume M µ is closed under and consider µ 1, µ 2, µ 3 M Since µ µ 2 and µ µ 3 are in M µ, so is µ 2 µ 3 And since furthermore µ µ 1 is in M µ, so is µ µ 1 µ 2 µ 3 Hence µ 1 µ 2 µ 3 is in M For the onl if direction, assume M is closed under 3, and consider µ 1, µ 2 M µ All of µ, µ µ 1 and µ µ 2 are in M, and so µ (µ µ 1 ) (µ µ 2 ) = µ µ 1 µ 2 M Hence µ 1 µ 2 M µ Proposition 22 A Boolean function is affine iff it can be ritten as a conjunction of equations c 1 1 + c 2 2 + + c n n = c 0 here c i {0, 1} for all i {0,, n} Proof: Assume the Boolean function ϕ is gien as a conjunction of equations of the indicated form and let µ 1, µ 2 and µ 3 be models That is, for each equation e hae c 1 µ 1 ( 1 ) + c 2 µ 1 ( 2 ) + + c n µ 1 ( n ) = c 0 c 1 µ 2 ( 1 ) + c 2 µ 2 ( 2 ) + + c n µ 2 ( n ) = c 0 c 1 µ 3 ( 1 ) + c 2 µ 3 ( 2 ) + + c n µ 3 ( n ) = c 0 Adding left-hand sides and adding right-hand sides, making use of the fact that distributes oer +, e get c 1 µ( 1 ) + c 2 µ( 2 ) + + c n µ( n ) = c 0 + c 0 + c 0 = c 0 here µ = µ 1 µ 2 µ 3 As µ thus satisfies each equation, µ is a model of ϕ This establishes the if direction For the onl if part, note that b Proposition 21, e obtain a ector space M µ from an non-empt set M closed under 3 b translating each element of M b µ M No form a basis B for M µ b taking one non- 0 ector at a time from M µ and adding it to the set of basis ectors collected so far iff it is linearl independent of that set Let j = n B (note that 0 j n) B can be etended to a basis for B n b bringing B (read as a B n matri) into echelon form and adding j ectors V = { 1,, j } (these 2 Other classes that are commonl considered in AI are not closed under conjunction and therefore do not hae ell-defined concepts of (unique) enelopes Eamples are the unate functions (a unate function is one that can be turned into an isotone function b sstematic negation of ero or more ariables) and the renamable Horn functions (a renamable Horn function is similarl one that can be turned into a Horn function b sstematic negation of ero or more ariables) For eample, and both are unate, hile is not, so the unate enelope of the latter is not ell-defined can be chosen from the natural basis for B n ) From B and V e can compute a set of j linear equations a 11 1 a 1n n = 0 a 21 1 a 2n n = 0 a j1 1 a jn n = 0 (1) that hae eactl M µ as their set of models For each i {1,,j}, the coefficients a i = (a i1,,a in ) are uniquel determined b the set of n equations a i i = 1 a i k = 0 1 k j, k i a i b = 0 b B This construction guarantees that = ( 1,, n ) satisfies the conjunction of equations (1) iff is in the span of B (that is, in M µ ) Each function is linear, so for ν M µ, f i = λ a i f i (ν µ) = f i (ν) + f i (µ) = f i (µ) Hence M can be described b the set of j affine equations as desired a 11 1 a 1n n = f 1 (µ) a 21 1 a 2n n = f 2 (µ) a j1 1 a jn n = f j (µ) Eample 21 In B 4, the set of models M = {0100, 0111, 1001, 1010} is closed under 3 and so determines an affine function Choosing µ = 0100 as translation, e hae M µ = {0000, 0011, 1101, 1110} One basis for M µ is {0011, 1101}, hich can be etended to a basis for B 4 b adding V = {0100, 0001} Hence M µ can be described b the conjunction a 11 1 a 14 4 = 0 a 21 1 a 24 4 = 0 here the coefficients are determined b soling 0 0 1 1 a 11 0 1 1 0 1 a 12 0 0 1 0 0 a = 13 1 0 0 0 1 a 14 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 1 a 21 a 22 a 23 a 24 = In other ords, M µ is described b 1 2 = 0 1 3 4 = 0 0 0 0 1 In the case of ( 1, 2, 3, 4 ) = µ = (0, 1, 0, 0), the left-hand sides ealuate to 1 and 0, respectiel Hence M is described b 1 2 = 1 1 3 4 = 0

Zanuttini (2002a) shos that the compleit of generating the equational form from an affine function s set of models is O(n 4 ) It follos from the sntactic characterisation that the number of models possessed b an affine function is either 0 or a poer of 2 Other properties ill no be established that are used in the justification of the affine enelope algorithm of Section 3 The first propert is that if a Boolean function ϕ has to models that differ for eactl one ariable, then its affine enelope is independent of To state this precisel e introduce a concept of a characteristic aluation for a ariable Definition 22 In the contet of a set of ariables V, let V The characteristic aluation for, χ, is defined b { 1 if = χ () = 0 otherise Note that µ χ is the aluation hich agrees ith µ for all ariables ecept Moreoer, if µ = ϕ, then both of µ and µ χ are models of (ϕ) Proposition 23 Let ϕ be a Boolean function hose set of models forms a ector space, and assume that for some aluation µ and some ariable, µ and µ χ both satisf ϕ Then ϕ is independent of Proof: The set M of models contains at least to elements, and since it is closed under, χ is a model Hence for eer model ν of ϕ, ν χ is another model It follos that ϕ is independent of Proposition 24 Let ϕ be a Boolean function If, for some aluation µ and some ariable, µ and µ χ both satisf ϕ, then aff(ϕ) = (aff(ϕ)) Proof: Let µ be a model of ϕ, ith µ χ also a model For eer model ν of ϕ, e hae that ν µ (µ χ ) satisfies aff(ϕ), that is, ν χ = aff(ϕ) No since both ν and ν χ satisf aff(ϕ), it follos that (aff(ϕ)) cannot hae a model that is not alread a model of aff(ϕ) (and the conerse holds triiall) Hence aff(ϕ) = (aff(ϕ)) Lemma 25 Let ϕ be a satisfiable Boolean function ith set M of models, and let µ = aff(ϕ) Then there is an odd positie integer k and a subset M of M, such that M = k and µ = M Proof: Define M 0 = M M i = M i 1 {µ 1 µ 2 µ 3 µ 1, µ 2, µ 3 M i 1 } for i > 0 Then {M i } i 0 is an increasing sequence of sets of models, stabilising in a finite number of steps, that is, for some non-negatie j, M i = M j = models(aff(ϕ)) for all i j An induction on i no shos that for all i and all µ M i, µ can be ritten as a sum M of an odd number of models of M 0 = M ( odd plus odd plus odd equals odd ) In particular this holds for µ in M j, that is, for each model of aff(ϕ) Proposition 26 For all Boolean functions ϕ and ariables, aff( (ϕ)) = (aff(ϕ)) Proof: We need to sho that the models of aff( (ϕ)) are eactl the models of (aff(ϕ)) Clearl aff( (ϕ)) is 0 iff ϕ is 0 iff (aff(ϕ)) is 0 So e can assume that aff( (ϕ)) is satisfiable let µ = aff( (ϕ)) B Lemma 25, for some positie odd number k, µ = µ 1 µ 2 µ k ith µ 1,, µ k being different models of (ϕ) These k models can be partitioned into to sets, according to hether the satisf ϕ; let M = {µ i 1 i k, µ i = ϕ} M = {µ i 1 i k, µ i = ϕ} Then both M and M χ consist entirel of models of ϕ Hence, depending on the parit of M s cardinalit, either µ or µ χ is a model of aff(ϕ) (or both are) In either case, µ = (aff(ϕ)) Conersel, let µ = (aff(ϕ)) Then either µ or µ χ is a model of aff(ϕ) (or both are) Hence µ (or µ χ as the case ma be) can be ritten as a sum of k models µ 1,, µ k (k odd) of ϕ It follos that both µ 1 µ 2 µ k and µ 1 µ 2 µ k χ are models of (ϕ) Hence µ = aff( (ϕ)) These propositions are important because the allo an aggressie approach to the elimination of ariables in an affine enelope algorithm It should be noted that both aff and are upper closure operators, but there as no a priori reason to assume that the commute (Ore 1943) Indeed, there are natural classes of Boolean functions for hich enelopes are elldefined, but here approimation into the class does not commute ith eistential quantification As an eample take the class of positie functions A function is positie iff it ealuates to 1 hen all ariables are 1 This class is closed under conjunction, so e can define pos(ϕ) to be the positie enelope of ϕ The reader can no erif that in B 2, for eample, pos( ( )) = pos( ) = 1 = ( ) = (pos( )) Hence approimation and ariable elimination do not commute in this case 23 ROBDDs We briefl recall the essentials of ROBDDs (Brant 1992) Let the set V of propositional ariables be equipped ith a total ordering Binar decision diagrams (BDDs) are defined inductiel as follos: 0 is a BDD 1 is a BDD If V and R 1 and R 2 are BDDs then ite(, R 1, R 2 ) is a BDD Let R = ite(, R 1, R 2 ) We sa a BDD R appears in R iff R = R or R appears in R 1 or R 2 We define ars(r) = { ite(,, ) appears in R} The meaning of a BDD is gien as follos [0] = 0 [1] = 1 [ite(, R 1, R 2 )] = ( [R 1 ]) ( [R 2 ]) A BDD is an Ordered binar decision diagram (OBDD) iff it is 0 or 1 or if it is ite(, R 1, R 2 ), R 1 and R 2 are OBDDs, and ars(r 1 ) ars(r 2 ) :

M = 01011 01100 10111 11001 µ = 01100 M µ = 00111 00000 11011 10101 1 Figure 1: An eample of our diagrammatic representation of an ROBDD Our diagrams leae out the 0 sink and all arcs to it An OBDD R is a Reduced Ordered Binar Decision Diagram (ROBDD (Brant 1986, Brant 1992)) iff for all BDDs R 1 and R 2 appearing in R, R 1 = R 2 hen [R 1 ] = [R 2 ] Practical implementations (Brace et al 1990) use a function mknd(, R 1, R 2 ) to create all ROBDD nodes as follos: 1 If R 1 = R 2, return R 1 instead of a ne node, as [ite(, R 1, R 2 )] = [R 1 ] 2 If an identical ROBDD as preiousl built, return that one instead of a ne one; this is accomplished b keeping a hash table, called the unique table, of all preiousl created nodes 3 Otherise, return ite(, R 1, R 2 ) This ensures that ROBDDs are strongl canonical: a shallo equalit test is sufficient to determine hether to ROBDDs represent the same Boolean function Figure 1 shos an eample of an ROBDD In general e depict the ROBDD ite(, R 1, R 2 ) as a directed acclic graph rooted in, ith a solid arc from to the dag for R 1 and a dashed line from to the dag for R 2 Hoeer, to aoid unnecessar clutter, e omit the 0 node (sink) and all arcs leading to that sink The ROBDD in Figure 1 denotes the function hich has fie models: {00011, 00110, 01001, 01101, 10101} As a tpical eample of an ROBDD algorithm, Algorithm 1 generates the disjunction of to gien ROBDDs We present algorithms in Haskell stle, using pattern matching and guarded equations This operation ill be used b the affine approimation algorithm presented in Section 3 Algorithm 2 is used to etract a model from an ROBDD For an unsatisfiable ROBDD (that is, 0) e return Although presented here in recursie fashion, it is better implemented in an iteratie manner hereb e traerse through the ROBDD, one pointer moing don the else branch at each node, a second pointer trailing immediatel behind If a 1 sink is found, e return the path traersed thus far and note that an further ariables hich e are et to encounter ma be assigned an alue If a 0 sink is found, e use the trailing pointer to step up a leel, follo the then branch for one step and continue searching for a model b folloing else branches This method relies on the fact that ROBDDs are reduced, so that if no 1 sink can be reached from a node, then the node itself is the 0 sink N = 00111 00000 11011 10101 11100 10010 01110 01001 N µ = aff(m) = Figure 2: Steps in Algorithm 3 01011 01100 10111 11001 10000 11110 00010 00101 We shall later use the folloing obious corollar of Proposition 23: Corollar 27 Let ROBDD R represent a function hose set of models form a ector space Then eer path from R s root node to the 1 sink contains the same sequence of ariables, namel ars(r) listed in ariable order 3 Finding Affine Enelopes for ROBDDs Zanuttini (2002a) gies an algorithm, here presented as Algorithm 3, for finding the affine enelope, assuming a Boolean function ϕ is represented as a set of models This algorithm is justified b Proposition 21 Eample 31 To see Algorithm 3 in action, assume that ϕ has four models, M = {01011, 01100, 10111, 11001}, and refer to Figure 2 We randoml pick µ = 01100 and obtain M µ as shon The first round of completion under adds three bit-strings: {11100, 10010, 01110}, and another round adds 01001 to produce N Finall, adding back µ = 01100 ields the affine enelope N µ = aff(m) We are interested in deeloping an algorithm for ROBDDs We can improe on Algorithm 3 and at the same time make it more suitable for ROBDD manipulation The idea is to build the result N step b step, b picking the models ν of M µ one at a time and computing N := N N ν at each step We can start from N = { 0}, as 0 has to be in M µ This leads to Algorithm 4 This formulation is ell suited to ROBDDs, as the operation N ν, that is, taking the or of a model ν ith each model of the ROBDD N can be implemented b traersing N and, for each -node ith ν() = 1, sapping that node s children And e can do better, utilising to obserations First, during its construction, there is no need to traerse the ROBDD N for each indiidual model ν A full traersal of N ill find all its models sstematicall, eliminating a need to remoe them one b one Second, the ROBDD being constructed can be simplified aggressiel during its construction, b utilising Propositions 24 and 26 Namel, as e traerse ROBDD R sstematicall, man paths from

Algorithm 1 The or operator for ROBDDs or(1, ) = 1 or(0, ) = 0 or(, 1) = 1 or(, 0) = 0 or(ite(, T, E), ite(, T, E )) = mknd(, or(t, ite(, T, E )), or(e, ite(, T, E ))) = mknd(, or(ite(, T, E), T ), or(ite(, T, E), E )) otherise = mknd(, or(t, T ), or(e, E )) Algorithm 2 get model algorithm for ROBDDs get model(0) = get model(1) = λ get model(ite(, T, E)) = let µ = get model(t) in if µ = then get model(e)[ 0] else µ[ 1] Algorithm 3 The sets-of-models based affine enelope algorithm Input: The set M of models for function ϕ Output: aff(m) the set of models of ϕ s affine enelope if M = then return M end if N choose µ M Ne M µ repeat N N Ne Ne {µ 1 µ 2 µ 1, µ 2 N} \ N until Ne = return N µ Algorithm 4 A ariant of Algorithm 3 Input: The set M of models for function ϕ Output: aff(m) the set of models of ϕ s affine enelope if M = then return M end if N { 0} choose µ M R M µ \ { 0} for all ν R do N N N ν end for return N µ

the root to the 1 sink ill be found that do not contain eer ariable in ars(r) Each such path corresponds to a model set of cardinalit 2 k, k being the number of skipped ariables Proposition 24 tells us that, eentuall, the affine enelope ill be independent of all such skipped ariables, and Proposition 26 guarantees that ariable elimination can be interspersed arbitraril ith the process of or-ing models, that is, e can eliminate ariables aggressiel This leads to Algorithm 5 The algorithm combines seeral operations in an effort to amortise their cost In hat follos e step through the details of the algorithm The to aff function finds an initial model µ of R, before translating R through the call to translate This initial call to translate has the effect of or-ing µ ith all of the models of R Once translated, the or closure is taken, before translating again using the initial model µ to obtain the affine closure translate is responsible for computing the or of a model ith an ROBDD Its operation relies on the obseration that for a gien node in the ROBDD, if µ() = 1, then the operation is equialent to echanging the then and else branches of or close is used to compute the or-closure of an ROBDD R The third argument passed to tra is an accumulator in hich the result is constructed As in Algorithm 4, e kno that 0 ill be a model of the result, so e initialise the accumulator as (the ROBDD for) { ars(r)} tra implements a recursie traersal of the ROBDD, and hen a model is found in µ, e etend the affine enelope to include the nel found model Namel, etend(r, S, µ) produces (the ROBDD for) R S µ Note that once a model is found during the traersal, tra checks if µ is alread present ithin the or-closure, and if it is not, inokes etend accordingl This simple check aoids making unnecessar calls to etend The cons function represents a special case of mknd It takes an additional argument in µ and uses it to determine hether to restrict aa the corresponding node being constructed The correctness of cons rests on Propositions 24 and 26, hich guarantee that affine approimation can be interspersed ith ariable elimination, so that the latter can be performed aggressiel Finall, once a model is found during a traersal, etend is used to build up the affine closure of the ROBDD In the contet of the initial call etend(s, S, µ), Corollar 27 ensures that the pattern of the last equation for etend is sufficient: If neither argument is a sink, the to ill hae the same root ariable Eample 32 Consider the ROBDD R (shon again in Figure 3(a)), hose set of models is {00011, 00110, 01001, 01101, 10101} Picking µ = 00011 and translating gies R µ, shon in Figure 3(b) This ROBDD represents a set of ectors {00000, 00101, 01010, 01110, 10110} hich is to be etended to a ector space The algorithm no builds up S, the or-closure of R µ, b taking one ector at a time from R µ and etending S to a ector space that includes S begins as the ero ector The first step of the algorithm just adds 00101 to the eisting ero ector (Figure 3(c)) The net step comes across the ector 01X10 (hich actuall represents to aluations) and eistentiall quantifies aa the ariable (Figure 4(a)) Note that the ariable 1 1 (a) (b) (c) Figure 3: (a): The ROBDD R from Figure 1 (b): The translated ersion R µ (c): The ector space S that has been etended to coer 00101 1 1 1 (a) (b) (c) Figure 4: (a): The ector space S after being etended to coer 01X10 (b): S after etending to coer 10110 (c): S translated to gie the affine closure of R also disappears: this is due to the etension required to include 01X10 that adds enough aluations such that is coered b the ector space Etending to coer 10110 simpl requires eer model to be copied, ith mapped to 1 (Figure 4(b)) Finall, translating back b µ produces A, the affine closure of R, shon in Figure 4(c) 4 Eperimental Ealuation To ealuate Algorithms 3 and 5 e generated random Boolean functions using Algorithm 6 We generated random Boolean functions of n ariables, ith an additional parameter to control the densit of the generated function, that is, to set the likelihood of a random aluation being a model For Algorithm 3 e etracted models from the generated ROBDDs, so that both algorithms ere tested on identical Boolean functions The function gen rand bdd(n, pr) builds, in the form of an ROBDD R, a random Boolean function ith the propert that the likelihood of an arbitrar aluation satisfing R is 2 pr It inokes rand bdd(0, n 1, pr) This recursie algorithm builds a ROBDD of (n pr) ariables and at depth (n pr), a random choice is made as to hether to continue generating the random function or to simpl join the 1

Algorithm 5 Affine enelopes for ROBDDs Input: An ROBDD R Output: The affine enelope of R to aff(0) = 0 to aff(r) = let µ = get model(r) in translate(or close(translate(r, µ)), µ) translate(0, ) = 0 translate(1, ) = 1 translate(ite(, T, E), µ) (µ() = 0) = cons(, translate(t, µ), translate(e, µ), µ) (µ() = 1) = cons(, translate(e, µ), translate(t, µ), µ) or close(r) = tra(r, λ, { ars(r)}) tra(0,, S) = S tra(1, µ, S) (µ = S) = S otherise = etend(s, S, µ) tra(ite(, T, E), µ, S) = tra(t, µ[ 1], tra(e, µ[ 0], S)) cons(, T, E, µ) (µ() = ) = or(t, E) otherise = mknd(, T, E) etend(1,, ) = 1 etend(, 1, ) = 1 etend(0, S, µ) = translate(s, µ) etend(ite(, T, E), 0, µ) = cons(, etend(t, 0, µ), etend(e, 0, µ), µ) etend(ite(, T, E), ite(, T, E ), µ) (µ() = 1) = mknd(, etend(t, E, µ), etend(e, T, µ)) otherise = cons(, etend(t, T, µ), etend(e, E, µ), µ) Algorithm 6 Generation of random Boolean functions as ROBDDs Input: The number n of ariables in the random function, pr a calibrator set so that the probabilit of a aluation being a model is 2 pr Output: A random Boolean function represented as an ROBDD gen rand bdd(n, pr) = rand bdd(0, n 1, pr) rand bdd(m, n, pr) (m = n) = mknd(m, rand sink(), rand sink()) otherise = mknd(m, T, E) here T = if (m > n pr) cointoss() then rand bdd(m + 1, n, pr) else 0 E = if (m > n pr) cointoss() then rand bdd(m + 1, n, pr) else 0 rand sink()= if cointoss() then 1 else 0 cointoss() returns 1 or 0 ith equal probabilit

Variables Algorithm 3 Algorithm 5 12 0021 0017 15 5991 0272 18 0407 21 1710 24 14967 Table 1: Aerage time in milliseconds to compute one affine enelope branch ith a 0 sink If the choice is to continue, then the algorithm recursiel applies rand bdd(m + 1, n, pr) to the branch B building a complete ROBDD of (n pr) ariables, e ere able to distribute the number of models for a gien number of ariables In this a, e ere able to compare the arious algorithms for differing model distributions Table 1 shos the aerage time (in milliseconds) taken b each of the algorithms oer 10,000 repetitions ith the probabilit 1/1024 of a aluation being a model Timing data ere collected on a machine running Solaris 9, ith to Intel Xeon CPUs running at 28GH and 4GB of memor Onl one CPU as used and tests ere run under minimal load on the sstem Our implementation of Algorithm 3 uses sorted arras of bitstrings (so that search for models is logarithmic) As the number of models gros eponentiall ith the number of ariables, it is not surprising that memor consumption eceeded aailable space, so e ere unable to collect timing data for more than 15 ariables 5 Conclusion Approimation and the generation of enelopes for Boolean formulas is used etensiel in the quering of knoledge bases Preious research has focused on the use of Horn approimations represented in conjunctie normal form (CNF) In this paper, folloing the suggestion of Zanuttini, e instead focused on the class of affine functions, using an approimation algorithm suggested b Zanuttini (2002a) Our initial implementation using a naie sets-of-models (as arras of bitstrings) representation as disappointing, as een for functions ith er fe models, the affine enelope often has er man models (in fact, the affine enelope of er man functions is 1), so storing sets of models as an arra becomes prohibitie een for functions oer rather fe ariables ROBDDs hae proed to be an appropriate representation for man applications of Boolean functions Functions ith er man models, as ell as er fe, hae compact ROBDD representations Thus e hae deeloped a ne affine enelope algorithm using ROBDDs Our approach is based on the same principle as Zanuttini s, but takes adantage of some useful characteristics of ROBDDs In particular, Propositions 24 and 26 allo us to project aa ariables aggressiel, often significantl reducing the sies of the representations being manipulated earlier than ould happen otherise Further research in this area includes implementing Zanuttini s suggested modulo 2 congruence equations representation and comparing to our ROBDD implementation This also includes ealuating the cost of determining hether a set of congruence equations entail a gien general Boolean function It ould also be interesting to compare affine approimation to approimation to other classes for information loss to ealuate hether affine functions reall are as suitable for knoledge-base approimations as Horn or other functions References Brace, K, Rudell, R & Brant, R (1990), Efficient implementation of a BDD package, in Proc Tent-seenth ACM/IEEE Design Automation Conf, pp 40 45 Brant, R (1986), Graph-based algorithms for Boolean function manipulation, IEEE Trans Computers C 35(8), 677 691 Brant, R (1992), Smbolic Boolean manipulation ith ordered binar-decision diagrams, ACM Computing Sures 24(3), 293 318 Dechter, R & Pearl, J (1992), Structure identification in relational data, Artificial Intelligence 58, 237 270 del Val, A (2005), First order LUB approimations: Characteriation and algorithms, Artificial Intelligence 162, 7 48 Horiama, T & Ibaraki, T (2002), Ordered binar decision diagrams as knoledge-bases, Artificial Intelligence 136, 189 213 Ore, O (1943), Combinations of closure relations, Ann Math 44(3), 514 533 Post, E (1941), The To-Valued Iteratie Sstems of Mathematical Logic, Princeton Uniersit Press Reprinted in M Dais, Solabilit, Proabilit, Definabilit: The Collected Works of Emil L Post, pages 249 374, Birkhaüser, 1994 Schachte, P & Søndergaard, H (2006), Closure operators for ROBDDs, in E A Emerson & K Namjoshi, eds, Proc Seenth Int Conf Verification, Model Checking and Abstract Interpretation, Vol 3855 of Lecture Notes in Computer Science, Springer, pp 1 16 Schachte, P & Søndergaard, H (2007), Boolean approimation reisited, in I Miguel & W Ruml, eds, Abstraction, Reformulation and Approimation: Proc SARA 2007, Vol 4612 of Lecture Notes in Artificial Intelligence, Springer, pp 329 343 Schaefer, T J (1978), The compleit of satisfiabilit problems, in Proc Tenth Ann ACM Smp Theor of Computing, pp 216 226 Selman, B & Kaut, H (1996), Knoledge compilation and theor approimation, Journal of the ACM 43(2), 193 224 Ward, M (1942), The closure operators of a lattice, Ann Math 43(2), 191 196 Zanuttini, B (2002a), Approimating propositional knoledge ith affine formulas, in Proc Fifteenth European Conf Artificial Intelligence (ECAI 02), IOS Press, pp 287 291 Zanuttini, B (2002b), Approimation of relations b propositional formulas: Compleit and semantics, in S Koenig & R Holte, eds, Abstraction, Reformulation and Approimation: Proc SARA 2002, Vol 2371 of Lecture Notes in Artificial Intelligence, Springer, pp 242 255