Keywords

1 Introduction

Quantified Boolean formulas (QBFs), the extension of propositional formulas with quantifiers over the Boolean variables, have many applications in formal verification, synthesis, and artificial intelligence [28]. Over the last 25 years, many efficient QBF solvers have been developed [2], with clear tendency towards QBFs in prenex conjunctive normal form (PCNF). A QBF in PCNF has the form \(Q_1x_1\ldots Q_nx_n.\phi \) where \(Q_i \in \{\forall , \exists \}\) and \(\phi \) is a propositional formula in conjunctive normal form. In general, encodings do not result in formulas of this structure, because of recursive definitions in the encoding or from optimizations that try to minimize the scope of variables. Origins for a non-CNF structure can be for example the use of equivalences or xors in the encoding. Therefore two transformations are required: (1) prenexing which shifts the quantifiers outside of the formula, and (2) transformation of the quantifier-free formula to CNF. The latter is efficiently achieved by applying the QBF-variant of the well known Tseitin transformation [30] or the optimized Plaisted-Greenbaum transformation [24]. In this work, we focus on the prenexing.

Without loss of generality, formulas can be assumed to be in negation normal form (i.e. negation symbols only occur in front of variables) and cleansed (i.e. no variable occurs both bound and free, and every variable is quantified at most once). Under these conditions, prenexing is achieved by the following two rules:

$$ (\textsf{Q}x.\varphi ) \circ \varphi ' \Leftrightarrow \textsf{Q}x.(\varphi \circ \varphi ') \quad \quad \varphi \circ (\textsf{Q}x.\varphi ') \Leftrightarrow \textsf{Q}x.(\varphi \circ \varphi ') $$

with \(\textsf{Q}\in \{\forall , \exists \}\) and \(\circ \in \{\wedge , \vee \} \). The formula structure imposes an ordering of the quantifiers based on the subformula relation. Quantifiers from independent parts of a formula can be freely ordered. For example, the formula \(\forall x.(\exists y.(y \vee x)) \wedge (\forall z.(z \vee \lnot x))\) has prenex forms \(\forall x.\exists y.\forall z.\phi \) or \(\forall x.\forall z.\exists y.\phi \) where \(\phi = (y \vee x) \wedge (z \vee \lnot x)\). Hence, a prenex form is not uniquely determined.

Egly et al. [6] suggested four different prenexing strategies that minimize the number of quantifier alternations in the prefix. Empirically, they showed that the selected prenexing strategy impacts solving performance. In this work, we revisit those prenexing strategies and give a concise formalization, which the original work lacked. We show that the original four strategies disambiguate into six unique prenexing strategies when enforcing a minimal number of quantifier alternations, and we present a tool that implements those strategies. To evaluate the impact of prenexing on modern solvers we reimplemented the generator for encoding nested counterfactuals and performed extensive experiments with these formulas and formulas from the QBFEval’08 in which a non-prenex track was organized.

2 Preliminaries

The set of quantified Boolean formulas \( QF (X)\) over variables X is defined as follows: (1) \(\top , \bot , x, \lnot x, \lnot \top , \lnot \bot \in QF (X)\) if \(x \in X\), (2) \(\varphi \vee \varphi ^\prime , \varphi \wedge \varphi ^\prime \in QF (X)\) if \(\varphi , \varphi ^\prime \in QF (X)\), (3) if \(\varphi \in QF (X)\), then \(\forall x.\varphi , \exists x.\varphi \in QF (X)\) with \(x \in X\).Footnote 1 In QBF \(\textsf{Q}x.\varphi \) with \(\textsf{Q}\in \{\forall , \exists \}\), the subformula \(\varphi \) is called the scope of variable \(x \in X\) and x is said to be bound by quantifier \(\textsf{Q}\). If variable x occurs in QBF \(\varphi \), but \(\varphi \) does neither contain \(\exists x\) nor \(\forall x\) then x is free in \(\varphi \). The set of all free variables of a QBF \(\varphi \) is denoted by \( free (\varphi )\). A QBF without free variables is called closed. In the following, we assume that each variable is in the scope of at most one quantifier and that each variable occurs either free or bound, but not both in a formula. We call such formulas cleansed. The semantics of a QBF \(\varphi \) is defined by the interpretation function \([.]_{\sigma } : QF (X) \rightarrow \mathbb {B}\) where \(\mathbb {B} = \{\textbf{1}, \textbf{0}\}\) and \(\sigma : free (\varphi ) \rightarrow \mathbb {B}\) is an assignment to the free variables of \(\varphi \). Then \([\top ]_{\sigma } = \textbf{1}\), \([\bot ]_{\sigma } = \textbf{0}\), for any \(x \in X\), \([x]_{\sigma } = \sigma (x)\) and \([\lnot v]_{\sigma } = 1 - [v]_{\sigma }\) for \(v \in X \cup \{\top , \bot \}\). Furthermore, \([\varphi _1 \wedge \varphi _2]_{\sigma } = \min \{[\varphi _1]_{\sigma }, [\varphi _2]_{\sigma }\}\), and \([\varphi _1 \vee \varphi _2]_{\sigma } = \max \{[\varphi _1]_{\sigma }, [\varphi _2]_{\sigma }\}\). Finally, \([\exists x.\varphi ]_{\sigma } = \text {max}\{\varphi [x|\top ], \varphi [x|\bot ]\}\) and \([\forall x.\varphi ]_{\sigma } = \text {min}\{\varphi [x|\top ], \varphi [x|\bot ]\}\) where \(\varphi [x|t]\) denotes the QBF obtained by substituting a variable x by a truth constant \(t \in \{\top , \bot \}\) in \(\varphi \). Two QBFs \(\varphi , \varphi ' \in QF (X)\) are equivalent if \([\varphi ]_{\sigma } = [\varphi ']_{\sigma }\) for any assignment \(\sigma \).

Definition 1

The propositional skeleton \({\varphi }_{\textrm{psk}}\) of QBF \(\varphi \in QF (X)\) is defined as follows:

\( {\varphi }_{\textrm{psk}} = \left\{ \begin{array}{l l l } x &{} \text { if } \varphi = x, &{} x \in X \cup \{\top , \bot \}\\ \lnot x &{} \text { if } \varphi = \lnot x, &{} x \in X \cup \{\top , \bot \}\\ {\varphi '}_{\textrm{psk}} \circ {\varphi ''}_{\textrm{psk}} &{} \text { if } \varphi = \varphi ' \circ \varphi '', &{}\circ \in \{\wedge , \vee \}\\ {\varphi '}_{\textrm{psk}} &{} \text { if } \varphi = \textsf{Q}V. \varphi ', &{}\textsf{Q}\in \{\forall , \exists \} \end{array}\right. \)

We say that a QBF \(\varphi \) is of the form \(\textsf{Q}V. \varphi ^\prime \) for a set of variables V whenever \(\varphi = \textsf{Q}x_1.\dots .\textsf{Q}x_n. \varphi ^\prime \) for some enumeration \(x_1,\dots ,x_n\) of V. A QBF \(\varphi \in QF (X)\) is in prenex form if it is has the structure \(\varPi .\phi \) where \(\varPi = \textsf{Q}_1 x_1 \ldots \textsf{Q}_n x_n\) is a quantifier prefix with \(Q_i \in \{\forall , \exists \}\), \(x_i \in X\) and \(x_i \not = x_j\) for \(i \not = j\) and \(\phi \) is a propositional formula. If \(\phi \) is also in conjunctive normal form (CNF), then \(\varphi \) is in prenex conjunctive normal form (PCNF). A propositional formula is in CNF if it is a conjunction of clauses. A clause is a disjunction of literals and a literal is a variable or a negated variable. Obviously, \({(\varPi .\phi )}_{\textrm{psk}} = \phi \) for a PCNF formula \(\varPi .\phi \).

Proposition 1

Consider QBFs \(\varphi , \varphi ^\prime \), a quantifier \(\textsf{Q}\in \{\forall , \exists \}\), a connective \(\circ \), and variables xy.

  1. 1.

    If \(\varphi \circ (\textsf{Q}x. \varphi ^\prime )\) is cleansed, then \(\textsf{Q}x.(\varphi \circ \varphi ^\prime )\) is cleansed, and both formulas are equivalent.

  2. 2.

    If \(\textsf{Q}x.\textsf{Q}y.\varphi \) is cleansed, then \(\textsf{Q}y.\textsf{Q}x.\varphi \) is cleansed, and both formulas are equivalent.

Forests, trees and partial orders. We will oftentimes regard trees and forests as partially ordered sets. In particular, we define a forest as set T equipped with a partial ordering \(\le \) such that for all elements \(x \in T\), the subset \(\{ y \in T \mid y \le x \}\) is totally ordered. When T is finite, this definition appropriately models the recursive concept of a forest: the elements of T are nodes, and \(x \le y\) if y is a descendant of x. We say that x is covered by y whenever \(x \le y\) and there is no \(z \in T\) with \(x < y < z\). When regarding T as a forest, this means that x is the parent of y. A forest T is a tree if, additionally, for any two elements \(x, y \in T\) there is another element \(z \in T\) with \(z \le x\) and \(z \le y\). For a finite T, this implies that T has a least element, which corresponds to its root.

Given a forest T, we call a list \(x_1,\dots ,x_n\) a path in T if for all \(1 \le i < j \le n\) we have \(x_i, x_j \in T\) and \(x_i < x_j\). The height of a forest T is defined as

$$\begin{aligned} \textrm{ht}(T) = \max \{ n \ge 0 \mid \text {there is a path }x_1, \dots , x_n\text { in }T \}\text {.} \end{aligned}$$

For a node \(x \in T\), we define its lower bounds as \({T}^{x} = \{ y \in T \mid y \le x \}\) and its upper bounds as \(T_{x} = \{ y \in T \mid y \ge x \}\).

Parity-based functions. We will use a parity-based version of the floor and ceiling functions. Intuitively, \(\left\lfloor n\right\rfloor _{k}\) (resp. \(\left\lceil n\right\rceil _{k}\)) rounds n down (resp. up) to the closest integer with the same parity as k. Formally, for integers \(n, k \in \mathbb {Z}\) we define:

$$\begin{aligned} \left\lfloor n\right\rfloor _{k} = {} & \max \{ m \in \mathbb {Z} \mid m \le n \text { and } m - k \text { is even}\} \\ \left\lceil n\right\rceil _{k} = {} & \min \{ z \in \mathbb {Z} \mid z \ge y \text { and } m - k \text { is even}\} \end{aligned}$$

Direction-parametric operators. At several points our ordering-based definitions will depend on a direction parameter \(\dagger \in \{ \uparrow , \downarrow \}\). Intuitively, \(\uparrow \)-labeled operators use a reverse ordering, while \(\downarrow \)-labeled operators use an unmodified ordering. In particular, we define the following operators:

$$\begin{aligned} {\mathrel {\le ^{\uparrow }}} & \quad \text {is}\quad {\ge } & {\mathrel {\le ^{\downarrow }}} & \quad \text {is}\quad {\le } {} & {} \text {(and similarly for }{\mathrel {\ge ^{\dagger }}}\text {, }{\mathrel {<^{\dagger }}}\text {, }{\mathrel {>^{\dagger }}}\text {)}\\ {{\min }^{\uparrow }} & \quad \text {is}\quad {\max } & {{\min }^{\downarrow }} & \quad \text {is}\quad {\min } {} & {} \text {(and similarly for }{{\max }^{\dagger }}\text {)}\\ {\left\lfloor \dots \right\rfloor _{k}^{\uparrow }} & \quad \text {is}\quad {\left\lceil \dots \right\rceil _{k}} & {\left\lfloor \dots \right\rfloor _{k}^{\downarrow }} & \quad \text {is}\quad {\left\lfloor \dots \right\rfloor _{k}} {} & {} \text {(and similarly for }\left\lceil \dots \right\rceil _{k}^{\dagger }\text {)}\\ {T_{x}^{\uparrow }} & \quad \text {is}\quad {{T}^{x}} & {T_{x}^{\downarrow }} & \quad \text {is}\quad {T_{x}} {} & {} \text {(and similarly for }{T}^{x}_{\dagger }\text {)} \end{aligned}$$

3 Related Work

Already 20 years back it has empirically been shown that quantifier shifting has a severe impact on the solving performance [6] of QBF solvers. In this work, four different prenexing strategies were introduced that intuitively result in the smallest number of possible quantifier alternations. The authors noted that the presented strategies “leave room for different [prenexing] variants”. In this work, we close this gap by providing a concise formalization of quantifier shifting.

The observation that the prenexing strategy impacts solving performance motivated development of several non-prenex non-CNF solvers [7, 8, 15, 29]. With the rise of efficient preprocessing for PCNF formulas and a focus on applications with few quantifier alternations, however, solver development focused on formulas in prenex form. To deal with the information loss induced by quantifier shifting, solvers were introduced that employ dependency schemes [27] to (re-)discover and exploit variable independencies [16, 22], i.e., those solvers recover information on quantifier dependencies that is hidden in the prefix. Reeves et al. presented an approach to move Tseitin variables from the inner-most quantifier block to the outer-most possible position in the quantifier prefix [26]. The exact position is determined by the variables occuring in the formula defined by the Tseitin variable. With this reordering, they observe a considerable speed-up in solver performance. Lonsing and Egly evaluated the impact of the number of quantifier alternations on recent QBF solvers [18]. In their experiments, they established a correlation between different solving paradigms like expansion or QCDCL (see [2] for a detailed discussion of such proof systems) and the number of quantifier alternations. Also, proof-theoretical investigations [1] identify the number of quantifier alternations as source of hardness for practical solving. However, to the best of our knowledge, there is no recent study that investigates the impact of quantifier shifting on the solving behavior of state-of-the-art solvers for formulas in prenex normal form.

Nowadays there is also much interest in dependency quantified Boolean formulas (DQBF) which allow for an explicit specification of quantifier dependencies. The decision problem of these formulas is NEXPTIME-complete [23], in contrast to the PSPACE-completeness of QBFs.

4 Quantifier Shifting

In this work we aim to transform arbitrary QBF formulas \(\varphi \) (which are not in general prenex or in CNF) into equivalent prenex QBF formulas of the form \(\textsf{Q}_1 x_1. \dots \textsf{Q}_n x_n.{\varphi }_{\textrm{psk}}\). The formula \({\varphi }_{\textrm{psk}}\) is not necessarily in CNF, although this can be easily achieved through the well-known Tseitin procedure.

The method we propose can be roughly summarized as follows. First, a quantifier tree reflecting the scope hierarchy of quantifiers in \(\varphi \) is constructed. Each node in this quantifier tree will then be assigned a rank with some restrictions to guarantee soundness; we call this assignment a linearization. Finally, the formula \(\textsf{Q}_1 x_1. \dots \textsf{Q}_n x_n.{\varphi }_{\textrm{psk}}\) is constructed by enumerating the bound variables \(x_1,\dots ,x_n\) by rank; thanks to the restrictions on linearizations, this formula will be equivalent to \(\varphi \).

Example 1

Throughout our work we will use the following QBF \(\eta \) as a running example:

figure a

Its propositional skeleton \({\eta }_{\textrm{psk}}\) is then given by:

figure b

Consider the following two quantifier shifts for \(\eta \):

$$\begin{aligned} \eta ^\prime = {} & \exists x_1. \exists y_4. \exists z_5. \forall y_1. \forall z_2. \forall u_3. \forall z_4. \forall u_5. \exists z_1. \exists u_2. \exists u_4. \forall u_1. \exists v_1.{\eta }_{\textrm{psk}}\\ \eta ^{\prime \prime } = {} & \exists x_1. \exists y_4. \exists z_5. \exists v_1. \forall y_1. \forall z_2. \forall u_3. \forall z_4. \forall u_5. \exists z_1. \exists u_2. \exists u_4. \forall u_1.{\eta }_{\textrm{psk}} \end{aligned}$$

While \(\eta ^\prime \) is equivalent to \(\eta \), the QBF formula \(\eta ^{\prime \prime }\) is not. The intuitive reason is that in \(\eta ^{\prime \prime }\) the quantifier \(\exists v_1\) has been pushed across quantifier alternation boundaries. This is exactly the situation our formalization will prevent.

Our formalization associates to each QBF a forest obtained by removing from its syntax tree all non-quantifier nodes. The remaining nodes are thus uniquely determined by a bound variable and a quantifier, and this forest contains all the information needed for quantifer shifting. Hence, we first define the abstract concept of quantifier forests, and then we will show how to construct a quantifier forest from a QBF as above.

A quantifier forest is a triple \((T, \le , q)\) where \((T, \le )\) is a finite forest regarded as a partially ordered set (see Sect. 2) and \(q: T \rightarrow \{\forall , \exists \}\). We call it a quantifier tree or quantree whenever \((T, \le )\) is a tree. If \((T, \le , q)\) is a nonempty quantree, we also define \({q}^{\star }(x) = 1\) if \(q(x) = q(\min (T))\) and \({q}^{\star }(x) = 0\) otherwise. Given a QBF formula \(\varphi \), its associated quantifier forest is a triple \((T_\varphi , {\le _{\varphi }}, q_{\varphi })\), where \(T_\varphi \) is the set of bound variables in \(\varphi \), and \({\le _{\varphi }}\) and \(q_{\varphi }\) are defined recursively:

  • If \(\varphi \) is either \(\top \), \(\bot \) or \(x \in X\), then \({\le _{\varphi }} = \emptyset \) and \(q_{\varphi } = \emptyset \).

  • If \(\varphi = \lnot \varphi _0\) where \(\varphi _0 \in X \cup \{ \top , \bot \}\), then \({\le _{\varphi }} = \emptyset \) and \(q_{\varphi } = \emptyset \).

  • If \(\varphi = \varphi _1 \circ \varphi _2\) with \({\circ } \in \{ {\wedge }, {\vee }\}\), then \(\le _{\varphi } = \le _{\varphi _1} \cup \le _{\varphi _2}\) and \(q_{\varphi } = q_{\varphi _1} \cup q_{\varphi _2}\).

  • If \(\varphi = \textsf{Q}x. \varphi _0\) for a quantifier \(\textsf{Q}\), then \(\le _{\varphi } = \le _{\varphi _0} \cup \{(x, y) \mid y \in T_\varphi \}\) and \(q_{\varphi } = q_{\varphi _0} \cup \{ (x, \textsf{Q}) \}\).

Proposition 2

Let \((T_\varphi , {\le _{\varphi }}, q_{\varphi })\) be a quantifier forest of QBF \(\varphi \). If \(\varphi = \textsf{Q}x.\varphi _0\) for a quantifier \(\textsf{Q}\), then \((T_\varphi , {\le _{\varphi }}, q_{\varphi })\) is a quantree.

Example 2

Figure 1 shows the quantree associated to the QBF \(\eta \) from Example 1. In general, we can only guarantee that the quantifier forest associated to a QBF is a tree when the QBF is of the form \(\textsf{Q}x.\varphi \). For example, the quantifier forest associated with \((\forall x. x) \wedge (\exists y.y)\) is a forest with two incomparable elements x and y.

4.1 Linearizations over Quantrees

We now formalize the main object of this paper, namely the different ways the quantifiers in a formula can be rearranged into a quantifier prefix to an equivalent prenex formula. Given a QBF of the form \(\textsf{Q}x.\varphi \) for a quantifier \(\textsf{Q}\), we consider its associated quantree T. We aim to construct an equivalent prenex QBF \(\textsf{Q}^1 V_i.\dots \textsf{Q}^N V_N.{\varphi }_{\textrm{psk}}\) where \(\textsf{Q}^i \ne \textsf{Q}^{i + 1}\) for \(1 \le i < N\). To do so, each node in T (i.e. each bound variable in \(\textsf{Q}x.\varphi \)) must be mapped to a single quantifier block \(\textsf{Q}^i V_i\). We call this i its rank. However, as shown in Example 1, assigning arbitrary ranks is unsound (i.e. the obtained prenex QBF is not equivalent to \(\textsf{Q}x.\varphi \)). We show how bound variables can be ranked while preserving soundness.

Let us consider an arbitrary quantree T. A map \(f: T \rightarrow \{1,\dots ,N\}\) for some \(N \ge 0\) is called a linearization if:

  1. 1.

    \(f(x) \le f(y)\) for all quantree nodes \(x, y \in T\) with \(x \le y\).

  2. 2.

    For all quantree nodes \(x \in T\), f(x) is odd if and only if \({q}^{\star }(x) = 1\).

Consider now a QBF of the form \(\textsf{Q}y. \varphi \) where \(\textsf{Q}\) is a quantifier and y is a variable, and its associated quantree \((T, \le , q)\). In this case, since T is the set of bound variables in \(\textsf{Q}y. \varphi \), a linearization \(f: T \rightarrow \{1, \dots , N\}\) maps each bound variable \(x \in T\) to an integer f(x) we call its rank. A QBF \(\psi \) is called a prenexation of \(\textsf{Q}y.\varphi \) via f if \(\psi \) is of the form \(\textsf{Q}^1 V_1.\dots \textsf{Q}^N V_N.{\varphi }_{\textrm{psk}}\) where \(V_i = \{ x \in T \mid f(x) = i \}\) and \(\textsf{Q}^i = \textsf{Q}\) (resp. \(\overline{\textsf{Q}}\)) if i is odd (resp. even) for \(1 \le i \le N\).

Fig. 1.
figure 1

Above, the quantree associated to the formula \(\eta \) from Example 1. Below, optimal linearizations for this quantree for each strategy. In each column, the variables mapped to each rank are shown; the quantifier of each block appears in the header. Note that the optimal linearizations for strategies \({\textsf{Q}}{\dagger }{\uparrow }\) and \({\textsf{Q}}{\dagger }{\downarrow }\) assign the same rank to \(\textsf{Q}\)-quantified variables; this is a consequence of Lemma 2.

Theorem 1

Let T be the quantree associated to a QBF of the form \(\textsf{Q}y.\varphi \). Consider a prenexation \(\psi \) of \(\textsf{Q}y.\varphi \) via some linearization \(f: T \rightarrow \{1,\dots ,N\}\). Then \(\textsf{Q}y.\varphi \) is equivalent to \(\psi \).

To guarantee this form \(\textsf{Q}y.\varphi \) for an arbitrary QBF \(\varphi \), we can simply introduce a fresh variable y that does not occur in \(\varphi \). Obviously, \(\varphi \) is equivalent to \(\textsf{Q}y.\varphi \).

Example 3

Figure 1 shows six linearizations for the quantree associated to the QBF \(\eta \) from Example 1 and Example 2. In that example, the quantifier shift \(\eta '\) is the prenexation of \(\eta \) via the linearization \(f_1\). Note that the mapping f that would produce \(\eta ''\) is not a linearization, since that would violate Theorem 1. In particular, \(u_1 \le v_1\) but \(f(v_1) < f(u_1)\).

4.2 Alternation Height of Quantrees

So far we have not shown that linearizations even exist. Given the theoretical and empirical impact of the number of quantifier alternations on QBF solving, we are not just interested in their existence, but rather on linearizations that minimize the maximum rank N. We will now show how to compute the minimal value of N for which linearizations exist; in fact, this value will be extremely useful to extend the ideas from [6] to arbitrary QBFs in Sect. 5.2.

Consider an arbitrary quantree T, and a path \(x_1,\dots ,x_n\) in T. We call this path alternating whenever \(q(x_i) \ne q(x_{i+1})\) for \(1 \le i < n\). Then we can define the alternation height of T as

$$\begin{aligned} \textrm{aht}(T) = \max \{ n \ge 0 \mid \text {there is an alternating path }x_1, \dots , x_n\text { in }T \}\text {.} \end{aligned}$$

Intuitively, the alternation height of T is the height of the tree that results from “clumping” together all adjacent nodes with the same quantifier. It then becomes apparent that any linearization f over T must have \(N \ge \textrm{aht}(T)\), since for any alternating path \(x_1,\dots ,x_n\) we have \(f(x_1) < \dots < f(x_n)\). The following result shows that this lower bound can indeed be realized:

Theorem 2

Let T be a quantree. Then, a linearization \(f: T \rightarrow \{1,\dots ,\textrm{aht}(T)\}\) exists. Furthermore, there exists no linearization \(g: T \rightarrow \{1,\dots , N\}\) such that \(0 \le N < \textrm{aht}(T)\).

Observe that the number of quantifier alternations in a prenexation via a linearization grows with the value N. In the following sections, we will restrict our scope to linearizations that minimize this value, i.e. linearizations in the set

$$\begin{aligned} \textrm{Lin}(T) = \{ f: T \rightarrow \{1, \dots , N\} \mid f\text { is a linearization and }N = \textrm{aht}(T) \}\text {.} \end{aligned}$$

5 Linearization Strategies

We now follow up on the ideas from [6] and formalize them. In particular, we aim to obtain a formal definition of when does a linearization follow a given strategy, to ascertain whether strategies determine a unique linearization for each quantree, and to find simple algorithms to compute this linearization.

5.1 Strategies as Preferences over Linearizations

Here we take a non-constructive approach. For each prenexing strategy, we define a preference relation between the linearizations in \(\textrm{Lin}(T)\); linearizations that follow the strategy “better” than others are preferred. As we will show, this induces a strategy-based partial order between linearizations. The desired output of a strategy must then be a maximal element w.r.t. this partial order.

The strategies from [6] are based on the idea of pushing quantifiers of a given polarity as high or as low as possible in the quantifier hierarchy. This lends itself to a natural definition of preference.

Consider an arbitrary quantree T. Given a direction \(\dagger \in \{{\uparrow },{\downarrow }\}\) and a quantifier \(\textsf{Q}\), we define the semi-preference relation \({\mathrel {\precsim ^{{\textsf{Q}}{\dagger }}}}\) over \(\textrm{Lin}(T)\) given by \(f \mathrel {\precsim ^{{\textsf{Q}}{\dagger }}} g\) iff \(f(x) \mathrel {\le ^{\dagger }} g(x)\) for all \(x \in T\) with \(q(x) = \textsf{Q}\). In other words, g is preferred over f whenever g assigns ranks to \(\textsf{Q}\)-nodes further in the direction \(\dagger \) than f does.

Example 4

Consider the linearizations \(f_1, f_2\) and \(f_6\) from Fig. 1. All universal variables are assigned lower ranks by both \(f_1\) and \(f_2\) than by \(f_6\), so \(f_6 \mathrel {\precsim ^{{\forall }{\downarrow }}} f_1\) and \(f_6 \mathrel {\precsim ^{{\forall }{\downarrow }}} f_2\) hold. Note also that \(f_1\) and \(f_2\) assign the same ranks to universal variables, so both \(f_1 \mathrel {\precsim ^{{\forall }{\downarrow }}} f_2\) and \(f_2 \mathrel {\precsim ^{{\forall }{\downarrow }}} f_1\) hold. Note that this does not imply \(f_1 = f_2\).

Example 4 shows that the antisymmetric property of partial orders does not hold for \({\mathrel {\precsim ^{{\textsf{Q}}{\dagger }}}}\). This is intuitive: two linearizations might be just as good as each other regarding \(\textsf{Q}\)-nodes, while wildly differing for other nodes. Hence, for strategies to uniquely determine linearizations we need to provide preferences for both quantifiers. While this was proposed by [6], it was also noted there that uniqueness is not attained.

Example 5

The linearizations \(f_2\) and \(f_3\) from Fig. 1 are both good candidates for linearizations for the strategy \(\exists ^{\downarrow }\forall ^{\uparrow }\) from [6]: both assign high ranks to existential variables and low ranks to universal variables. However, there is no apparent criterion why \(f_2\) should or should not be preferred to \(f_3\) under that strategy.

We solve this problem by giving one quantifier priority over the other. Our strategies are of the form \({\textsf{Q}}{\dagger }{\ddagger }\), where \(\textsf{Q}\) is a quantifier and \(\dagger , \ddagger \) are directions. A good linearization under this strategy pushes quantifiers \(\textsf{Q}\) in the \(\dagger \) direction, and quantifiers \(\overline{\textsf{Q}}\) in the \(\ddagger \) direction; when in conflict, the former should prevail.

To formalize this idea, we liberally borrow from the somewhat similar notion of lexicographic orderings. Let us define \(f \mathrel {\approx ^{\textsf{Q}}} g\) whenever \(f(x) = g(x)\) for all \(x \in T\) with \(q(x) = \textsf{Q}\). In other words, \(f \mathrel {\approx ^{\textsf{Q}}} g\) holds whenever both \(f \mathrel {\precsim ^{{\textsf{Q}}{\dagger }}} g\) and \(g \mathrel {\precsim ^{{\textsf{Q}}{\dagger }}} f\) hold, regardless of the choice of direction \(\dagger \). We define the preference relation \({\mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}}}\) over \(\textrm{Lin}(T)\) given by \(f \mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}} g\) iff \(f \mathrel {\precsim ^{{\textsf{Q}}{\dagger }}} g\) holds, and whenever \(f \mathrel {\approx ^{\textsf{Q}}} g\) holds then \(f \mathrel {\precsim ^{{\overline{\textsf{Q}}}{\ddagger }}} g\) holds as well.

Proposition 3

\({\mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}}}\) defines a partial order on \(\textrm{Lin}(T)\).

It is easy to check that \({\mathrel {\preccurlyeq ^{{\forall }{\dagger }{\dagger }}}}\) and \({\mathrel {\preccurlyeq ^{{\exists }{\dagger }{\dagger }}}}\) are the same preference relation for \(\dagger \in \{ \uparrow , \downarrow \}\). Hence, our approach defines 6 unique strategies, while [6] only proposed 4 strategies. On the one hand, the \({\exists ^{\dagger }}{\forall ^{\dagger }}\) strategy from [6] corresponds to our \({\exists }{\dagger }{\dagger }\) (or, equivalently, \({\forall }{\dagger }{\dagger }\)) strategy. On the other hand, our strategies \({\exists }{\dagger }{\ddagger }\) and \({\forall }{\ddagger }{\dagger }\) with \(\dagger \ne \ddagger \) are both covered by the \({\exists ^{\dagger }}{\forall ^{\ddagger }}\) strategy from [6], which is not uniquely determined.

Example 6

Although we cannot yet convince the reader of this, the linearizations given in Fig. 1 are the maximum element of \(\textrm{Lin}(T)\) for each of the six (unique) preference orderings \(\mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}}\); the corresponding strategy is shown in the rightmost column. For now, we can foreshadow that strategies \({\textsf{Q}}{\dagger }{\uparrow }\) and \({\textsf{Q}}{\dagger }{\downarrow }\) assign the same ranks to \(\textsf{Q}\)-nodes. As shown later in Lemma 1, this holds in general.

5.2 Optimal Linearizations over a Strategy

Proposition 3 suggests this is a good direction to formalize the idea of strategies: since \(\textrm{Lin}(T)\) is finite, there exist optimal linearizations w.r.t. the preference ordering \({\mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}}}\). We call these linearizations \({\textsf{Q}}{\dagger }{\ddagger }\)-optimal; linearizing a quantree T through the strategy \({\textsf{Q}}{\dagger }{\ddagger }\) then means computing a \({\textsf{Q}}{\dagger }{\ddagger }\)-optimal linearization in \(\textrm{Lin}(T)\).

Some hurdles remain unsolved, though. For one, we have not determined if \({\textsf{Q}}{\dagger }{\ddagger }\)-optimal linearizations are unique (i.e. if maximal elements w.r.t. \({\mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}}}\) are maxima as well). This is of interest because to empirically test the performance effect of quantifier shifting strategies, the outcome of applying a strategy must be reproducible at worst, and uniquely determined by definition at best. A second issue is a consequence of our non-constructive approach: we are yet to provide a procedure that computes a \({\textsf{Q}}{\dagger }{\ddagger }\)-optimal linearization for a given quantree.

The rest of this section is devoted to computing a closed-form expression for \({\textsf{Q}}{\dagger }{\ddagger }\)-optimal linearizations. Since this expression is deterministic and computable, this solves both aforementioned issues.

Overview. As we mentioned above, \(\mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}}\) is somewhat similar to a lexicographic ordering in two components where the first component is ordered by \(\mathrel {\precsim ^{{\textsf{Q}}{\dagger }}}\) and the second component is ordered by \(\mathrel {\precsim ^{{\overline{\textsf{Q}}}{\ddagger }}}\). We exploit this intuition to construct \({\textsf{Q}}{\dagger }{\ddagger }\)-optimal linearizations: we will first optimize the first component (in our case, the ranks of \(\textsf{Q}\)-nodes), and then optimize the second component (the ranks of \(\overline{\textsf{Q}}\)-nodes) while keeping the first component fixed.

To optimize the first component, we find a linearization \(\varGamma _{\dagger }\), defined below in (1), that is optimal for \(\mathrel {\precsim ^{{\textsf{Q}}{\dagger }}}\). This is more precisely expressed in Lemma 1: \(\varGamma _{\dagger }\) pushes \(\textsf{Q}\)-nodes further in direction \(\dagger \) than any other linearization.

Interestingly, \(\varGamma _{\dagger }\) does not depend on \(\textsf{Q}\): \(\varGamma _{\dagger }\) actually optimizes all nodes in the \(\dagger \) direction. The second part of our method optimizes the ranks assigned to \(\overline{\textsf{Q}}\)-nodes in the \(\ddagger \) direction while keeping \(\textsf{Q}\)-nodes constant. For a general linearization f, this procedure results in a new linearization \(\mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}}\) defined below in (2). Lemma 2 shows that \(\mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}}\) is optimal for \(\mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}}\) among the linearizations that assign the same ranks as f to \(\textsf{Q}\)-nodes. These two results are combined in Theorem 3: the unique \({\textsf{Q}}{\dagger }{\ddagger }\)-maximal linearization is \(\mathord {\left[\varGamma _{\dagger }\right]^{{\textsf{Q}}{\ddagger }}}\).

Theoretical Results. Let us consider a quantree \((T, \le , q)\) and a strategy \({\textsf{Q}}{\dagger }{\ddagger }\). We define the mapping \(\varGamma _{\dagger }: T \rightarrow \{ 1, \dots , \textrm{aht}(T) \}\) given by

$$\begin{aligned} \varGamma _{\dagger }(x) = \left\lfloor |{\max }^{\dagger }\{1,\dots ,\textrm{aht}(T)\} - \textrm{aht}(T_{x}^{\dagger }) |+ 1\right\rfloor _{{q}^{\star }(x)}^{\dagger }\text {.} \end{aligned}$$
(1)

Furthermore, we define the mapping \(\mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}}: T \rightarrow \{ 1, \dots , \textrm{aht}(T) \}\) for \(f \in \textrm{Lin}(T)\) given by

$$\begin{aligned} \mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}}(x) = \left\lfloor {\min }^{\ddagger }\{ f(y) \mid y \in T_{x}^{\ddagger } \text { and } q(y) = \textsf{Q}\}\right\rfloor _{{q}^{\star }(x)}^{\ddagger }\text {.} \end{aligned}$$
(2)

In (2), \({\min }^{\ddagger }\) is taken over a subset of \(\{ 1, \dots , \textrm{aht}(T) \}\); we follow the convention that \({\min }^{\ddagger }(\emptyset ) = {\max }^{\ddagger }\{ 1, \dots , \textrm{aht}(T) \}\).

Lemma 1

\(\varGamma _{\dagger } \in \textrm{Lin}(T)\). Furthermore, for any \(g \in \textrm{Lin}(T)\), we have \(g \mathrel {\precsim ^{{\textsf{Q}}{\dagger }}} \varGamma _{\dagger }\).

Lemma 2

\(\mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}} \in \textrm{Lin}(T)\) for all \(f \in \textrm{Lin}(T)\). Furthermore, \(\mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}} \mathrel {\approx ^{\textsf{Q}}} f\), and for any \(g \in \textrm{Lin}(T)\) with \(g \mathrel {\approx ^{\textsf{Q}}} f\), we have \(g \mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}} f\).

Theorem 3

Let \(f \in \textrm{Lin}(T)\) be a \({\textsf{Q}}{\dagger }{\ddagger }\)-optimal linearization. Then, \(f = \mathord {\left[\varGamma _{\dagger }\right]^{{\textsf{Q}}{\ddagger }}}\). In particular, \(\mathord {\left[\varGamma _{\dagger }\right]^{{\textsf{Q}}{\ddagger }}}\) is the maximum element in \((\textrm{Lin}(T), \mathrel {\preccurlyeq ^{{\textsf{Q}}{\dagger }{\ddagger }}})\).

Example 7

Let us check that \(\mathord {\left[\varGamma _{\downarrow }\right]^{{\exists }{\uparrow }}}\) is indeed \(f_3\) for the quantree in Fig. 1 for a few values. First note that \(\mathord {\left[\varGamma _{\downarrow }\right]^{{\exists }{\uparrow }}}\) only depends on the values of \(\varGamma _{\downarrow }\) for existential nodes, so we only need to compute these. In this case, \({\max }^{\dagger }\{1,\dots ,\textrm{aht}(T)\} = \textrm{aht}(T) = 5\), \({q}^{\star }(x) = 1\), and \(\textrm{aht}(T_{x}^{\downarrow }) = \textrm{aht}(T_{x})\) is simply the maximum number of quantifier alternations below x. \(\varGamma _{\downarrow }\) respects the tree ordering, so we obtain

$$\begin{aligned} \mathord {\left[\varGamma _{\downarrow }\right]^{{\exists }{\uparrow }}}(z_1) = \varGamma _{\downarrow }(z_1) = \left\lfloor |5 - \textrm{aht}(T_{z_1})|+ 1\right\rfloor _{1} = \left\lfloor 4\right\rfloor _{1} = 3 = f_3(z_1)\text {.} \end{aligned}$$

Furthermore, we can compute \(\mathord {\left[\varGamma _{\downarrow }\right]^{{\exists }{\uparrow }}}(u_1)\) by checking only \(\varGamma _{\downarrow }(z_1)\), since \(z_1\) realizes the \(\min ^\uparrow \) operator in (2). Then,

$$\begin{aligned} \mathord {\left[\varGamma _{\downarrow }\right]^{{\exists }{\uparrow }}}(u_1) = \left\lceil \varGamma _{\downarrow }(z_1)\right\rceil _{{q}^{\star }(u_1)} = \left\lceil 3\right\rceil _{0} = 4 = f_3(u_1)\text {.} \end{aligned}$$

Example 7 suggests that \(\mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}}\) can be computed recursively. Indeed, the rank of a node can be computed based on the ranks of its children or parent.

Corollary 1

Let \(x \in T\) such that \(q(x) \ne \textsf{Q}\). Then,

$$\begin{aligned} \mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}}(x) = \left\lfloor {\min }^{\ddagger }\{ \mathord {\left[f\right]^{{\textsf{Q}}{\ddagger }}}(y) \mid x \text { is covered by } y \in T \text { w.r.t.\ }{\mathrel {\le ^{\ddagger }}} \}\text {.} \right\rfloor _{{q}^{\star }(x)}^{\ddagger } \end{aligned}$$

6 Implementation and Evaluation

We implemented the optimal linearization \(\mathord {\left[\varGamma _{\dagger }\right]^{{\textsf{Q}}{\ddagger }}}\) for each strategy \({\textsf{Q}}{\dagger }{\ddagger }\) described in Sect. 5. Our implementation uses the Booleguru framework [10], designed for efficiently working with propositional formulas and QBFs. Booleguru provides a convenient parsing and serialization infrastructure for widely used formats, as well as helper functions to write formula transformations. Our extension is licensed under the MIT license and publicly availableFootnote 2.

Our implementation computes a quantifier shift on an input QBF \(\varphi \) based on a strategy \({\textsf{Q}}{\dagger }{\ddagger }\) by traversing twice the abstract syntax tree of the parsed QBF \(\varphi \) in a depth-first fashion. In the first pass, the propositional skeleton \({\varphi }_{\textrm{psk}}\) and the quantree T are extracted. Furthermore, the values \(\textrm{aht}({T}^{x})\) and \(\textrm{aht}(T_{x})\), which we call height and depth of x, are computed for each node \(x \in T\).

The second pass is applied only to the quantree. For each node \(x \in T\), we compute its rank \(\mathord {\left[\varGamma _{\dagger }\right]^{{\textsf{Q}}{\ddagger }}}(x)\). For \(\textsf{Q}\)-nodes, this rank is given by \(\varGamma _{\dagger }(x)\), which is trivial to compute from the height and depth of x; for \(\overline{\textsf{Q}}\)-nodes, Corollary 1 allows a recursive computation. Based on their rank, quantifier nodes in the quantree are collected in a quantifier prefix which is appended to \({\varphi }_{\textrm{psk}}\).

To apply a linearization strategy to an arbitrary formula, Booleguru needs to be called with the options :linearize-quants-{E,A}{up,down}-{up,down} using the quantifier E (\(\exists \)) or A (\(\forall \)) and the two directions up (\(\uparrow \)) and down (\(\downarrow \)). Overall, there are eight different combinations that we evaluate in the following. However, from the discussion above, it becomes obvious that only six of those eight strategies are different. In the implementation, all quantifiers are first extracted from an expression and processed in a separate tree. Each node contains the quantifier type, the quantified variables, and dependent quantifier nodes.

After computing the linearization, the extracted quantifiers are inserted piecewise as new expressions that wrap the originally transformed expression. This ensures the ordering of variables within the quantifier blocks stays the same. The fully quantified expression is then returned from the transformer and can either be printed using one of Booleguru’s serializers, or processed further.

6.1 Benchmarks

As most solvers only process formulas in prenex (conjunctive) normal form, hardly any non-prenex benchmarks are currently available. To test our implementation, we considered the benchmark set from the QBFEval 2008 and we reimplemented a generator for nested counterfactuals as described below. All used formulas and corresponding experimental logs are available at [11].

Nested Counterfactuals. We developed a novel generator for nested counterfactuals (NCFs) based on a Lua script, which is integrated into Booleguru. The full encoding is described in [6]. To generate NCFs, five arguments must be provided: numbers of formulas in the background theory, numbers of variables, clauses per formula, variables per clause, nesting depth. Optionally, a sixth argument to fix the seed value for random choices. A counterfactual \(\phi > \psi \) is true over a background theory T iff the minimal change of T to incorporate \(\phi \) entails \(\psi \). In a nested counterfactual, also \(\phi \) or \(\psi \) are allowed to be (nested) counterfactuals. For details see [6]. We chose the range of arguments based on the description mentioned in Egly et al. [6]. We assume that the background theory T always consists of 5 randomly generated formulas. Each of these formulas consists of 2 to 10 clauses where each clause is a disjunction of 3 variables. The clauses contain randomly chosen atoms from a set of 5 variables. These atoms have a 50 percent chance of being negated. No clause may contain the same literal more than once and the clauses are non-tautological. The nesting depth of the counterfactuals ranges from 2 to 6. All possible combinations of these selected parameters result in 45 different classes. For each of these classes, 100 instances were generated to ensure that both, satisfiable and unsatisfiable results are represented. With the 8 strategies we obtain \({36\,000}\) prenexed formulas either in the non-CNF QCIR format or in QDIMACS.

Non-Prenex-Non-CNF Benchmarks from QBFEval 2008. In the QBFEval 2008, a non-prenex, non-CNF track was organized [19]. The benchmarks are available at the QBFLib.Footnote 3. This set consists of 492 formulas in the outdated Boole format. To transform these formulas into prenex form, we first rewrote them into the related LimbooleFootnote 4 format that is processable by Booleguru. Again, we considered all eight options resulting in 4936 prenexed formulas.

6.2 Experimental Setup

All experiments were run with a timeout of 15 minutes on a cluster of dual-socket AMD EPYC 7313 @ 3.7 GHz machines running Ubuntu 22.04 with a 8 GB memory limit per task. We split the experiments into two parts: on the one hand, we consider solvers that process formulas in prenex conjunctive normal form (PCNF) and on the other hand, we consider solvers that process formulas in prenex non-CNF. For the first group of solvers that accept formulas in the QDIMACS format, we consider the following solvers: The solver DepQBF (version 6.03) is a conflict/solution driven clause/cube learning (QCDCL) solver that integrates several advanced inprocessing techniques and reasoning under the standard dependency scheme [17]. Also Qute [21] is a QCDCL solver that employs dynamic dependency learning. This solver is also able to process QCIR formulas, i.e., it is also included in the second group. The solver CAQE [25] (version 4.0.2) implements clausal selection. The solver RAReQS [14] (version 1.1) implements variable expansion in CEGAR style. Finally, dynQBF [4, 5] (version 1.1.1) is a BDD-based solver. For pre-processing, we used Bloqqer [3] and HQSpre [31]. For testing the encodings in the non-CNF QCIR format, we include the solvers QuAbS [9, 29] and CQESTO [13] (version v00.0) (sic) that lift clausal selection to circuits, QFUN [12] (version v00.0) (sic), a solver that employs machine learning techniques, and Qute which was already mentioned above.

6.3 Experimental Results

In the following, we first discuss the results of the solvers that process formulas in QCIR, (i.e. formulas in prenex form but not in CNF). Second, we report on our experiments with QDIMACS formulas for the PCNF solvers.

Table 1. Number of solved formulas per strategy and solver of QBFEval’08 set (QCIR). Diff indicates the difference between the best and the worst strategy. Each strategy has 492 formulas.
Table 2. Number of different prefixes generated from of the 2008 non-CNF benchmark set with all strategy combinations. Each strategy has 492 formulas.
Fig. 2.
figure 2

Solving time of the QBFEVAL’08 set with QFUN (left) and CQESTO (right).

Prenexed formulas in QCIR. The nested counterfactual benchmarks were easily solved by QCIR solvers, i.e., they could exploit the formula structure to quickly solve these formulas (all were solved in less than a second). Therefore, we focus on the formulas of the QBFEval’08 benchmark set in the following. Table 1 shows the results for the QCIR solvers and Table 2 shows the number of different prefixes that were generated with all strategy combinations. For QuAbS, QFUN, and CQESTO we see a clear difference between the best and worst shifting strategy. In contrast, Qute seems to be less sensitive regarding the prenexing, which might be related to its dynamic dependency learning. The detailed solving behavior of QFUN and CQESTO is shown in Fig. 2. For QFUN we observe that \({\exists }{\uparrow }{\uparrow }\) and \({\forall }{\uparrow }{\uparrow }\) clearly perform best, while \({\forall }{\downarrow }{\uparrow }\) and \({\exists }{\uparrow }{\downarrow }\) seem to be less beneficial.

Table 3. Number of solved formulas per strategy and solver of NCFs. Diff indicates the difference between the best and the worst strategy. Each strategy has 4500 formulas.
Table 4. Number of different prefixes generated from of the NCF benchmark set with all strategy combinations. Each strategy has 4500 formulas.
Fig. 3.
figure 3

Solving time of nested counterfactuals with DepQBF (left) and dynQBF (right).

Prenexed Formulas in QDIMACS. Table 3 shows the results of the QDIMACS solvers on the encodings of the nested counterfactuals and Table 4 shows the number of different prefixes that were generated between all strategy combinations. DepQBF solves all formulas from 4 of the 8 strategies and most of the others, dynQBF is able to solve most of the formulas and Qute solves about one quarter of the formulas. Meanwhile RAReQS and CAQE hardly solve any of those. These could be connected with the observation that those solvers perform better on formulas with few quantifier alternations. For all solvers we observe that the chosen shifting strategy impacts the number of the solved formulas. Details of the runs of DepQBF and dynQBF are shown in Fig. 3. For DepQBF, we observe that strategies \({\exists }{\downarrow }{\downarrow }\) and \({\forall }{\downarrow }{\downarrow }\) are clearly less preferable than strategies \({\exists }{\uparrow }{\uparrow }\) and \({\forall }{\uparrow }{\uparrow }\), while dynQBF prefers to have existential quantifiers shifted down. The QBFEval’08 benchmarks are very challenging for recent QDIMACS solvers with our encoding. Out of the 492 formulas, DepQBF solves up to 128 formulas with the best strategy (\({\forall }{\downarrow }{\uparrow }\)). dynQBF solves around 60 formulas. The other tools solve less than 30 formulas. Enabling preprocessing is beneficial for all solvers. When preprocessors Bloqqer or HQSpre simplify the formulas, then almost all formulas can be solved. With and without preprocessing, the shifting strategies have only little impact on this benchmark set. Note that more than two third of these formulas have five or less quantifier alternations.

7 Conclusion and Future Work

This paper analyzes and extends previous work from 2003 on quantifier shifting for quantified Boolean formulas. Since then, much progress has been made in the development of QBF solvers by introducing novel solving paradigms, applying efficient preprocessing techniques, and exploiting quantifier (in-)dependence. However, most of those approaches assume formulas in prenex normal form. As a consequence, most encodings are provided in this form, which unnecessarily restricts solvers with a certain design choice. In this work, we not only formalized prenexing in a concise manner, but we also provide an efficient, publicly available tool that implements the discussed prenexing strategies and Tseitin transformation. In extensive experiments with state-of-the-art prenex CNF and non-CNF solvers, we showed that in many instances prenexing strategy selection impacts solving runtime. We showed that different solvers perform differently on different strategies, hence it was not possible to uniquely identify the best strategy. Therefore, we think it is important that solver developers and also the developers of QBF encodings exploit information available in the problem structure and do not introduce artificial restrictions.

In future work, we plan to design and evaluate further prenexing strategies and we will also revisit more non-prenex QBF encodings to obtain larger benchmark sets. At the moment, hardly any formulas in non-prenex form are available which we changed by providing the generator for encodings of nested counterfactuals. But this is a first step only. Many of the considered formulas are either too hard or too easy for recent solvers, hence more effort is necessary to obtain a larger variety of interesting benchmarks (also in the light of next QBF evaluations). Finally, we want to explore how prenexing strategies affect the generation of certificates and solutions in terms of Herbrand and Skolem functions. From first-order logic, it is well known that it is beneficial to move quantifiers as far inwards as possible to minimize the arity of the first-order Skolem functions [20].