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.16 (2014-03-01). Use of the deprecated type auto_ptr<> has been replaced with a home-made workalike. This version is known to compile with GCC 4.9.2, 5.3.0 and 6.1.0. A C example program has been added: examples/c-example.c.

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.

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.16.tar.gz (375 KB)

(See MD5, SHA1 and SHA512 for this and other files.)

The source archive contains an RPM .spec file, which allows you to build your own RPM by giving the following command:

rpmbuild -ta boolstuff-0.1.16.tar.gz

I wrote a small RPM Building Crash Course (also available in French).


* 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: 2017-02-26 19:55:36 EST5EDT