Claim: for set cardinalities we are creating sets based on semi-linear combinations of vectors based on Boolean assignments.
Thus, the vectors are based on satisfying implicants of the formula under .
General form:
Define
Solving B* with Constrained Horn Clauses (CHC)
If this is satisfiable with solution , then is UNSAT.
Justification:
if is a solution to CHC, then .
Solving B* with CHC
Conversely, if there is some set of assignments ,
such that , then it shows that .
State reachability - example
Solutions to are .
Set .
it is unsat
B* represents a special case vector addition system
Pretend it as a state-machine where the initial state is .
tells us the space of possible increments.
The increments are independent of the current state.
Each vector fits within a cube (each coordinate is either 0 or 1).
State reachability is decidable
Z3 contains an engine for Horn clauses (PDR/SPACER).
Simple algorithm: Enumerate all solutions to .
Check satisfiability of .
From PDR to conflicts
Assume we have a set of literals over set constraints and cardinalities of sets.
We want to check satisfiability of them.
Extract , solve for .
If the system is unsat: it means there is some solution for sets that satisfy the cardinality constraints.
if the system has a solution: it means the conjunction of set constraints cannot satisfy the cardinality constraints.
we could look for a subset of set constraints that are sufficient using the unsat core from cardinality constraints.
means the set is a singleton set and if with , then .
Abstract singleton constraints as sets of size 1 for variables that are distinct. Track distinctness assumptions.
Claim: we can eliminate singleton sets and just consider set variables with cardinality 1 from the point of view of the set solver.
Can anything reasonable be done with ranges, subsets, map?
Integration - Outline
Set of literals over set constraints.
All sub-expressions with cardinality operators
Sub-terms over sets .
Introduce fresh variables for sub-term definitions.
Define for equality constraints.
Define for cardinality operators, arithmetic constraints and set disequalities.
Check reachability.
The extra mile
What if we want to solve CHC over finite sets (not just Boolean programs)?
Is there a (non-trivial) class of CHC over finite sets that is solvable?
Trivial := finite sets over finite base sorts
Bibliography
[1]Ruzica Piskac, and Viktor Kuncak. “Decision Procedures for Multisets with Cardinality Constraints.” In Verification, Model Checking, and Abstract Interpretation, 9th International
Conference, VMCAI 2008, San Francisco, USA, January 7-9, 2008, Proceedings, edited by Francesco Logozzo, Doron A. Peled, and Lenore D. Zuck, 4905:218–232. Lecture Notes in Computer Science. Springer. 2008. doi:10.1007/978-3-540-78163-9_20. 🔎