Optimizing DNF/CNF forms #5233
Replies: 1 comment 3 replies
-
I think this subsumption is direct implication, right? A set of clauses If so, sure, Z3 would work for this. Z3 has a way to get it give you the CNF after reduction (as long as you don't need the theory solver, which would require "iteration"; i.e., your formula can be solved eagerly). However, if you're directly targetting Z3 as a way to solve formulae, do you care about getting the CNF? Would it be enough for you if Z3 could tell you "yes, |
Beta Was this translation helpful? Give feedback.
-
I wrote a C++ compiler and am implementing partial ordering of constraints, which is part of C++20 concepts. Unlike anything else in the compiler frontend, this involves formal logic, which I have no experience with.
http://eel.is/c++draft/temp.constr
Constraints are recursively broken apart into atoms. Conjunction and disjunction are the only operators supported, not negation, thankfully. I have a binary tree where terminals are atoms and interior nodes are || and && operations. Spooling this into CNF or DNF can generate pretty big normal forms. I was pointed to z3 and am wondering if there's a way to either lower a tree like I described to simplified CNF/DNF, or to take CNF/DNF and simplify that.
I'd need to use the C or C++ interfaces. My atoms are identified with integers. If there's a better subsumes test than the one I pasted, I could also use that, although the test if one atom subsumes another is very involved and I'd need a callback into the C++ frontend.
Is z3 suited for this?
Beta Was this translation helpful? Give feedback.
All reactions