简化布尔表达式算法 [英] Simplify boolean expression algorithm
问题描述
有人知道简化布尔表达式的算法吗?
Anybody knows of an algorithm to simplify boolean expressions?
我记得布尔代数和卡诺特映射,但这适用于 EVERITHING 为布尔值的数字硬件.我想要一些考虑到某些子表达式不是布尔值的东西.
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.
例如:
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
有些人知道一些链接?
推荐答案
您可能对 K-maps 感兴趣 和 Quine–McCluskey 算法.
我认为 SymPy 能够解决和简化布尔表达式,查看源代码可能会有用.
I think SymPy is able to solve and simplify boolean expressions, looking at the source might be useful.
这篇关于简化布尔表达式算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!