Verification Of Partial Quantifier Elimination
Abstract
Quantifier elimination (QE) is an important problem that has numerous applications. Unfortunately, QE is computationally very hard. Earlier we introduced a generalization of QE called partial QE (or PQE for short). PQE allows to unquantify a part of the formula. The appeal of PQE is twofold. First, many important problems can be solved in terms of PQE. Second, PQE can be drastically faster than QE if only a small part of the formula gets unquantified. To make PQE practical, one needs an algorithm for verifying the solution produced by a PQE solver. In this paper, we describe a very simple SAT-based verifier called and provide some experimental results.
1 Introduction
Earlier, we introduced a generalization of Quantifier Elimination (QE) called partial QE (or PQE for short) [1]. PQE allows to unquantify a part of the formula. So, QE is just a special case of PQE where the entire formula gets unquantified. The appeal of PQE is twofold. First, it can be much more efficient than QE if only a small part of the formula gets unquantified. Second, many known verification problems like SAT, equivalence checking, model checking and new problems like property generation can be solved in terms of PQE [1, 2, 3, 4, 5]. So, PQE can be used to design new efficient algorithms. To make PQE practical, one needs to verify the correctness of the solution provided by a PQE solver. Such verification is the focus of this paper.
We consider PQE on propositional formulas in conjunctive normal form (CNF)111Every formula is a propositional CNF formula unless otherwise stated. Given a CNF formula represented as the conjunction of clauses , we will also consider as the set of clauses . with existential quantifiers. PQE is defined as follows. Let be a propositional CNF formula where are sets of variables. Let be a subset of clauses of . Given a formula , find a quantifier-free formula such that . In contrast to QE, only the clauses of are taken out of the scope of quantifiers here (hence the name partial QE). We will refer to as a solution to PQE. As we mentioned above, PQE generalizes QE. The latter is just a special case of PQE where and the entire formula is unquantified.
To verify the solution above one needs to check if indeed holds. If derivation of is done in some proof system, one can check the correctness of by verifying the proof (like it is done for SAT-solvers). Since, PQE is currently in its infancy and no well established proof system exists we use a more straightforward approach. Namely, we present a very simple SAT-based verification algorithm called that does not require any knowledge of how the solution is produced. A flaw of is that, in general, it does not scale well. Nevertheless, can be quite useful in two scenarios. First, is efficient enough to handle PQE problems formed from random formulas of up to 70-80 variables. Such examples can can be employed when debugging a PQE solver. Second, can efficiently verify even large PQE problems for a particular class of formulas described in Subsection 4.3.
The paper is structured as follows. Basic definitions are given in Section 2. Section 3 formally describes how a solution to PQE can be verified. The verification algorithm called is presented in Section 4. Section 5 gives experimental results. Some background is provided in Section 6 and conclusions are made in Section 7.
2 Basic Definitions
In this section, when we say “formula” without mentioning quantifiers, we mean “a quantifier-free formula”.
Definition 1
We assume that formulas have only Boolean variables. A literal of a variable is either or its negation. A clause is a disjunction of literals. A formula is in conjunctive normal form (CNF) if where are clauses. We will also view as a set of clauses . We assume that every formula is in CNF unless otherwise stated.
Definition 2
Let be a formula. Then denotes the set of variables of and denotes .
Definition 3
Let be a set of variables. An assignment to is a mapping where . We will denote the set of variables assigned in as . We will refer to as a full assignment to if . We will denote as the fact that a) and b) every variable of has the same value in and .
Definition 4
A literal and a clause are said to be satisfied (respectively falsified) by an assignment if they evaluate to 1 (respectively 0) under .
Definition 5
Let be a clause. Let be a formula that may have quantifiers, and be an assignment to . If is satisfied by , then . Otherwise, is the clause obtained from by removing all literals falsified by . Denote by the formula obtained from by removing the clauses satisfied by and replacing every clause unsatisfied by with .
Definition 6
Given a formula , a clause of is called quantified if .
Definition 7
Let be formulas that may have existential quantifiers. We say that are equivalent, written , if for all full assignments to .
Definition 8
Let be a formula and and . The clauses of are said to be redundant in if .
Definition 9
Given a formula and where , the Partial Quantifier Elimination (PQE) problem is to find such that. (So, PQE takes out of the scope of quantifiers.) The formula is called a solution to PQE. The case of PQE where is called Quantifier Elimination (QE).
Remark 1
For the sake of simplicity, we will assume that every clause of formula in Definition 9 is quantified.
Example 1
Consider the formula where , , , . Let denote and denote . Consider the PQE problem of taking out of i.e. finding such that . One can show that . That is, is a solution to the PQE problem above.
Proposition 1
Let be a solution to the PQE problem of Definition 9. That is . Then (i.e. implies ).
The proofs of propositions are given in Appendix 0.A.
3 Verification Of A Solution to PQE
Let be a solution found by a PQE solver when taking out of . That is is supposed to hold. One can check if this is true (i.e. whether is correct) using the proposition below.
Proposition 2
Formula is a solution to the PQE problem of taking out of the scope of quantifiers in if and only if
-
a)
is implied by ;
-
b)
is redundant in i.e.
Checking the first condition of Proposition 2 can be done by a SAT-solver. Namely, one just needs to check for every clause of if is unsatisfiable. (If so, then .) Below, we describe how one can check the second condition of Proposition 2 in terms of boundary points.
Definition 10
Let be a formula and be a non-empty subset of clauses of . A full assignment to is called a -boundary point of if it falsifies and satisfies .
The name “boundary point” is due to the fact that if the subset is small, can sometimes be close to the boundary between assignments satisfying and falsifying .
Definition 11
Let be a formula and be a non-empty subset of . Let (,) be a -boundary point of where and are full assignments to and respectively. The -boundary point (,) is called -removable (respectively -unremovable) if formula is unsatisfiable (respectively satisfiable).
Recall that describes the formula in subspace . So the fact that is unsatisfiable (or satisfiable) just means that is unsatisfiable (respectively satisfiable) in subspace . We use the name “-removable boundary point” since such a boundary point can be eliminated by adding a clause implied by that depends only on variables of . Indeed, suppose that (,) is a -removable -boundary point. Then is unsatisfiable and hence there is a clause falsified by and implied by . Note that (,) is not a -boundary point of because it falsifies the formula . So, adding to eliminates the -boundary point (,). On the contrary, a -unremovable boundary point (,) cannot be eliminated by adding a clause falsified by and implied by .
Proposition 3
Let be a formula. Let be a non-empty subset of clauses of . The formula is redundant in if and only if every -boundary point of (if any) is -unremovable.
So, to check the second condition of Proposition 2 one needs to show that every -boundary point of (if any) is -unremovable.
4 Description of
{ | |||
1 | for every { | ||
2 | |||
3 | if () | ||
4 | return(false)} | ||
———— | |||
5 | for every { | ||
6 | |||
7 | if () return(false) | ||
8 | } | ||
9 | return(true) |
In this section, we describe the algorithm for verification of PQE called .
4.1 High-level view of
A high-level view of is given in Fig. 1. accepts formula , a subset of clauses to take out of the scope of quantifiers and a solution to this PQE problem. That is is supposed to be logically equivalent to . returns true if this equivalence holds and so, is a correct solution. Otherwise, returns false.
consists of two parts separated by a solid line. In the first part (lines 1-4), just checks if is implied by . This is done by checking for every clause if is satisfiable. If so, is not implied by and the solution is incorrect. Hence, returns false (line 4). In the second part (lines 5-9), for every clause , the algorithm checks if is redundant in by calling the function (line 6). Namely, checks if . If so, is removed from (line 8). Otherwise, is not redundant in and returns false (line 7). If all clauses of can be removed from , then is a correct solution and returns true.
4.2 Description of
{ | |||
1 | |||
2 | |||
3 | while (true) { | ||
4 | |||
5 | |||
6 | if () | ||
7 | return(true) | ||
8 | |||
9 | if () | ||
10 | return(false) | ||
11 | |||
12 | } }} |
The pseudocode of is shown in Fig. 2. accepts the formula and a quantified clause to be checked for redundancy. returns true if is redundant in . Otherwise, it returns false. To verify redundancy of , checks if has a -removable -boundary point. If not, is redundant. Otherwise, is not redundant.
starts with computing the set of unquantified variables (line 1). Then it initializes the set of “plugging” clauses (see below). The main work is done in the while loop (lines 3-12). starts with checking if formula has a -boundary point (lines 4-5) i.e. checking if there is an assignment (,) satisfying . The formula Plg is used here to exclude the -boundary points examined in the previous iterations of the loop. If no (,) exists, the clause is redundant and returns true (line 7).
If the assignment (,) above exists, checks if formula is satisfiable i.e. whether is satisfiable in subspace (lines 8-10). If not, the -boundary point (,) is -removable. This means that is not redundant in and returns false (line 10). Otherwise, (,) is a -unremovable boundary point and calls the function PlugCls to build a plugging clause . The latter is falsified by and so excludes re-examining -boundary points in the subspace . After that, adds to the formula Plg and starts a new iteration of the loop.
The simplest way to build is to form the longest clause falsified by . One can try to make shorter to exclude a greater subspace from future considerations. Suppose there is such that the assignment satisfying (found in line 8) still satisfies . This means that every -boundary point of the larger subspace is -unremovable too. So, one can add to Plg a shorter plugging clause falsified by rather than .
4.3 Scalability issues
As we mentioned earlier, consists of two parts. The first part of checks if every clause of the solution is implied by . In the second part, for every clause , the function checks if is redundant in . (Recall that is the subset of clauses that one must take out of .) The first part reduces to calls to a SAT-solver. So, it is as scalable as SAT-solving (unless blows up as the size of the PQE problem grows). The second part of scales much poorer. The reason is that this part requires enumeration of -unremovable -boundary points and the number of such points is typically grows exponentially. Besides, the plugging clauses produced by are long. So, adding a plugging clause cannot exclude a big chunk of -boundary points at once. So, the size of formulas that can be efficiently handled by is limited by 70-80 variables.
There is however an important case where can efficiently verify large formulas. This is the case where does not have any -unremovable -boundary points. (Since and have the same -unremovable -boundary points, this means that has no such boundary points either.) Then for every clause , the function immediately finds out that the formula is unsatisfiable. So, the verification of solution reduces to SAT-checks.
5 Experimental Results
In this section, we experimentally evaluate our implementation of . In this implementation, we used Minisat [6] as an internal SAT-solver. The source of and some examples can be downloaded from [7]. We conducted three experiments in which we verified solutions obtained by the PQE algorithm called - [5]. In the experiments we solved the PQE problem of taking a clause out of formula i.e. finding a formula such that . In Subsections 5.1 and 5.2 we consider large formulas appearing in the process of “property generation”. Namely, these formulas were constructed when generating properties of circuits from the HWMCC-13 set as described in [5]. In Subsection 5.3, we consider small random formulas. In the experiments we used a computer with Intel® CoreTM i5-10500 CPU @ 3.10GHz.
5.1 Formulas where all boundary points are removable
In this subsection, we consider the PQE problems of taking out of where all -boundary points of are -removable. In [5], we generated 3,736 of such formulas. In Table 1, we give a sample of 7 formulas. The first column of the table gives the name of the circuit of the HWMCC-13 set used to generate the PQE problem. (The real names of circuits exmp1, exmp2 and examp3 in the HWMCC-13 set are mentorbm1, bob12m08m, and bob12m03m respectively.)
name | cla- | vari- | size | size | EG-PQE+ | VerPQE |
of | uses | ables | of set | of | run | run |
circ. | of | of | time (s) | time (s) | ||
exmp1 | 64,365 | 26,998 | 4,376 | 1 | 0.2 | 0.03 |
6s207 | 73,457 | 30,540 | 3,012 | 6 | 0.2 | 0.04 |
exmp2 | 84,009 | 32,147 | 1,994 | 1 | 0.1 | 0.1 |
exmp3 | 94,523 | 41,354 | 5,174 | 825 | 11 | 0.4 |
6s249 | 226,666 | 78,289 | 1,111 | 1 | 0.4 | 0.1 |
6s428 | 231,506 | 92,274 | 3,790 | 118 | 2.8 | 0.2 |
6s311 | 259,086 | 87,974 | 519 | 80 | 2.0 | 0.1 |
The second and third co-lumns give the number of clauses and variables of formula . The fourth column shows the size of the set i.e. the number of unquantified variables in . The next column gives the number of clauses in the solution found by -. The last two columns show the time taken by - and (in seconds) to finish the PQE problem and verify the solution. As we mentioned in Subsection 4.3, if all -boundary points of are -removable the same applies to formula . So, should be very efficient even for large formulas. Table 1 substantiates this intuition.
5.2 Formulas with unremovable boundary points
name | cla- | vari- | size | size | EG-PQE+ | VerPQE |
of | uses | ables | of set | of | run | run |
circ. | of | of | time (s) | time (s) | ||
6s209 | 25,086 | 14,868 | 5,759 | 5 | 0.1 | 600 |
6s413 | 29,321 | 14,063 | 4,343 | 18 | 0.2 | 600 |
6s276 | 35,810 | 17,631 | 3,201 | 11 | 0.1 | 600 |
6s176 | 39,704 | 15,754 | 1,566 | 0 | 0.9 | 600 |
6s207 | 73,457 | 30,540 | 3,012 | 20 | 0.5 | 600 |
6s110 | 83,396 | 34,165 | 807 | 6 | 0.2 | 0.1 |
6s275 | 109,328 | 49,130 | 3,196 | 2 | 0.1 | 600 |
Here we consider the same PQE problems as in the previous subsection. The only difference is that the formula contains -boundary points that are -unremovable. In [5], we generated 3,094 of such formulas. In Table 2, we give a sample of 7 formulas. The name and meaning of each column is the same as in Table 1.
Table 2 shows that failed to verify 6 out of 7 solutions in the time limit of 600 sec. whereas the corresponding problems were easily solved by -. (The reason is that - uses a more powerful technique of proving redundancy of than plugging unremovable boundary points as does.) So, solutions obtained for large formulas where has a lot of unremovable boundary points cannot be efficiently verified by .
5.3 Random formulas
In this subsection, we continue consider formulas with -unremovable -boundary points. Only, in contrast to the previous subsection, here we consider small random formulas. In this experiment we verified solutions obtained for formulas whose number of variables ranged from 70 to 85. To get more reliable data, for each size we generated 100 random PQE problems and computed the average result. For each example, the formula had 20% of two-literal and 80% of three-literal clauses.
num- | cla- | vari- | size | size | EG-PQE+ | VerPQE |
ber of | uses | ables | of set | of | run | run |
prob. | of | of | time (s) | time (s) | ||
100 | 140 | 70 | 35 | 28 | 0.01 | 1.0 |
100 | 150 | 75 | 37 | 41 | 0.01 | 4.7 |
100 | 160 | 80 | 40 | 69 | 0.03 | 11.5 |
100 | 170 | 85 | 42 | 63 | 0.03 | 98.3 |
The results of this experiment are shown in Table 3. Let us explain the meaning of each column of this table using its first line. The first column indicates that we generated 100 PQE problems of the same size shown in the next three columns. That is for all 100 problems corresponding to the first line of Table 3 the number of clauses, variables and the size of the set was 140, 70 and 35 respectively. The last three columns of the first line show the average results over 100 examples. For instance, the first column of the three says that the average size of the solution found by - was 28 clauses. Table 3 shows that the performance of drastically drops as the number of variables grows due to the exponential blow-up of the set of -unremovable -boundary points.
6 Some Background
In this section, we give some background on boundary points. The notion of a boundary point with respect to a variable was introduced in [8]. (At the time it was called an essential point). Given a formula , a boundary point with respect to a variable is a full assignment to such that each clause falsified by contains . Later we showed a relation between a resolution proof and boundary points [9]. Namely, it was shown that if is unsatisfiable and contains a boundary point with respect to a variable , any resolution proof that is unsatisfiable has to contain a resolution on . In [10], we presented an algorithm that performs SAT-solving via boundary point elimination.
In [11, 12], we introduced the notion of a boundary point with respect to a subset of variables rather than a single variable. Using this notion we formulated a QE algorithm that builds a solution by eliminating removable boundary points. In [5], we formulated two PQE algorithms called - and -. The algorithm - is quite similar to and implicitly employs the notion of a boundary point we introduced here i.e. the notion formulated with respect to a subset of clauses rather than variables. In this report, when describing we use this notion of a boundary point explicitly.
7 Conclusions
We present an algorithm called for verifying a solution to Partial Quantifier Elimination (PQE). The advantage of is that it does need to know how this solution was obtained (e.g. if a particular proof system was employed). So, can be used to debug an any PQE algorithm. A flaw of is that its performance strongly depends on the presence of so-called unremovable boundary points of the formula at hand. If this formula has no such points, can efficiently verify solutions to very large PQE problems. Otherwise, its performance is, in general, limited to small problems of 70-80 variables.
References
- [1] E. Goldberg and P. Manolios, “Partial quantifier elimination,” in Proc. of HVC-14. Springer-Verlag, 2014, pp. 148–164.
- [2] ——, “Software for quantifier elimination in propositional logic,” in ICMS-2014,Seoul, South Korea, August 5-9, 2014, pp. 291–294.
- [3] E. Goldberg, “Equivalence checking by logic relaxation,” in FMCAD-16, 2016, pp. 49–56.
- [4] ——, “Property checking without inductive invariant generation,” Tech. Rep. arXiv:1602.05829 [cs.LO], 2016.
- [5] ——, “Partial quantifier elimination and property generation,” Tech. Rep. arXiv:2303.13811 [cs.LO], 2023.
- [6] N. Eén and N. Sörensson, “An extensible sat-solver,” in SAT, Santa Margherita Ligure, Italy, 2003, pp. 502–518.
- [7] The source of , http://eigold.tripod.com/software/ver-pqe.1.0.tar.gz.
- [8] E. Goldberg, M. Prasad, and R. Brayton, “Using problem symmetry in search based satisfiability algorithms,” in DATE ’02, Paris, France, 2002, pp. 134–141.
- [9] E. Goldberg, “Boundary points and resolution,” in Proc. of SAT. Springer-Verlag, 2009, pp. 147–160.
- [10] E. Goldberg and P. Manolios, “Sat-solving based on boundary point elimination,” in Proc. of HVC-10. Springer-Verlag, 2011, pp. 93–111.
- [11] ——, “Removal of quantifiers by elimination of boundary points,” Tech. Rep. arXiv:1204.1746 [cs.LO], 2012.
- [12] ——, “Quantifier elimination by dependency sequents,” Formal Methods in System Design, vol. 45, no. 2, pp. 111–143, 2014.
Appendix
Appendix 0.A Proofs Of Propositions
Proposition 1
Let be a solution to the PQE problem of Definition 9. That is . Then (i.e. implies ).
Proof
By conjoining both sides of the equality with one concludes that, which entails . Then and thus .
Proposition 2
Formula is a solution to the PQE problem of taking out of the scope of quantifiers in if and only if
-
a)
is implied by ;
-
b)
is redundant in i.e.
Proof
The if part. Given the two conditions above, one needs to prove that . Assume the contrary i.e. . Consider the two possible cases. The first case is that there exists a full assignment to such that is satisfiable in subspace whereas is unsatisfiable in this subspace. Since is satisfiable in the subspace , is unsatisfiable in this subspace. So, does not imply and we have a contradiction.
The second case is that is unsatisfiable in the subspace whereas is satisfiable there. Then is unsatisfiable in subspace too. So, in subspace and hence is not redundant in . So, we have a contradiction again.
The only if part. Given , one needs to prove the two conditions above. The first condition (that is implied by ) follows from Proposition 1. Now assume that the second condition (that is redundant in ) does not hold. That is . Note that if is satisfiable in a subspace , then is satisfiable too. So, the only case to consider here is that is unsatisfiable in a subspace whereas is satisfiable there. This means that is unsatisfiable in the subspace . Then in this subspace and we have a contradiction.
Proposition 3
Let be a formula. Let be a non-empty subset of clauses of . The formula is redundant in if and only if every -boundary point of (if any) is -unremovable.
Proof
The if part. Given that every -boundary point of is -unremovable, one needs to show that is redundant in i.e. . Assume that this is not true. Then there is a full assignment to such that is unsatisfiable in subspace whereas is satisfiable there. This means that there is an assignment (,) falsifying and satisfying . Since this assignment falsifies , it is a -boundary point. This boundary point is -removable, because is unsatisfiable in subspace . So, we have a contradiction.
The only if part. Given that is redundant in , one needs to show that every -boundary point of is -unremovable. Assume the contrary i.e. there is a -removable -boundary point of . This means that there is an assignment (,) falsifying and satisfying such that is unsatisfiable in subspace . Then in subspace and so, we have a contradiction.