Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the distribution rule not applied? #101

Open
HA6Bots opened this issue Jan 7, 2021 · 3 comments
Open

Is the distribution rule not applied? #101

HA6Bots opened this issue Jan 7, 2021 · 3 comments

Comments

@HA6Bots
Copy link

HA6Bots commented Jan 7, 2021

Thanks for the amazing library. However I had a query in regards to the simplification of the following expression:
(a and not (b and c)) or (a and (b and c))
The expected output would be:
a
Looking through the code during the simplification process the distributive function doesn't appear to be called.

@pombredanne
Copy link
Collaborator

@HA6Bots Thanks! Would you care for a PR or for some pointers where you think this would be applied?

@HA6Bots
Copy link
Author

HA6Bots commented Jan 8, 2021

Hi @pombredanne.

To be honest I'm not entirely sure where it should be applied because on its own the distribution law not would be enough to simplify the above expression.

See the screenshot below from this online boolean expression simplifier
Capture

Their expression simplifier uses the distribution law, and then it's inverse, to manipulate the expression into a format where the absorption law can be used - allowing for the minimisation to continue till it gets the final result of a.

I attempted to recreate this library in C++ but I ran into the same roadblock as boolean.py (in terms of full minimisation). I've yet to find an open source boolean expression simplifier that fully minimises an expression fully. I wonder how they manage to achieve this on the website? Maybe via brute forcing different combinations of rules? Seems unlikely. I would love to figure this out though. It would be great to have an full open source boolean expression simplifier.

@pombredanne
Copy link
Collaborator

@HA6Bots a true boolean minimizer may not be possible ... or can take a lot of time!
See https://en.wikipedia.org/wiki/Logic_optimization#Circuit_minimization_in_Boolean_algebra and https://en.wikipedia.org/wiki/Quine–McCluskey_algorithm#Complexity for a discussion
For an Expresso implementation see @cjdrake https://github.com/cjdrake/pyeda for instance
For a Quine-McCluskey implementation see @prekageo https://github.com/prekageo/optistate/blob/master/qm.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants