Solving Satisfiability of Polynomial Formulas By SampleCell Projection
Abstract
A new algorithm for deciding the satisfiability of polynomial formulas over the reals is proposed. The key point of the algorithm is a new projection operator, called samplecell projection operator, custommade for ConflictDriven Clause Learning (CDCL)style search. Although the new operator is also a CAD (Cylindrical Algebraic Decomposition)like projection operator which computes the cell (not necessarily cylindrical) containing a given sample such that each polynomial from the problem is signinvariant on the cell, it is of singly exponential time complexity. The samplecell projection operator can efficiently guide CDCLstyle search away from conflicting states. Experiments show the effectiveness of the new algorithm.
Keywords:
SMT satisfiability nonlinear arithmetic CAD polynomial.1 Introduction
The research on SMT (Satisfiability Modulo Theories) [18, 20, 2] in recent years brings us many popular solvers such as Z3 [19], CVC4 [1], Yices [7], MathSAT5 [5], etc. Nevertheless, in theory and practice, it is important to design efficient SMT algorithms and develop tools (or improve existing ones) for many other theories, e.g. string [15], linear arithmetic [8, 13] and nonlinear arithmetic [3, 14] over the reals. A straightforward idea is to integrate ConflictDriven Clause Learning (CDCL)style search with theory solvers [2]. For example, integrating CDCLstyle search with a theory solver for determining whether a basic semialgebraic set is empty can solve satisfiability in the theory of nonlinear arithmetic over the reals.
It is wellknown that the problem whether a basic semialgebraic set is empty is decidable due to Tarski’s decision procedure [21]. Tarski’s algorithm cannot be a theory solver in practice because of its very high complexity. Cylindrical algebraic decomposition (CAD) algorithm [6] is a widely used theory solver in practice though it is of doubly exponential time complexity. The idea of CAD algorithm is to decompose into cells such that each polynomial from the problem is signinvariant in every cell. A key concept in CAD algorithm is the projection operator. Although many improved projection operators have been proposed [11, 16, 17, 4, 10, 9, 22], the CAD method is still of doubly exponential time complexity. The main reason is that in order to carry enough information, projection of variables causes the number of polynomials grows rapidly. So the cost of simply using CAD as a theory solver is unacceptable.
Jovanovic and de Moura [13] eased the burden of using CAD as a theory solver by modifying the CDCLstyle search framework. They changed the sequence of search states by adding variable assignments to the sequence. The benefit of this is that they can use realroot isolation, which is of polynomial time complexity, to check consistency of literals for there will be only one unassigned variable in the literals of the current state. When a conflict of literals is detected, they explain the conflict by applying CAD to a polynomial set called conflicting core to find the cell where the sample of assignments belongs. But even using CAD only when explaining conflicts is a huge computational cost, as CAD is of doubly exponential time complexity. Furthermore, CAD will produce all cells in other than the only one we need, making computation waste.
In this paper, we propose a new custommade CADlike projection operator, called samplecell projection operator. It only processes the cell containing a given sample, which is exactly what conflict explanation needs. The idea of our operator is trying to project polynomials related to the target cell and ignore irrelevant polynomials. We integrate our samplecell projection operator with Jovanovic’s improved CDCLstyle search framework. The new operator can efficiently guide CDCLstyle search away from conflicting states. It is proved that the new algorithm is of singly exponential time complexity. We have implemented a prototype solver LiMbS which is base on Mathematica 12. Experiments show the effectiveness of the new algorithm.
The rest of this paper is structured as follows: Section 2 introduces the background knowledge and notation. Section 3 defines samplecell projection and presents the details of our approach. Section 4 describes the CDCLstyle search framework which we adopt. We evaluate our approach on many wellknown examples and analyze its performance in Section 5. The paper is concluded in Section 6.
2 Notation
Let denote the field of real numbers, denote the ring of integers and denote the field of rational numbers. Unless stated otherwise, we assume that all polynomials in this paper are in , the ring of multivariate polynomials in variables with integer coefficients.
For a polynomial :
where and for , the degree of with respect to (w.r.t.) is , denoted by . The leading coefficient of w.r.t. is , denoted by and the leading term of w.r.t. is , denoted by . Let
denote the set of coefficients of w.r.t. and denote the variables appearing in .
Suppose :
where and for . Let denote the Sylvester resultant of and w.r.t. , i.e. the determinant of the following matrix
which has rows of and rows of . The discriminant of w.r.t. is
An atomic polynomial constraint is where is a polynomial and . A polynomial literal (simply literal) is an atomic polynomial constraint or its negation. For a literal , denotes the polynomial in and . A polynomial clause is a disjunction of literals. Sometimes, we write a clause as . A polynomial formula is a conjunction of clauses. An extended polynomial constraint is where , with and is a given integer. Notice the variable is an exclusive free variable that cannot be used outside the object.
For a formula , denote the resulting formula via substituting for in . For variables and , a mapping which maps to for is called a variable assignment of and is called a sample of or a sample of in . We denote by . If , we say vanishes under or vanishes under . Suppose an extended polynomial constraint is of the form and is a variable assignment of . If is the th real root of , is defined to be . If has less than real roots, is defined to be False.
3 SampleCell Projection
In this section, we first introduce some wellknown concepts and results concerning CAD and then define the socalled samplecell projection operator.
Let be an analytic function defined in some open set of where is a field. For a point , if or some partial derivative (pure and mixed) of of some order does not vanish at , then we say that has order where is the least nonnegative integer such that some partial derivative of total order does not vanish at . Otherwise, we say has infinite order at . The order of at is denoted by . We say is orderinvariant in a subset if for any . Obviously, if and the analytic function is orderinvariant in , then is signinvariant in .
An variable polynomial where is said to be analytic delineable on a connected dimensional submanifold if

The number of different real roots of is invariant for any point . And the trace of the real roots are the graphs of some pairwise disjoint analytic functions from into (i.e. the order of real roots of is invariant for all point );

There exist positive integers such that for every point , the multiplicity of the real root of is for .
Especially, if has no zeros in , then is delineable on with . The analytic functions ’s are called the real root functions of on , the graphs of the ’s are called the sections over , and the connected regions between two consecutive sections (for convenience, let and ) are called sectors over . Each section over is a connected dimensional submanifold in and each sector over is a connected dimensional submanifold in .
Theorem 3.1 ([17], Theorem 2)
Let and be a polynomial in of positive degree where . Let be a connect submanifold of where is degreeinvariant and does not vanish identically. Suppose that is a nonzero polynomial and is orderinvariant in . Then is analytic delineable on and is orderinvariant in each section over .
Suppose is a sample of in and is a polynomial set in where . Consider the real roots of polynomials in . Denote the th real root of by . We define two concepts: the sample polynomials set of in (denoted by ) and the sample interval of in (denoted by ) as follows.
If there exists such that then
If there exist two consecutive real roots and such that then
If there exists such that and for all then
If there exists such that and for all then
Specially, if every polynomial in does not have any real roots, define
Example 1
Let where , , and . We have (see Figure 1)
Additionally, for a polynomial
where , and for . If there exists such that and for any , then the sample coefficients of at is defined to be , denoted by . Otherwise .
Definition 1
Suppose is a sample of in and is a polynomial set in where . The samplecell projection of on at is
Remark 1

If and , is obviously an element of .

Computing will produce elements, so the time complexity of projecting all the variables by recursively using is .
Now we prove the property of the new projection operator. A set of polynomials in is said to be a squarefree basis if the elements of the set have positive degrees, and are primitive, squarefree and pairwise relatively prime. For a connected submanifold of , we denote by
Theorem 3.2
Let be a finite squarefree basis in where and . Let be a sample of in and be a connected submanifold of such that . Suppose that each element of is orderinvariant in . Then each element in either vanishes identically on or is analytic delineable on , each section over of the element of which do not vanish identically on is either equal to or disjoint with , and each element of either vanishes identically on or is orderinvariant in .
Proof
For any , if vanishes identically on , there is nothing to prove. So we may assume that any element in does not vanish identically on .
For any such that , let . Notice that is degreeinvariant on (each element of is orderinvariant, hence signinvariant in ). And we have
It follows from this equality that (because ’s are squarefree and pairwise relatively prime). Obviously, each factor of is a factor of , so is orderinvariant in . By Theorem 3.1, is analytic delineable on and is orderinvariant in each section over . So and are orderinvariant in each section over . It follows that the sections over of and are pairwise disjoint. Therefore, and are analytic delineable on , every section of them is either equal to or disjoint with , and and are orderinvariant in .
Remark 2
Notice that when vanishes identically on , isn’t always orderinvariant in . This is avoidable by changing the ordering of variables and is negligible when the satisfiability set of formulas is fulldimensional. We find a way to handle this rare case: either to determine whether the coefficients of have finitely many common zeros, or to enlarge by adding partial derivatives of whose order is less than and one nonzero partial derivative whose order is exactly equal to .
When integrating the new projection operator with the CDCLtype search (see Section 4), we need a traditional CAD projection operator [16, 17].
Definition 2 ([16])
Suppose is a polynomial set in where . The McCallum projection of on is
Remark 3
Notice that can be replaced by when we have a sample of dimension.
Theorem 3.3 ([17], Theorem 1)
Let be a finite squarefree basis in where and and be a connected submanifold of such that each element of is orderinvariant in . Then each element in either vanishes identically on or is analytic delineable on , the sections over of the elements of which do not vanish identically on are pairwise disjoint, and each element of which does not vanish identically on is orderinvariant in every such section.
Now, let us use the following definition to describe the procedure of calculating sample cells. We denote by the set of irreducible factors of all polynomials in .
Definition 3
Suppose is a sample of in and is a polynomial set in where . The sample cell of at is
where , , , and for .
Remark 4

It is a standard way to use to ensure that every is a finite squarefree basis.

Notice that the complexity of computing sample cell depends on where means the number of polynomials in . From the recursive relationship , , it is not hard to know that the complexity of computing is .
Corollary 1
Let be a polynomial set and , where . If
where , then
Example 2
Suppose and is a sample of . Then
So
and after simplification
4 CDCLstyle search framework
In this section, we introduce a search framework combined with the new projection operator proposed in the previous section. The main notation and concepts about the search framework are taken from Section 3 of [13] and Section 26.4.4 of [2].
Let and . For a polynomial , a literal and a clause , we define , and . We describe the search framework by transition relations between search states as in [13].
The search states are indexed pairs of the form , where is a finite set of polynomial clauses and is a sequence of literals and variable assignments. Every literal is marked as a decision or a propagation literal. We denote a propagation literal by if is propagated from and denote a decision literal by . We denote by a variable assignment. Let and . For a set of literals, means the resulting set of after applying the assignments of .
Next, we introduce transition relations between search states. Transition relations are specified by a set of transition rules. In the following, we use simple juxtaposition to denote the concatenation of sequences (e.g., ). We treat a literal or a variable assignment as oneelement sequence and denote the empty sequence as . We say the sequence is ordered when the sequence is of the form
where is a sequence of literals and each literal satisfies . Notice that might be . We define even if . We use to denote the sample of in and to denote the feasible set of . For a new literal with , we say is consistent with if . If is not consistent with , we define to be a minimal set of literals in such that does not have a solution for .
Remark 5
Since there is only one unassigned variable in the polynomials in , so can be easily calculated by realroot isolation.
Definition 4
Suppose is a literal and is an ordered sequence which satisfies and is not consistent with . Define the explain clause of with as
where .
Meanwhile, we define the state value of a literal as
And for a clause ,
Specially, .
Definition 5
A set of rules for transition relations between search states are defined as follows where is a clause and is a literal.
 DecideLiteral

if , , and is consistent with .
 BooleanPropagation

if , and is consistent with .
 LemmaPropagation

if or , , and is not consistent with .
 UpLevel

if , and .
 Sat

if .
 Conflict

if and .
 backtrackPropagation

if and
^{5} .  backtrackDecision

if .
 Skip

if .
 DownLevel

 Unsat

if and no assignment or decide literal in .
 Forget

if is a learnt clause.
Remark 6
Note that in this framework we rely on the rule lemmapropagation to guide the search away from conflicting states. When applying lemmapropagation, the most important thing is the explain clause. We cannot simply use the conflicting core as the explain clause, as this will cause explain to be an incorrect lemma because it ignores assignments. Using full CAD to calculate explain is also costly. Thanks to the sample cell calculated by the novel samplecell projection operator, we can now efficiently calculate an effective explain to achieve our purpose.
Theorem 4.1
Given a polynomial formula with finitely many clauses, any transition starting from the initial state will terminate either in a state , where the assignment satisfies the formula