# Boolean function minimization / reduction

**URL:** <https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463>\
**Category:** General Usage\
**Created:** [March 24, 2020, 7:50pm UTC](https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463 "2020-03-24T19:50:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [March 24, 2020, 7:50pm UTC](https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463/1 "2020-03-24T19:50:57Z")

</div>

Hi All,

I am working on explanation of neural networks for computer security. Specifically, I would like to combine several alternative explanations together in one logical formula. I would like to ask, if anyone has experience with methods for reduction of boolean expressions. I have found these two algorithms

> **[Quine–McCluskey algorithm](https://en.wikipedia.org/wiki/Quine%E2%80%93McCluskey_algorithm)**
>
> The Quine–McCluskey algorithm (QMC), also known as the method of prime implicants, is a method used for minimization of Boolean functions that was developed by Willard V. Quine in 1952 and extended by Edward J. McCluskey in 1956. As a general principle this approach had already been demonstrated by the logician Hugh McColl in 1878, was proved by Archie Blake in 1937, and was rediscovered by Edward W. Samson and Burton E. Mills in 1954 and by Raymond J. Nelson The Quine–McCluskey algorithm is ...

and

> **[Espresso heuristic logic minimizer](https://en.wikipedia.org/wiki/Espresso_heuristic_logic_minimizer)**
>
> The ESPRESSO logic minimizer is a computer program using heuristic and specific algorithms for efficiently reducing the complexity of digital logic gate circuits. ESPRESSO-I was originally developed at IBM by Robert K. Brayton et al. in 1982. and improved as ESPRESSO-II in 1984. Richard L. Rudell later published the variant ESPRESSO-MV in 1986 and ESPRESSO-EXACT in 1987. Espresso has inspired many derivatives.
> Electronic devices are composed of numerous blocks of digital circuits, the combinat...

but I have not find any easy implementation in Julia. I do not know, as this topic is still of an interest, as these two methods solves problems in design of circuits.

I will appreciate and suggestions and links to resource (papers and other methods).

Thanks a lot,  
Tomas

---

<div class="post-metadata">

**Author:** ![CBX001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cbx001/32/26956_2.png) [@CBX001](https://discourse.julialang.org/u/CBX001)\
**Post date:** [January 22, 2022, 5:06pm UTC](https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463/2 "2022-01-22T17:06:39Z")

</div>

You could start with the following Python functions using PyCall:

1. Sympy: [Logic - SymPy 1.11 documentation](https://docs.sympy.org/latest/modules/logic.html)
2. PyEDA: [Two-level Logic Minimization — Python EDA Documentation](https://pyeda.readthedocs.io/en/latest/2llm.html)

---

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [January 22, 2022, 5:59pm UTC](https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463/3 "2022-01-22T17:59:30Z")

</div>

Great, thanks a lot. I have already tried sympy through webapi, but it has failed. I am curious to try espresso through PyEDA. Thanks a lot for pointing me to this. I am impressed that almost after two years, the question got answered.

---

<div class="post-metadata">

**Author:** ![CBX001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cbx001/32/26956_2.png) [@CBX001](https://discourse.julialang.org/u/CBX001)\
**Post date:** [January 23, 2022, 3:20pm UTC](https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463/4 "2022-01-23T15:20:43Z")

</div>

By chance, I was trying to get Sympy or PyEDA working on Windows 10. Managed to get Sympy’s SOPform example working after a little effort. But, struggling to pip install PyEDA in the Python environment on Windows 10, which apparently is not so straightforward as on Macs.

---

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [January 23, 2022, 4:53pm UTC](https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463/5 "2022-01-23T16:53:20Z")

</div>

Thanks for sharing,

I am the mac and linux.

Tomas
