key: cord-0046703-qg43oamv authors: Schlaipfer, Matthias; Slivovsky, Friedrich; Weissenbacher, Georg; Zuleger, Florian title: Multi-linear Strategy Extraction for QBF Expansion Proofs via Local Soundness date: 2020-06-26 journal: Theory and Applications of Satisfiability Testing - SAT 2020 DOI: 10.1007/978-3-030-51825-7_30 sha: 56f450ca3a144d4154724993a827a697d25491f7 doc_id: 46703 cord_uid: qg43oamv In applications, QBF solvers are expected to not only decide whether a given formula is true or false but also return a solution in the form of a strategy. Determining whether strategies can be efficiently extracted from proof traces generated by QBF solvers is a fundamental research task. Most resolution-based proof systems are known to implicitly support polynomial-time strategy extraction through a simulation of the evaluation game associated with an input formula, but this approach introduces large constant factors and results in unwieldy circuit representations. In this work, we present an explicit polynomial-time strategy extraction algorithm for the [Formula: see text] proof system. This system is used by expansion-based solvers that implement counterexample-guided abstraction refinement (CEGAR), currently one of the most effective QBF solving paradigms. Our argument relies on a Curry-Howard style correspondence between strategies and [Formula: see text] derivations, where each strategy realizes an invariant obtained from an annotated clause derived in the proof system. Continued improvements in the performance of satisfiability (SAT) solvers [14] are enabling a growing number of applications in areas such as electronic design automation [35] . At the same time, many of the underlying problems are hard for complexity classes beyond NP and as such cannot be expected to have succinct propositional encodings. Super-polynomial growth in encoding size imposes a limit on the problem instances that can be feasibly solved even with extremely efficient SAT solvers. Decision procedures for more succinct languages such as Quantified Boolean Formulas (QBFs) represent a potential solution to this scaling issue. QBFs extend propositional formulas with quantification over truth values and support more succinct encodings for a range of problems [32] . Recent years have seen significant advancements in QBF solver technology [20, 21, 25, 26, 29, 30, 34, 36] , up to a point where reduction to QBF can be more efficient than reduction to SAT [13] . In some applications, QBF solvers are required to not only decide whether a given formula is true or false but also compute a solution in the form of a strategy. For example, if a synthesis problem is encoded as a QBF, a solver is expected to either return the synthesized program or an explanation why the specification cannot be satisfied [13] . Determining whether the proof trace of a QBF solver can be efficiently transformed into a strategy-whether the proof system supports polynomial-time strategy extraction-is a fundamental research task [2, 3, 6, 10, 27] . One of the most successful QBF solving paradigms relies on partial Shannon expansion [1, 8] of universal variables within a counterexample-guided abstraction refinement (CEGAR) loop, as implemented in RAReQS [21] , and, more recently, in Ijtihad [9] and QFun [20] . The underlying proof system ∀-Exp+Res [22] offers exponentially shorter proofs for certain classes of formulas than Qresolution [6] , and can polynomially simulate Q-resolution on formulas with few quantifier alternations [4] , which includes many practically relevant cases. 1 Polynomial-time strategy extraction follows from the fact that ∀-Exp+Res proofs can be used to guide the universal player in an evaluation game [6, 11] , but turning this argument into circuits that compute a winning strategy is rather inefficient. An explicit construction based on this idea for Q-resolution requires the introduction of several gates for each literal in the proof and quantifier level of the input formula [27] , leading to unwieldy circuits that are substantially larger than the original proof. In this work, we present a strategy extraction algorithm for ∀-Exp+Res that is multi-linear in the number of proof steps and universal variables. This is asymptotically optimal for a construction that follows the structure of the proof and maintains a circuit for each universal variable. Our algorithm is inspired by [33] , which for the first time has given a local soundness argument for ∀-Exp+Res. [33] constructs partial strategies along the ∀-Exp+Res-proof and provides a semantic abstraction that relates the constructed strategies to the clauses in the proof. In contrast, we associate a full strategy to each node in the ∀-Exp+Res-proof and develop a syntactic argument that ensures the soundness of the construction. For each clause in the proof, we define a propositional invariant that corresponds to a syntactic weakening of the input formula's negated matrix. We then show that strategies satisfying the invariants for the premises of a resolution step can be combined into a strategy that satisfies the invariant for the resolvent. The main technical challenge we had to overcome in deriving this syntactic weakening is that ∀-Exp+Res proofs work over an extended propositional alphabet where multiple versions of the same variable with different annotations may exist simultaneously. Our invariant translates the propositions from the extended alphabet back to formulas over the original vocabulary. We believe that our syntactic soundness argument is more transparent than the semantic construction from [33] . The clarity of the argument is also what allows us to obtain a concise circuit representation of the resulting strategy. Further, our syntactic argument establishes a Curry-Howard correspondence between proof construction and strategy extraction. For each inference rule combining proof terms, the correspondence provides a rule combining program terms. The result is a program isomorphic to the proof. The widest-known correspondence is between natural deduction proofs and lamba-calculus programs [18] . In this paper we establish a precise correspondence between ∀-Exp+Res-proofs and strategies-the strategy constructed for a node in the proof DAG satisfies the invariant for the clause derived at that node. In contrast, the correspondence stays implicit in the semantic argument from [33] . We expect that our ideas of obtaining such an invariant by weakening the matrix and translating the clauses over the extended alphabet back to a formula over the original variables will have applications in studying further Curry-Howard correspondences for other resolution-based QBF proof systems. Quantified Boolean Formulas (QBFs). We consider quantified Boolean formulas (QBFs) with standard propositional connectives ∧, ∨, ¬, ⇔, ⊕, and quantifiers ∀, ∃. We denote existentially quantified variables by x and y, and universally quantified variables by u. Variables range over B = {0, 1}. A literal l is a variable x or its negation ¬x. We write x for a set of variables or literals. A clause is a disjunction of literals, and a propositional formula in conjunctive normal form is a conjunction of clauses. We write for the empty clause. Throughout the paper, QBFs are assumed to be in prenex conjunctive normal form (PCNF). A PCNF formula Φ = Π.ϕ consists of a sequence Π = Q 1 v 1 . . . Q n v n with Q i ∈ {∀, ∃} for 1 ≤ i ≤ n, called the quantifier prefix of Φ, and a propositional formula ϕ in conjunctive normal form, called the matrix of Φ. We define a relation ≺ Π on variables from the quantifier prefix as v i ≺ Π v j whenever i < j. We extend ≺ Π to a relation on literals in the obvious way and drop the quantifier prefix Π from the subscript when it is clear from the context. We consider a proof system for false PCNF formulas known as ∀-Exp+Res [22] . This system combines instantiation of universal variables with propositional resolution. Instantiation leads to existential literals l τ that are annotated with an assignment τ : u l → B of the universal variables u l = {u | u ≺ l} that precede the variable of l in the quantifier prefix. Following Beyersdorff et al. [6] , we write l [τ ] = l {u →τ (u) | u≺l} to filter out assignments that are not permitted in the annotation of l. We sometimes treat an assignment τ : u → B in an annotation as a set of literals and write l ∈ τ if τ (l) = 1. We write C τ for a clause C with all its literals annotated with [τ ] . The proof rules of ∀-Exp+Res are shown in Fig. 1 . A ∀-Exp+Res proof of a PCNF formula Φ is a sequence of clauses ending with the empty clause such that each Here, C is a clause from the matrix and τ an assignment to all universal variables falsifying the universal literals of C. Both C1 and C2 are annotated clauses and x σ is an annotated variable. clause is derived either by universal expansion (∀-exp) or by resolution (res) from clauses appearing earlier in the sequence. A PCNF formula can be interpreted as the specification of a game between an existential and a universal player [31] . The game proceeds by the players assigning values to their respective variables in turn, following the order of the quantifier prefix. The goal of the universal player is to falsify the matrix, the goal of the existential player is to satisfy the matrix. Strategies for either player can be conveniently represented as binary trees. We write P = Str(v, P − , P + ) for a strategy P with root labeled by variable v and principal subtrees P − and P + such that the edge to the root of P − is labeled with 0 and the edge to the root of P + is labeled with 1. We use ∅ to denote the "empty" strategy and write P = Str(v, ∅, P + ) and P = Str(v, P − , ∅) to denote strategies with root nodes that only have a 1-child and a 0-child, respectively. In the next section, we will associate each clause C in a ∀-Exp+Res proof with a strategy P . For clauses C derived by the ∀-exp rule with assignment τ , the corresponding strategy simply sets the universal variables according to τ . Let Φ = Π.ϕ be a PCNF formula and τ an assignment of the universal variables of Φ. We define ConstStrat(Π, τ ) as the complete strategy for Φ where each assignment is consistent with τ . Example 1. The figure to the right shows the strategy We present a local soundness argument for ∀-Exp+Res using strategies. To this end, we will define a Combine operator that joins strategies along a derivation [33] . For each derived clause C, we will show that the strategy created for this clause by the Combine operator satisfies a propositional invariant obtained from C. Here, by a strategy P satisfying a formula ψ we mean that every assignment consistent with P satisfies ψ, which we will write as P |= ψ. 2 In this notation, we will show that where ϕ denotes the matrix and enc(C) translates the clause C back into a formula over the original variables of the QBF as The invariant enc(C) ⇒ ¬ϕ can be understood by considering the evaluation game: if the existential player responds to every universal play in an annotation by setting the literal to false, the current strategy is winning for the universal player. Ultimately, at the empty clause, enc( ) = 1 and the combined strategy turns into a winning strategy. We will now introduce the Combine operator that merges two strategies P and Q in a top-down manner and annotates each clause in a ∀-Exp+Res derivation with a strategy. We write C [P ] for a clause C annotated with strategy P . The definition of Combine as shown in Definition 4 is adapted from the definition of an operator defined by Suda and Gleiss [33] . Since we work with complete strategy trees (rather than partial strategies), the top-most variable remains equivalent between two strategies when recursing on them in lock-step, so it is sufficient to perform a case distinction on the top-most variable encountered in a strategy. Moreover, our definition of Combine is tailored to ∀-Exp+Res. Clauses derived by (∀-exp) are annotated with the strategy ConstStrat(Π, τ ) that plays the assignment τ . For the (res) rule we have the following cases: -The top-most variable, say u, is universal: • If the outgoing edge of u (lit(u), see Definition 3 below) differs from the annotation τ (u) of the pivot in at least one of P and Q, we select the strategy that differs. • If lit(u) equals the annotation τ (u) of the pivot in both P and Q, we recurse. -The top-most variable, say x, is existential: • If x is the pivot of the inference rule, we combine the two strategies. • If x is not the pivot, we recurse. The base cases are when a universal edge differs, or we reach the pivot. We define lit as the partial function mapping universal strategy nodes to the literal they represent, based on their (unique) child node. We define Combine as a function from two strategies, P and Q, and an annotated variable x τ to a new strategy inductively on a ∀-Exp+Res derivation in Fig. 2 . We write Combine in infix notation as P x τ Q. Note that in the case where both lit(P ) = l and lit(Q) = l there is freedom of which strategy out of P and Q to select. We will use the variant selecting P . Example 1. We introduce our running example and use it to demonstrate the combination of two strategies via Combine in Fig. 3 . Let C be a clause derived by ∀-Exp+Res and P be the corresponding strategy annotation computed by Combine. Then P |= enc(C) ⇒ ¬ϕ. Proof. By induction on the ∀-Exp+Res derivation. Base case. The base case corresponds to the ∀-exp rule. We need to show that P |= enc(C τ ) ⇒ ¬ϕ. From the definition of ConstStrat we know that P satisfies all universal literals in enc(C τ ) following the assignments determined by τ . P similarly satisfies the literals in the corresponding negated clause ¬C in ¬ϕ, making both remaining formulas over the existential variables equivalent. The negated matrix ¬ϕ is weaker than just ¬C, thus the implication holds. For a (res) rule with pivot x τ Top-most variable is universal: Combine defined inductively along a ∀-Exp+Res derivation. Step. For a resolution rule with strategy annotations P , Q and the combination of P and Q, i.e. P x τ Q we need to show that Let π be an arbitrary complete assignment determined by strategy P x τ Q. We need to show that π |= enc(C 1 ∨ C 2 ) ⇒ ¬ϕ given the induction hypothesis. By case distinction: Q are depicted to the right. Combine proceeds recursively-top-down-along the trees P and Q. At level x1, we simply recurse and proceed by combining the substrategies along the paths 0/x1 and 1/x1 from P and Q because x1 is not the pivot. On the path along 0/x1 we detect that 0/u1 in P differs from the pivot's annotation 1/u1 and we select the sub-strategy anchored in u1 from P . On the path along 1/x1 the annotation for u1 matches with the values in P and Q and we continue to level x2, which is the pivot. We select the sub-strategy starting in 0/x2 from Q and the sub-strategy starting in 1/x2 from P and are done. 1. If π |= enc(C 1 ∨ C 2 ) the implication is true and we are done. 2. If π |= enc(C 1 ∨ C 2 ) we have two cases: (a) π |= u∈τ u (π differs from the assignment determined by τ ): Let us assume, w.l.o.g., that π is from P , then we have the following induction hypothesis: Since we are in case π |= enc(C 1 ∨ C 2 ), by the definition of enc we know that π |= enc(C 1 ). Furthermore we know that π |= u∈τ u satisfying the left-hand side of the outer implication, thus π must satisfy ¬ϕ for the IH to be valid. Since, in this case the Combine operator evaluates to P and π is from P , P |= enc(C 1 ∨ C 2 ) ⇒ ¬ϕ is valid. (b) π |= u∈τ u (π equals the assignment determined by τ ): Again, since we are in case π |= enc(C 1 ∨ C 2 ), by the definition of enc we know that π |= enc(C 1 ) and π |= enc(C 2 ). We also know that π |= u∈τ u, so when π ∈ P the IH simplifies to π |= x ⇒ ¬ϕ. Similarly the IH simplifies to π |= ¬x ⇒ ¬ϕ for π ∈ Q. Assume x = 1, then P |= ¬ϕ. When we assume x = 0, then Q |= ¬ϕ. In either case, because we assume the IH to be true, we know ¬ϕ needs to be true. Combine chooses the respective paths in P and Q and combines them so that Str(x, Q − , P + ) |= enc(C 1 ∨ C 2 ) ⇒ ¬ϕ is valid. -We relate the clauses of a ∀-Exp+Res-proof and the extracted strategies: P |= enc(C) ⇒ ¬ϕ signifies that the strategy P is a witness for the validity of the QBF formula Π.enc(C) ⇒ ¬ϕ. -We relate the rules of a ∀-Exp+Res-proof to strategy construction operators: For an expansion-axiom with regard to an assignment τ , the strategy is given by ConstStrat(Π, τ ) . For a resolution step, the strategy is obtained by applying the Combine operator on the strategies for the parent nodes. The strategies we have introduced in the previous section have size exponential in the number of existential variables in the quantifier prefix. Thus, it is impractical to consider strategy extraction using such a data structure. Instead, we will now demonstrate how we can implement the Combine operator on circuits. We will show how we can construct the circuit for n output variables in such a way that the size of the circuit is in the order of O(p · n), where p is the proof length (number of clauses). This size is asymptotically optimal when constructing circuits locally along the proof derivation for n variables, considering that each inference can potentially manipulate each circuit. We begin by introducing a number of auxiliary circuits. In the following let L, R, and B (short for "left", "right", and "bottom", according to their respective positions in the inference rule) be tuples of circuits and let y be the input variables. We write f ui for the circuit with output u i for f ∈ {L, R, B}. We define the circuits Equiv i is a tautology. Proof. Assume that f = L and g = R, with the other case symmetric. It is clear that when Diff i L (y) is true, Equiv i. When Equiv