Official URL:

By Pierre Sarrazin*

BoolStuff is a C++ library that supports a few operations on boolean expression binary trees. The main features are:

A command named booldnf that calls this library to convert an expression to the DNF is also provided.

The current version is 0.1.17 (2021-10-06). The C++ exception specifications have been removed from function declarations. The [[fallthrough]] attribute is now used in switch statements when available. The docdir definition has been removed from top-level files. The COPYING file is not installed by "make install" anymore.

BoolStuff is free software distributed under the GNU General Public License. Please note that this means proprietary software linked with this library cannot be distributed legally.

I can be contacted (in French or English) at sarrazip at sarrazip dot com.


Screen shot

[boolstuff screen shot - PNG 16k]

Manual pages

There are manual pages for the boolstuff(3) library and for the booldnf(1) command.

Disjunctive Normal Form

The definition of the DNF seems to vary. Dr. Math says that the DNF requires every variable or its complement [to be] represented in every term. However, MathWorld does not obey this requirement, judging from the examples given. My library does not obey it either.

For example, the expression a&(b|c) will be converted to a&b|a&c. There is no c in the first term and no b in the second one.


The source archive contains a short example and two test programs. They can be studied to learn how to use the library.

Programs using BoolStuff

The 2014 article titled Steady state analysis of Boolean molecular network models via model reduction and computational algebra mentions that the software used in the analysis done by the authors made use of BoolStuff.

Conversion CSG-BRep de scènes définies par des quadriques: 2010 Ph.D. thesis by Maria Pentcheva.

The article titled Privacy Preserving Delegated Access Control in Public Clouds also mentions underlying software that uses BoolStuff.

Halevt (HAL events manager) is a "daemon that executes arbitrary commands when a device with certain properties is added to the system and when device properties change." This program is distributed under the GNU GPL.


The library also comes with a C application programming interface. However, it still requires the program to link with libstdc++, the GNU Standard C++ library.

gcc must be used to compile the C source files, but g++ must be used to link the application. One hack to force Automake to do this is something like the following:

myapp_SOURCES = foo.c bar.c baz.c
nodist_myapp_SOURCES = dummy.cpp
# This forces Automake to use g++ to link the application.
# nodist means that Automake must not include this file
# in the distributed source tarball.

        echo 'static void dummy();' > $@
# We generate the dummy C++ source file so we don't have
# to think about it.

CLEANFILES = dummy.cpp
# This tells the 'clean' target to erase the generated file.

Of course, the _CFLAGS and _LDADD variables must also be set to refer to BoolStuff.


Source archive: boolstuff-0.1.17.tar.gz

See SHA512 signatures for this and other files.)

A Debian package may be available here.


* The image is not of me, but of George Boole (1815-1864), an English mathematician who helped establish modern symbolic logic and whose algebra of logic, now called Boolean algebra, is basic to the design of digital computer circuits. The image is taken from Wikipedia and is in the public domain according to that site.

Valid HTML 4.01!

Last update to this page: 2021-10-06 22:30:44 EST5EDT