BOOLEAN FUNCTIONS Theory, Algorithms, and Applications
www.getmyuni.com
BOOLEAN FUNCTIONS Theory, Algorithms, and Applications www.getmyuni.com www.getmyuni.com
Contents
I FOUNDATIONS 13
1 Fundamental concepts and applications 15 1.1 Boolean functions: definitions and examples ...... 16 1.2 Boolean expressions ...... 21 1.3 Duality ...... 27 1.4 Normal forms ...... 29 1.5 Transforming an arbitrary expression into a DNF ...... 34 1.6 Orthogonal DNFs and number of true points ...... 38 1.7 Implicants and prime implicants ...... 41 1.8 Restrictions of functions, essential variables ...... 45 1.9 Geometric interpretation ...... 49 1.10 Monotone Boolean functions ...... 51 1.10.1 Definitions and examples ...... 52 1.10.2 DNFs and prime implicants of positive functions ...... 54 1.10.3 Minimal true points and maximal false points ...... 57 1.11 Recognition of functional and DNF properties ...... 59 1.12 Other representations of Boolean functions ...... 63 1.12.1 Representations over GF(2) ...... 63 1.12.2 Representations over the reals ...... 65 1.12.3 Binary decision diagrams ...... 66 1.13 Applications ...... 68 1.13.1 Propositional logic and artificial intelligence ...... 69 1.13.2 Electrical and computer engineering ...... 72 1.13.3 Game theory ...... 75 1.13.4 Reliability theory ...... 78 1.13.5 Combinatorics ...... 80 1.13.6 Integer programming ...... 82
1 www.getmyuni.com
2 CONTENTS
1.14 Exercises ...... 86
2 Boolean equations 89 2.1 Definitions and applications ...... 89 2.2 The complexity of Boolean equations: Cook’s theorem ...... 95 2.3 On the role of DNF equations ...... 97 2.4 What does it mean to “solve a Boolean equation”? ...... 102 2.5 Branching procedures ...... 104 2.5.1 Branching rules ...... 106 2.5.2 Preprocessing ...... 108 2.6 Variable elimination procedures ...... 112 2.7 The consensus procedure ...... 117 2.8 Mathematical programming approaches ...... 121 2.8.1 Integer linear programming ...... 122 2.8.2 Nonlinear programming ...... 127 2.8.3 Local search heuristics ...... 128 2.9 Recent trends and algorithmic performance ...... 129 2.10 More on the complexity of Boolean equations ...... 131 2.10.1 Complexity of equation solving procedures ...... 131 2.10.2 Random equations ...... 133 2.10.3 Constraint satisfaction problems and Schaefer’s theorem ...... 135 2.11 Generalizations of consistency testing ...... 139 2.11.1 Counting the number of solutions ...... 139 2.11.2 Generating all solutions ...... 139 2.11.3 Parametric solutions ...... 141 2.11.4 Maximum satisfiability ...... 144 2.12 Exercises ...... 150
3 Prime implicants and minimal DNFs 153 Peter L. Hammer and Alexander Kogan 3.1 Prime implicants ...... 154 3.1.1 Applications to propositional logic and artificial intelligence . . . . 154 3.1.2 Short prime implicants ...... 155 3.2 Generation of all prime implicants ...... 158 3.2.1 Generation from the set of true points ...... 159 3.2.2 Generation from a DNF representation: The consensus method . . 161 3.2.3 Generation from a CNF representation ...... 172 www.getmyuni.com
CONTENTS 3
3.3 Logic minimization ...... 173 3.3.1 Quine-McCluskey approach: Logic minimization as set covering . . 175 3.3.2 Local simplifications of DNFs ...... 178 3.3.3 Computational complexity of logic minimization ...... 183 3.3.4 Efficient approximation algorithms for logic minimization ...... 190 3.4 Extremal and typical parameter values ...... 194 3.4.1 Number of prime implicants ...... 194 3.4.2 Extremal parameters of minimal DNFs ...... 196 3.4.3 Typical parameters of Boolean functions and their DNFs ...... 197 3.5 Exercises ...... 200
4 Duality theory 203 Yves Crama and Kazuhisa Makino 4.1 Basic properties and applications ...... 203 4.1.1 Dual functions and expressions ...... 203 4.1.2 Normal forms and implicants of dual functions ...... 205 4.1.3 Dual-comparable functions ...... 207 4.1.4 Applications ...... 211 4.2 Duality properties of positive functions ...... 214 4.2.1 Normal forms and implicants of dual functions ...... 214 4.2.2 Dual-comparable functions ...... 215 4.2.3 Applications ...... 217 4.3 Algorithmic aspects: The general case ...... 221 4.3.1 Definitions and complexity results ...... 221 4.3.2 A simple dualization algorithm ...... 224 4.4 Algorithmic aspects: Positive functions ...... 228 4.4.1 Some complexity results ...... 228 4.4.2 A quasi-polynomial dualization algorithm ...... 231 4.4.3 Additional results ...... 236 4.5 Exercises ...... 237
II SPECIAL CLASSES 241
5 Quadratic functions 243 Bruno Simeone 5.1 Basic definitions and properties ...... 243 5.2 Why are quadratic Boolean functions important? ...... 245 www.getmyuni.com
4 CONTENTS
5.3 Special classes of quadratic functions ...... 248 5.3.1 Classes ...... 248 5.3.2 Functional characterizations ...... 249 5.4 Quadratic Boolean functions and graphs ...... 250 5.4.1 Quadratic functions, graphs, digraphs, and bidirected graphs . . . . 250 5.4.2 The matched graph ...... 251 5.4.3 The implication graph ...... 253 5.4.4 Conflict codes and quadratic graphs ...... 258 5.5 Reducibility of combinatorial problems to quadratic equations ...... 260 5.5.1 Introduction ...... 260 5.5.2 Bipartiteness ...... 262 5.5.3 Balance in signed graphs ...... 262 5.5.4 The K˝onig-Egerv´aryproperty for graphs ...... 263 5.5.5 Recognition of split graphs ...... 265 5.5.6 Forbidden-color graph bipartition ...... 265 5.5.7 Recognition of totally unimodular matrices with two nonzero entries per column ...... 266 5.5.8 Single bend wiring ...... 268 5.5.9 Max-quadratic functions and VLSI design ...... 269 5.5.10 A level graph drawing problem ...... 271 5.5.11 A final look into complexity ...... 275 5.6 Efficient graph-theoretic algorithms for quadratic equations ...... 276 5.6.1 Introduction ...... 276 5.6.2 Labeling algorithm (L) ...... 277 5.6.3 Alternative Labeling algorithm (AL) ...... 281 5.6.4 Switching algorithm (S) ...... 282 5.6.5 Strong components algorithm (SC) ...... 284 5.6.6 An experimental comparison of algorithms for quadratic equations . 286 5.7 Quadratic equations: Special topics ...... 288 5.7.1 Parametric solutions ...... 288 5.7.2 On-line quadratic equations ...... 295 5.8 Prime implicants, transitive closures, and irredundant forms ...... 295 5.8.1 Introduction ...... 295 5.8.2 A transitive closure algorithm for finding all prime implicants . . . 297 5.8.3 A restricted consensus method and its application to computing the transitive closure of a digraph ...... 301 5.8.4 Irredundant normal forms and transitive reductions ...... 310 www.getmyuni.com
CONTENTS 5
5.9 Dualization of quadratic functions ...... 311 5.9.1 Introduction ...... 311 5.9.2 The dualization algorithm ...... 312 5.10 Exercises ...... 315
6 Horn functions 319 Endre Boros 6.1 Basic definitions and properties ...... 319 6.2 Applications of Horn functions ...... 323 6.2.1 Propositional rule bases ...... 323 6.2.2 Functional dependencies in data bases ...... 324 6.2.3 Directed graphs, hypergraphs and petri nets ...... 325 6.2.4 Integer programming and polyhedral combinatorics ...... 326 6.3 False points of Horn functions ...... 328 6.3.1 Deduction in AI ...... 330 6.4 Horn equations ...... 332 6.5 Prime implicants of Horn functions ...... 338 6.6 Properties of the set of prime implicants ...... 343 6.7 Minimization of Horn DNFs ...... 348 6.7.1 Minimizing the number of terms ...... 349 6.7.2 Minimizing the number of literals ...... 352 6.7.3 Minimization of the number of source sides ...... 353 6.8 Dualization of Horn functions ...... 357 6.9 Special classes ...... 361 6.9.1 Submodular functions ...... 361 6.9.2 Bidual Horn functions ...... 362 6.9.3 Double Horn functions ...... 364 6.9.4 Acyclic Horn functions ...... 365 6.10 Generalizations ...... 367 6.10.1 Renamable Horn functions ...... 367 6.10.2 Q-Horn functions ...... 369 6.10.3 Extended Horn expressions ...... 372 6.10.4 Polynomial hierarchies built on Horn expressions ...... 373 6.11 Exercises ...... 375
7 Orthogonal forms and shellability 381 7.1 Computation of orthogonal DNFs ...... 382 www.getmyuni.com
6 CONTENTS
7.2 Shellings and shellability ...... 386 7.2.1 Definition ...... 386 7.2.2 Orthogonalization of shellable DNFs ...... 387 7.2.3 Shellable DNFs vs. shellable functions ...... 391 7.3 Dualization of shellable DNFs ...... 393 7.4 The lexico-exchange property ...... 395 7.4.1 Definition ...... 395 7.4.2 LE property and leaders ...... 396 7.4.3 Recognizing the LE property ...... 397 7.5 Shellable quadratic DNFs and graphs ...... 403 7.6 Applications ...... 405 7.7 Exercises ...... 406
8 Regular functions 409 8.1 Comparative strength of variables ...... 409 8.2 Basic properties ...... 414 8.3 Regularity and left-shifts ...... 422 8.4 Recognition of regular functions ...... 425 8.5 Dualization of regular functions ...... 430 8.6 Regular set–covering problems ...... 438 8.7 Regularization ...... 442 8.7.1 Largest regular minorant with respect to a given order ...... 443 8.7.2 Smallest regular majorant with respect to a given order ...... 448 8.7.3 Regularization and set–covering problems ...... 449 8.8 Higher-order monotonicity ...... 453 8.9 Generalizations of regularity ...... 460 8.9.1 Weakly regular functions ...... 460 8.9.2 Aligned functions ...... 461 8.9.3 Ideal functions ...... 462 8.9.4 Relations among classes ...... 464 8.10 Exercises ...... 465
9 Threshold functions 469 9.1 Introduction ...... 469 9.2 Basic properties of threshold functions ...... 472 9.3 Characterizations of threshold functions ...... 478 9.4 Recognition of threshold functions ...... 483 www.getmyuni.com
CONTENTS 7
9.4.1 A polynomial-time algorithm for positive DNFs ...... 483 9.4.2 A compact formulation ...... 485 9.4.3 The general case ...... 487 9.5 Prime implicants of threshold functions ...... 488 9.6 Chow parameters of threshold functions ...... 494 9.6.1 Chow functions ...... 495 9.6.2 Chow parameters vs. separating structures ...... 497 9.7 Threshold graphs ...... 504 9.8 Exercises ...... 512
10 Read-once functions 515 Martin C. Golumbic and Vladimir Gurvich 10.1 Introduction ...... 515 10.2 The dual subimplicant theorem ...... 518 10.2.1 Implicants and dual implicants ...... 518 10.2.2 The dual subimplicant theorem ...... 519 10.3 Characterizing read-once functions ...... 524 10.4 The properties of P4-free graphs and cographs ...... 533 10.5 Recognizing read-once functions ...... 536 10.6 Learning read-once functions ...... 541 10.7 Related topics and applications of read-once functions ...... 544 10.7.1 The readability of a Boolean function ...... 545 10.7.2 Factoring general Boolean functions ...... 545 10.7.3 Positional games ...... 546 10.8 Exercises ...... 550
11 Characterizations of special classes by functional equations 557 Lisa Hellerstein 11.1 Characterizations of positive functions ...... 557 11.2 Functional equations ...... 558 11.3 Characterizations of particular classes ...... 562 11.3.1 Horn functions ...... 562 11.3.2 Linear functions and related classes ...... 562 11.3.3 Quadratic and degree k functions ...... 564 11.4 Conditions for characterization ...... 566 11.5 Finite characterizations by functional equations ...... 572 11.6 Exercises ...... 578 www.getmyuni.com
8 CONTENTS
III GENERALIZATIONS 581
12 Partially defined Boolean functions 583 Toshihide Ibaraki 12.1 Introduction ...... 583 12.2 Extensions of pdBfs and Their Representations ...... 586 12.2.1 Definitions ...... 586 12.2.2 Support sets of variables ...... 587 12.2.3 Patterns and theories of pdBfs ...... 591 12.2.4 Roles of theories and co-theories ...... 595 12.2.5 Decision trees ...... 599 12.3 Extensions within Given Function Classes ...... 604 12.3.1 Positive functions ...... 604 12.3.2 Monotone (Unate) functions ...... 606 12.3.3 Horn functions ...... 608 12.3.4 Decomposable functions ...... 611 12.3.5 k-DNF functions ...... 618 12.3.6 k-convex functions ...... 618 12.4 Best-Fit Extensions of pdBfs Containing Errors ...... 621 12.5 Extensions of pdBfs with Missing Bits ...... 624 12.5.1 Three types of extensions ...... 624 12.5.2 Complexity results ...... 627 12.6 Minimization with Don’t Cares ...... 630 12.7 Conclusion ...... 633 12.8 Exercises ...... 634
13 Pseudo-Boolean functions 637 13.1 Definitions and examples ...... 637 13.2 Representations ...... 643 13.2.1 Polynomial expressions, arithmetic normal forms and posiforms . . 644 13.2.2 Piecewise linear representations ...... 647 13.2.3 Disjunctive and conjunctive normal forms ...... 647 13.3 Continuous extensions ...... 652 13.3.1 The polynomial extension ...... 653 13.3.2 Concave and convex extensions ...... 653 13.3.3 The Lov´aszextension ...... 656 13.4 Pseudo-Boolean optimization ...... 658 www.getmyuni.com
CONTENTS 9
13.4.1 Local optima ...... 658 13.4.2 An elimination algorithm for global optimization ...... 660 13.4.3 Continuous extensions and other relaxations ...... 661 13.4.4 Posiform transformations and conflict graphs ...... 662 13.5 Approximations ...... 665 13.6 Special classes of pseudo-Boolean functions ...... 666 13.6.1 Quadratic functions and quadratic 0-1 optimization ...... 666 13.6.2 Monotone functions ...... 668 13.6.3 Supermodular and submodular functions ...... 672 13.6.4 Unimodular functions ...... 676 13.6.5 Threshold and unimodal functions ...... 679 13.7 Exercises ...... 680
A Algorithmic complexity 683 A.1 Decision problems ...... 683 A.2 Algorithms ...... 685 A.3 Running time, polynomial-time algorithms and the class P ...... 687 A.4 The class NP ...... 687 A.5 Polynomial-time reductions and NP-completeness ...... 689 A.6 The class coNP ...... 690 A.7 Cook’s theorem ...... 691 A.8 Complexity of list-generation and counting algorithms ...... 693
B Graphs and hypergraphs 697 B.1 Undirected graphs ...... 697 B.1.1 Subgraphs ...... 698 B.1.2 Paths and connectivity ...... 698 B.1.3 Special classes of graphs ...... 699 B.2 Directed graphs ...... 700 B.2.1 Directed paths and connectivity ...... 701 B.2.2 Special classes of digraphs ...... 701 B.2.3 Transitive closure and transitive reduction ...... 702 B.3 Hypergraphs ...... 702
C JBool: a software tool 705 Claude Benzaken and Nadia Brauner C.1 Work Interface ...... 705 C.2 Create a boolean function ...... 708 www.getmyuni.com
10 CONTENTS
C.3 Load/Save a boolean function ...... 710 C.4 Editing a function ...... 711 C.5 Equivalent presentations of a boolean function ...... 712 C.6 Construction operations ...... 713
Bibliography 717 www.getmyuni.com
CONTENTS 11
Notations
B = {0, 1}, U = [0, 1]
n X = (x1, x2, . . . , xn),Y = (y1, y2, . . . , yn),...: components of points in B
x, if α = 1, xα = x, if α = 0.
ek : a unit vector (0,..., 0, 1, 0,..., 0) of appropriate dimension, with 1 in k-th position
X ∨ Y = (x1 ∨ y1, x2 ∨ y2, . . . , xn ∨ yn)
X ∧ Y = (x1 ∧ y1, x2 ∧ y2, . . . , xn ∧ yn) = (x1y1, x2y2, . . . , xnyn)
X = (x1, x2,..., xn)
n X ≤ Y (with X,Y ∈ B ) if and only if xi ≤ yi for i = 1, 2, . . . , n
XA : the characteristic vector of A ⊆ {1, 2, . . . , n}
n supp(X) : the support of X ∈ B , i.e., the set { i ∈ {1, 2, . . . , n} | xi = 1}
n TA,B = {X ∈ B | xi = 1 for all i ∈ A and xj = 0 for all j ∈ B}
f, g, h, . . . : Boolean functions
φ, ψ, θ, . . . : Boolean expressions
n 1l n : the function which takes constant value 1 on B
n 0l n : the function which takes constant value 0 on B
T (f): the set of true points of function f
F (f): the set of false points of function f
minT (f): the set of minimal true points of a positive function f
maxF (f): the set of maximal false points of a positive function f
f d : the dual of function f www.getmyuni.com
12 CONTENTS
|φ| : the (encoding) length of a Boolean expression φ; when φ is a DNF, |φ| is simply the number of literals appearing in φ
|f|: for a positive function f, |f| denotes the size of the complete (prime irredundant) DNF φ of f, i.e., |f| def= |φ|.
||φ|| : the number of terms of a DNF φ
n (ω1, ω2, . . . , ωn, ω) : the Chow parameters of a Boolean function on B
n (π1, π2, . . . , πn, π) : the modified Chow parameters of a Boolean function on B www.getmyuni.com
Part I
FOUNDATIONS
13 www.getmyuni.com www.getmyuni.com
Chapter 1
Fundamental concepts and applications
The purpose of this introductory chapter is threefold. First, the chapter contains the main definitions, terminology and notations to be used throughout the book. After the introduction of our main feature characters – namely, Boolean functions – several sections are devoted to a discussion of alternative representations, or expressions, of Boolean functions. Disjunctive and conjunctive normal forms, in particular, are discussed at length in Sections 1.4–1.11. These special algebraic expressions will play a very central role in our investigations, as we frequently focus on the relation Boolean functions and their normal forms. Section 1.12, however, also provides a short description of different types of function representations, namely representations over GF(2), pseudo-Boolean polynomial expressions, and binary decision diagrams. A second objective of this introduction is to offer a first glance at several of the topics to be investigated in more depth in subsequent chapters, namely: fundamental algorithmic problems (Boolean equations, generation of prime implicants, dualization, orthogonalization, etc.), and special classes of Boolean functions (bounded-degree normal forms, monotone functions, Horn functions, threshold functions, etc.). Finally, the chapter briefly presents a variety of applications of Boolean functions in such diverse fields as logic, electrical engineering, reliability theory, game theory, combinatorics, etc. These applications have often provided the primary motivation for the study of the problems to be encountered in the next chapters. In a sense, this introductory chapter provides a (very) condensed digest of what’s to come. It can be savored as a degustation version of the more consistent menu to be served next, but obviously, its main purpose is to whet the readers’ appetite, so that they
15 www.getmyuni.com
16 CHAPTER 1. FUNDAMENTAL CONCEPTS AND APPLICATIONS
eventually decide to embark for the full course!
1.1 Boolean functions: definitions and examples
This book is about Boolean functions, meaning: {0, 1}-valued functions of a finite number of {0, 1}-valued variables. Definition 1.1. A Boolean function of n variables is a function on Bn into B, where B is the set {0, 1}, n is a positive integer, and Bn denotes the n-fold cartesian product of the ∗ n set B with itself. A point X = (x1, x2, . . . , xn) ∈ B is a true point (resp. false point) of the Boolean function f if f(X∗) = 1 (resp. f(X∗) = 0). We denote by T (f)(resp. F (f)) the set of true points (resp. false points) of f. We denote by 1l n the function which takes n n constant value 1 on B and by 0l n the function which takes constant value 0 on B . It should be stressed that, in many applications, the role of the set B is played by another two-element set, like {Yes, No}, {True, False}, {ON, OFF}, {Success, Failure}, {−1, 1}, or more generally {a, b}, where a and b are abstract (uninterpreted) elements. In most cases, this distinction is completely irrelevant. However, it is often convenient to view the elements of B as numerical quantities, to be able to perform arithmetic operations on these elements and to manipulate algebraic expressions like 1 − x, x + y − xy, etc., where x, y are elements of B. As a historical aside, it is interesting to remark that the ability to perform numerical computations on logical symbols was one of the driving forces behind George Boole’s seminal work in logic theory. Let us quote from Boole [87], Chapter V.6 (italics are Boole’s):
[...] any system of propositions may be expressed by equations involving sym- bols x, y, z, which, whenever interpretation is possible, are subject to laws identical in form with the laws of a system of quantitative symbols, suscep- tible only of the values 0 and 1. But as the formal processes of reasoning depend only upon the laws of the symbols, and not upon the nature of their interpretation, we are permitted to treat the above symbols, x, y, z, as if they were quantitative symbols of the kind above described. We may in fact lay aside the logical interpretation of the symbols in the given equation; convert them into quantitative symbols, susceptible only of the values 0 and 1; perform upon them as such all the requisite processes of solution; and finally restore to them their logical interpretation. And this is the mode of procedure which will actually be adopted [...] www.getmyuni.com
1.1. BOOLEAN FUNCTIONS: DEFINITIONS AND EXAMPLES 17
(x1, x2, x3) f(x1, x2, x3) (0, 0, 0) 1 (0, 0, 1) 1 (0, 1, 0) 0 (0, 1, 1) 1 (1, 0, 0) 0 (1, 0, 1) 1 (1, 1, 0) 0 (1, 1, 1) 1
Table 1.1: Truth table for Example 1.1
In this book, we will systematically follow Boole’s prescription and adhere to the convention that B = {0, 1}, where 0 and 1 can be viewed either as abstract symbols or as numerical quantities.
Example 1.1. The most elementary way to define a Boolean function f is to provide its truth table, i.e., to give a complete list of all the points in Bn together with the value of the function in each point. For example, the truth table of a Boolean function on B3 is given in Table 1.1.
Of course, the use of truth tables becomes extremely cumbersome when the function to be defined depends on more than, say, 5 or 6 arguments. As a matter of fact, Boolean functions are often defined implicitly rather than explicitly, in the sense that they are described through a procedure which, for any 0 − 1 point in the domain of interest, allows to compute the value of the function in this point. In some theoretical developments, or when we analyze the computational complexity of certain problems, such a procedure can simply be viewed as a black box oracle, of which we can observe the output (i.e., the function value) for any given input, but not the inner working (i.e., the details of the algorithm that computes the output). In most applications, however, more information is available regarding the process which generates the function of interest, as illustrated by the examples below. (We shall come back to these applications in much greater detail in Section 1.13 and in most chapters of the book.)
Application 1.1. (Logic.) In many applications (such as those arising in artificial intelligence), a Boolean function can be viewed as indicating the truth value of a sentence of propositional (or Boolean) logic. Consider for instance the sentence S: “if it rains in www.getmyuni.com
18 CHAPTER 1. FUNDAMENTAL CONCEPTS AND APPLICATIONS
the morning, or if the sky is cloudy, then I carry my umbrella”. Let us denote by x1, x2 and x3, respectively, the subsentences “it rains in the morning”, “the sky is cloudy” and “I carry my umbrella”. Then, S can be identified with the sentence
x1 OR x2 ⇒ x3.
It is easy to see that the function displayed in Table 1.1 computes the truth value of S for all possible values of x1, x2, x3, under the usual correspondence T rue ↔ 1, F alse ↔ 0.
Application 1.2. (Electrical engineering.) In electrical or in computer engineering, a switching circuit is often abstracted into the following model, called a combinational circuit. The wiring of the circuit is described by an acyclic directed graph D = (V,A). The vertices of D are the gates of the circuit. The indegree of each gate is at most 2. Each gate with indegree 2 is labeled either AND or OR and each gate with indegree 1 is labelled NOT. The gates with indegree 0 are called input gates and are denoted v1, v2, . . . , vn. Also, all gates of D have outdegree 1 except for a single gate f, called output gate, which has outdegree 0. Every such circuit can be viewed as representing a Boolean function fD(x1, x2, . . . , xn). n First, for every (x1, x2, . . . , xn) ∈ B , the state s(v) of gate v ∈ V is computed according to the following recursive rules: 1. for each input gate vi, s(vi) = xi (i = 1, 2, . . . , n); 2. for each AND-gate v ∈ V , if (u, v), (w, v) ∈ A are the arcs entering v, then s(v) = min(s(u), s(w)); 3. for each OR-gate v ∈ V , if (u, v), (w, v) ∈ A are the arcs entering v, then s(v) = max(s(u), s(w)); 4. for each NOT-gate v ∈ V , if (u, v) ∈ A is the arc entering v, then s(v) = 1 − s(u). Finally, we let fD(x1, x2, . . . , xn) = s(f). For instance, the circuit represented in Figure 1.1 computes the function given in Example 1.1. This can easily be verified by computing the state of the output gate (in this case, the OR-gate) for all possible 0–1 inputs. E.g., if (x1, x2, x3) = (0, 0, 0), then one successively finds that the state of each NOT-gate is 1 (= 1 − 0), the state of the AND-gate is 1 (= min(1, 1)), and the state of the output gate is 1 (= max(1, 0)). More generally, the gates of a combinational circuit may be “primitive” Boolean func- tions forming another class than the {AND,OR,NOT} collection used in our small ex- ample. In all cases, the gates may be viewed as atomic units of hardware providing the building blocks for the construction of larger circuits. www.getmyuni.com
1.1. BOOLEAN FUNCTIONS: DEFINITIONS AND EXAMPLES 19
- #v1 #NOT HH HHj #AND H "! "!¨* H ¨ HH - ¨¨ H #v2 #NOT HHj "! #OR ¨¨* ¨ "! "! ¨¨ ¨ "! #v3 ¨
"! Figure 1.1: A small combinational circuit
Historically, propositional logic and electrical engineering have been the main nurtur- ing fields for the development of research on Boolean functions. However, because they are such fundamental mathematical objects, Boolean functions have also been used to model a large number of applications arising in a variety of areas. In order to describe these applications, we introduce a few more notations. Given a subset of indices A ⊆ {1, 2, . . . , n}, let us denote by XA the characteristic vector of A, i.e., the point of Bn whose jth coordinate is 1 if and only if j ∈ A: 1 if j ∈ A, xA = j 0 if j ∈ {1, 2, . . . , n}\ A.
Conversely, given a point X ∈ Bn, we denote by supp(X) the support of X, i.e., the set { i ∈ {1, 2, . . . , n} | xi = 1} (note that X is the characteristic vector of supp(X)). Application 1.3. (Game theory.) Many group decision procedures (such as those used in legislative assemblies or in corporate stockholder meetings) can be viewed, in abstract terms, as decision rules which associate a single dichotomous “Yes–No” outcome (e.g., adoption or rejection of a resolution) to a collection of dichotomous “Yes–No” votes (e.g., assent or disagreement of individual lawmakers). Such procedures have been studied in the game-theoretic literature under the name of simple games or voting games. More formally, let N = {1, 2, . . . , n} be a finite set, the elements of which are to be called players. A simple game on N is a function v : {A | A ⊆ N} → B. Clearly, from our vantage point, a simple game can be equivalently modeled as a Boolean function fv on n B : the variables of fv are in 1-to-1 correspondence with the players of the game (variable www.getmyuni.com
20 CHAPTER 1. FUNDAMENTAL CONCEPTS AND APPLICATIONS
i takes value 1 exactly when player i votes “Yes”) and the value of the function reflects the outcome of the vote for each point X∗ ∈ Bn describing a vector of individual votes: 1 if v(supp(X∗)) = 1, f (X∗) = v 0 otherwise.
Application 1.4. (Reliability theory.) Reliability theory investigates the relationship between the operating state of a complex system S and the operating state of its individual components, say components 1, 2, . . . , n. It is commonly assumed that the system and its components can be in either of two states: operative or failed. Moreover, the state of the system is completely determined by the state of its components, via a deterministic rule n embodied in a Boolean function fS on B called the structure function of the system: for each X∗ ∈ Bn, 1 if the system operates when all components in supp(X∗) operate ∗ fS(X ) = and all other components fail, 0 otherwise.
A central issue is to compute the probability that the system operates (i.e., that fS takes value 1) when each component is subject to probabilistic failure. Thus, reliability theory deals primarily with the stochastic theory of Boolean functions.
Application 1.5. (Combinatorics.) Consider a hypergraph H = (N, E), where N = {1, 2, . . . , n} is the set of vertices of H and E is a collection of subsets of N, called edges of the hypergraph. A subset of vertices is said to be stable if it does not contain any edge of ∗ n H. With H, we associate the Boolean function fH defined as follows: for each X ∈ B , 1 if supp(X∗) is not stable, f (X∗) = H 0 otherwise.
The function fH is the stability function of H.
Of course, the kinship between the models presented in Applications 1.3–1.5 is strik- ing: it is immediately apparent that we are really dealing here with a single class of mathematical objects, in spite of the distinct motivations which originally justified their investigation. www.getmyuni.com
1.2. BOOLEAN EXPRESSIONS 21
Applications of Boolean functions will be discussed more thoroughly in Section 1.13, after we have introduced some of the fundamental theoretical concepts which underlie them. Before we close this section, let us add that in this book, our view of Boolean functions will be mostly combinatorial and algorithmic. For algebraic or logic-oriented treatments, we refer the reader to the excellent books by Rudeanu [684, 685] or Brown [131]. In these books, as in many related classical publications by other authors, Boolean functions are actually defined more broadly than in Definition 1.1, as (special) mappings of the form f : An → A, where A is the carrier of an arbitrary Boolean algebra (A, ∪, ∩, ¬, 0, 1). By contrast, we shall essentially restrict ourselves in this book to the two-element Boolean algebra (B, ∨, ∧, · , 0, 1) where B = {0, 1} (see Section 1.2). Brown [131], in particular, discusses in great detail the pros and cons of working with two-element, rather than more general, Boolean algebras. While acknowledging the relevance of his arguments, we feel that, at the risk of giving up some generality, our restricted framework is already sufficiently rich to model a variety of interesting applications and to allow us to handle a host of challenging algorithmic problems of a combinatorial nature. Also, the terminology introduced in Definition 1.1 has become sufficiently entrenched as to justify continuing its use, rather than the alternative terminology switching functions or truth functions which, though less prone to creating confusions with more general Boolean functions, has progressively become obsolete.
1.2 Boolean expressions
As illustrated by the above examples, Boolean functions can be described in many al- ternative ways. In this section, we concentrate on a type of representation derived from propositional logic, namely, the representation of Boolean functions by Boolean expres- sions (see e.g. [131, 586, 684, 729] for different presentations). Boolean expressions will be used extensively throughout the book. As a matter of fact, the emphasis on Boolean expressions (rather than truth tables, circuits, oracles, ...) can be seen as a main distinguishing feature of our approach and will motivate many of the issues to be tackled in subsequent chapters. Our definition of Boolean expressions will be recursive, starting with three elementary operations as building blocks.
Definition 1.2. The binary operation ∨ (disjunction, Boolean OR), the binary operation ∧ (conjunction, Boolean AND), and the unary operation · (complementation, negation, www.getmyuni.com
22 CHAPTER 1. FUNDAMENTAL CONCEPTS AND APPLICATIONS
Boolean NOT) are defined on B by the following rules:
0 ∨ 0 = 0, 0 ∨ 1 = 1, 1 ∨ 0 = 1, 1 ∨ 1 = 1;
0 ∧ 0 = 0, 0 ∧ 1 = 0, 1 ∧ 0 = 0, 1 ∧ 1 = 1; 0 = 1, 1 = 0.
For a Boolean variable x, we sometimes use the following convenient notation:
x, if α = 1, xα = x, if α = 0.
Keeping in line with our focus on functions, we often regard the three elementary Boolean operations as defining Boolean functions on B2: disj(x, y) = x ∨ y, conj(x, y) = x ∧ y, and on B: neg(x) = x. When the elements of B = {0, 1} are interpreted as inte- gers rather than abstract symbols, these operations can be defined by simple arithmetic expressions: for all x, y ∈ B,
x ∨ y = max{x, y} = x + y − x y,
x ∧ y = min{x, y} = x y, x = 1 − x. Observe that the conjunction of two elements of B is equal to their arithmetic product. By analogy with the usual convention for products, we often omit the operator ∧ and we denote conjunction by mere juxtaposition. We can extend the definitions of all three elementary operators to Bn by writing, for all X,Y ∈ Bn, X ∨ Y = (x1 ∨ y1, x2 ∨ y2, . . . , xn ∨ yn),
X ∧ Y = (x1 ∧ y1, x2 ∧ y2, . . . , xn ∧ yn) = (x1y1, x2y2, . . . , xnyn),
X = (x1, x2,..., xn). Let us enumerate some of the elementary properties of disjunction, conjunction and complementation. (We note for completeness that the properties listed in Theorem 1.1 can be viewed as the defining properties of a general Boolean algebra.)
Theorem 1.1. For all x, y, z ∈ B, the following identities hold:
(1) x ∨ 1 = 1 and x ∧ 0 = 0; www.getmyuni.com
1.2. BOOLEAN EXPRESSIONS 23
(2) x ∨ 0 = x and x ∧ 1 = x;
(3) x ∨ y = y ∨ x and x y = y x (Commutativity);
(4) (x ∨ y) ∨ z = x ∨ (y ∨ z) and x (y z) = (x y) z (Associativity);
(5) x ∨ x = x and x x = x (Idempotency);
(6) x ∨ (x y) = x and x (x ∨ y) = x (Absorption);
(7) x ∨ (y z) = (x ∨ y)(x ∨ z) and x (y ∨ z) = (x y) ∨ (x z) (Distributivity);
(8) x ∨ x = 1 and x x = 0;
(9) x = x (Involution);
(10) (x ∨ y) = x y and (x y) = x ∨ y (De Morgan’s laws);
(11) x ∨ (x y) = x ∨ y and x (x ∨ y) = x y (Boolean absorption).
Proof. These identities are easily verified, e.g. by exhausting all possible values for x, y, z.
Building upon Definition 1.2, we are now in a position to introduce the important notion of Boolean expression.
Definition 1.3. Given a finite collection of Boolean variables x1, x2, . . . , xn, a Boolean expression (or Boolean formula) in the variables x1, x2, . . . , xn is defined as follows:
(1) the constants 0, 1, and the variables x1, x2, . . . , xn are Boolean expressions in x1, x2,..., xn;
(2) if φ and ψ are Boolean expressions in x1, x2, . . . , xn, then (φ ∨ ψ), (φ ψ) and φ are Boolean expressions in x1, x2, . . . , xn; (3) every Boolean expression is formed by finitely many applications of the rules (1)-(2).
We also say that a Boolean expression in the variables x1, x2, . . . , xn is a Boolean expres- sion on Bn.
We use notations like φ(x1, x2, . . . , xn) or ψ(x1, x2, . . . , xn) to denote Boolean expres- sions in the variables x1, x2, . . . , xn. www.getmyuni.com
24 CHAPTER 1. FUNDAMENTAL CONCEPTS AND APPLICATIONS
Example 1.2. Here are some examples of Boolean expressions: φ1(x) = x, φ2(x) = x, ψ1(x, y, z) = (((x ∨ y)(y ∨ z)) ∨ ((xy)z)), ψ2(x1, x2, x3, x4) = ((x1x2) ∨ (x3x4)).
Now, since disjunction, conjunction, and complementation can be interpreted as Boolean functions, every Boolean expression φ(x1, x2, . . . , xn) can also be viewed as generating a Boolean function defined by composition.
Definition 1.4. The Boolean function fφ represented (or expressed) by a Boolean expres- n sion φ(x1, x2, . . . , xn) is the unique Boolean function on B defined as follows: for every ∗ ∗ ∗ n ∗ ∗ ∗ ∗ point (x1, x2, . . . , xn) ∈ B , the value of fφ(x1, x2, . . . , xn) is obtained by substituting xi for xi (i = 1, 2, . . . , n) in the expression φ and by recursively applying Definition 1.2 to compute the value of the resulting expression. n When f = fφ on B , we also say that f admits the representation or the expression φ, and we simply write f = φ.
Example 1.3. Consider again the expressions defined in Example 1.2. We can compute for instance:
fφ1 (0) = 0, fφ1 (1) = 1,
fφ2 (0) = 0 = 1, fφ2 (1) = 1 = 0,
fψ1 (0, 0, 0) = (((0 ∨ 0)(0 ∨ 0)) ∨ ((00)0)) = 1,...
In fact, the expression ψ1 in Example 1.2 represents the function f, where:
f(0, 0, 1) = f(1, 0, 0) = f(1, 0, 1) = 0,
f(0, 0, 0) = f(0, 1, 0) = f(0, 1, 1) = f(1, 1, 0) = f(1, 1, 1) = 1. Thus, we can write
f(x, y, z) = ψ1(x, y, z) = (((x ∨ y)(y ∨ z)) ∨ ((xy)z)).
Remark. In order to get rid of parentheses when writing Boolean expressions, we assume from now on a priority ranking of the elementary operations: namely, we assume that www.getmyuni.com
1.2. BOOLEAN EXPRESSIONS 25
disjunction has lower priority than conjunction, which has lower priority than comple- mentation. When we compute the value of a parenthesis-free expression, we always start with the operations of highest priority: first all complementations, next all conjunctions, finally all disjunctions. (This is similar to the convention which assigns lower priority to addition than to multiplication, and to multiplication than to exponentiation when evalu- ating an arithmetic expression like 3x2 + 5xy.) Moreover, we also discard any parentheses that become redundant as a consequence of the associativity property of disjunction and conjunction (Theorem 1.1).
Example 1.4. The expression ψ1 in Example 1.2 (and hence, the function f in Example 1.3) can be rewritten with fewer parentheses as f(x, y, z) = ψ1(x, y, z) = (x∨y)(y∨z)∨xyz. Similarly, the expression ψ2 in Example 1.2 can be rewritten as ψ2(x1, x2, x3, x4) = x1x2 ∨ x3x4.
The relation between Boolean expressions and Boolean functions, as spelled out in Definition 1.4, deserves to be carefully pondered. On one hand, it is important to understand that every Boolean function can be rep- resented by numerous Boolean expressions (see e.g. Theorem 1.4 in the next section). In fact, it is easy to see that there are “only” 22n Boolean functions of n variables, while there are infinitely many Boolean expressions in n variables. These remarks motivate the distinction that we draw between functions and expressions. On the other hand, since every Boolean expression φ represents a unique Boolean function fφ, we are justified in interpreting φ itself as a function, and we will frequently do so. The notation f = φ introduced in Definition 1.4, in particular, may seem confusing at first sight, since it equates a function with a formal expression; but this notational convention is actually innocuous: it is akin to the convention for real-valued functions of real variables, where it is usual to assimilate a function with its analytical expression and to write, for instance, equalities like
f(x, y) = x2 + 2xy + y2 = (x + y)2. (1.1)
As a matter of fact, since Definition 1.4 implies that we write both f = ψ and f = φ when ψ and φ represent the same function f (compare with Equation (1.1)), it also naturally leads to the next notion.
Definition 1.5. We say that two Boolean expressions ψ and φ are equivalent if they represent the same Boolean function. When this is the case, we write ψ = φ. www.getmyuni.com
26 CHAPTER 1. FUNDAMENTAL CONCEPTS AND APPLICATIONS
Observe, in particular, that any two expressions which can be deduced from each other by repeated use of the properties listed in Theorem 1.1 are equivalentn even though they are not identical.
Example 1.5. The function f(x, y, z) represented by ψ1(x, y, z) = (x ∨ y)(y ∨ z) ∨ xyz (see previous examples) is also represented by the expression φ = x z ∨ y. Indeed, (x ∨ y)(y ∨ z) ∨ xyz = (xy ∨ x z ∨ yy ∨ yz) ∨ xyz (distributivity) = xy ∨ x z ∨ y ∨ yz ∨ xyz (idempotency and associativity) = x z ∨ y (absorption).
Thus, ψ1(x, y, z) and φ(x, y, z) are equivalent, i.e., ψ1(x, y, z) = φ(x, y, z).
A recurrent theme in Boolean theory concerns the transformation of Boolean expres- sions into equivalent expressions which display specific desirable properties. For instance, in the previous example, the expression φ is intuitively much “simpler” or “shorter” than ψ1, in spite of the fact that these two expressions represent the same function. More generally, for algorithmic purposes, it is necessary to have a definition of the length of a Boolean expression. Definition 1.6. The length of a Boolean expression φ is the number of symbols used in an encoding of φ as a binary string. The length of φ is denoted by |φ|. We refer to standard books on computational complexity for additional comments re- garding this concept (see e.g. [320, 624]). For most practical purposes, we can conveniently think of |φ| as the total number of symbols (constants, variables, operators, parentheses) occuring in the expression φ. Finally, to conclude this important section on Boolean expressions, let us note that complex Boolean functions can be introduced by substituting functional symbols for the variables of a Boolean expression. That is, if ψ(y1, y2, . . . , ym) is a Boolean expression m n on B , and f1, f2, . . . , fm are m Boolean functions on B , then the Boolean function ∗ n ψ(f1, f2, . . . , fm) can be defined in the natural way: namely, for all X ∈ B ,