Anybody knows of an algorithm to simplify boolean expressions?
I remember the boolean algebra and Karnaught maps, but this is meant for digital hardware where EVERITHING is boolean. I would like something that takes into account that some sub-expressions are not boolean.
For example:
a == 1 && a == 3
this could be translated to a pure boolean expression:
a1 && a3
but this is expression is irreducible, while with a little bit of knowledge of arithmetics everibody can determine that the expression is just:
false
Some body knows some links?
a
is declared as a volatile variable/field in languages/runtimes that allows those, and the value fluctuates between 1 and 3 on another thread? I'm not saying that is a good design, but in software, "always" and "never" are usually relative terms.a > 0 and b > 0 and n > 2 and a^n + b^n = c^n
is always false but it's not so easy to prove. That means you're stuck with ad-hoc simplifications and there's no clean answer to your question (since it'll depend on the nature of expressions you're likely to see).