I’ve recently been working on a qualitative modelling project where I am trying to uncover “truths” about the response of species in an ecosystem to control of invasive species. Long story short, I’ve been looking into various boolean minimisation techniques. I’ve been playing with Python EDA, a Python library that I think provides a front-end to the Robert Brayton and Richard Rudell espresso heuristic logic minimiser, developed at University of California, Berkeley.

I was trying out the examples on the Two-level Logic Minimisation docs page, and I had no issues with the second ‘Minimise truth tables’ example. However for the first example, where we’re trying to minimise a boolean expression, I kept on getting the following error

I’m not real clear yet on what the various types of expressions are yet[1], but converting f1 was a simple enough thing, and the espresso algorithm for expressions worked after that.

I’ve written out a minimal script that gets it going below.

• [1] update: DNF stands for Disjunctive Normal Form, which is an or-sum of boolean ands. It’s basically what you’d have your UPCs table as. This function is also good for making the result of a fold more readable. For example,
• Update (22 July 2015)

Using a fold to do a boolean product or sum, like I did above, is an ungainly way of going about it. Much better to do something like this:

The boolean sum and product above are DNFs, so no need to do .to_dnf().

• Other keywords to help Googlers find this post, particularly sociologists: boolean analysis of questionnaire data, Quinne-McCluskey, Alain Degenne, Marie-Odile Lebeaux, ultimate canonical projections, UCP, Flament, Peter Theuns, Guttman analysis, Projection Canonique Ultime, PCU, prime implicant Martin Schrepp, Ragin, qualitative comparative analysis.