Abstract

BFSn algorithms like GACKS, SynNNF, and Manthan can efficiently find a Skolem vector for a given boolean specification. Often there are several Skolem vectors that satisfy the specification but existing approaches only present us with one solution. Akshay et al. (2023) presents the FINDSKBASISVEC algorithm that returns a vector containing the ‘basis’ for all output variables of the specification. The basis can then be used to generate all Skolem functions for the output variables.

The Skolem Basis Vector

The Skolem Basis Vector is a criteria-agnostic representation that captures all Skolem function vectors.

For a boolean specification , and a given linear order of outputs , the Skolem Basis Vector is a vector of pairs . For each output , such that:

  • is the on-set: A function over inputs and later outputs . It defines the assignments where must be 1.
  • is the don’t-care set: A function over and . It defines the assignments where can be 1 or 0.

and are disjoint by definition, i.e., is unsatisfiable.

Any valid Skolem function can be expressed as , where is a “generalized implicant” of (meaning ). The authors prove that this Skolem basis vector always exists and is semantically unique for a given specification and output ordering.

Computing the Skolem Basis Vector

The Single Output Case (Theorem 1)

If there is only one output , computing the basis is easy. It’s just:

  • (Must be 1)
    • This formula, the on-set, identifies all inputs for which the output has no choice but to be 1.
    • The and parts can be understood as:
      • : This part says, “For this input , setting the output satisfies the specification.”
      • : This part says, “For this input , setting the output violates the specification.”
  • (Can be 1 or 0)
    • This formula, the don’t-care set, identifies all inputs for which the output can be either 0 or 1 without affecting satisfaction of the specification.
    • The biconditional parts can be understood via the following cases:
      • If both and are true, then setting to either 0 or 1 satisfies the specification.
      • If both and are false, then setting to either 0 or 1 violates the specification.

The Multi-Output Case

The strategy is to reduce the multi-output case to the single-output case, one variable at a time. To compute the basis for output , you first need the “derived specification” .

is the original specification with all earlier outputs existentially quantified away. This now allows us to apply Theorem 1 to to get where and have the variables and .

Existential Quantification of Multiple Output Variables

The standard method for existential quantification () doubles the circuit size at each step, leading to exponential blow-up. Akshay et al. (2023) propose 3 techniques to avoid this blow-up:

  1. Existential quantification of unate variables.
  2. Existential quantification of no conflict variables (which requires checking for conflicts).
  3. Using counter-example guided rectification to transform a conflicting variable into a non-conflicting one.

Existential Quantification of Unate Variables

A variable is unate if it’s always positive or always negative.

  • If positive unate (), then .
  • If negative unate (), then .

Existential Quantification of No Conflict Variables

Before defining conflict variables we first need to transform the specification into its “y-positive form” ( or ) by replacing every negative literal with a fresh, new variable .

A variable is defined as being in conflict if there exists an assignment (to all other variables other than ) that forces the formula to simplify into a logical contradiction, formally . If no such contradictory assignment exists, the variable is conflict-free.

When a variable is conflict-free, Lemma 2 of Akshay et al. (2023) provides a simple and efficient substitution rule for quantification: .

How to Check for Conflict Variables?

To check if a variable is in conflict, we need to determine if there exists an assignment to all other variables such that . This is equivalent to checking if the formula:

is satisfiable. If is satisfiable, then is in conflict. If is unsatisfiable, then is conflict-free.

Note

Running through a SAT solver is the same as checking if , which is exactly the second part of the bi-implication proof in the previous section.

Existential Quantification for Conflict Variables

When a variable is in conflict (i.e., is SAT), it cannot be quantified efficiently. The strategy here is to first transform the formula into a semantically equivalent formula in which the variable is no longer in conflict. This transformation process is called rectification.

Rectification is achieved using a counterexample-guided loop, which is formally defined in Algorithm 1: RECTIFYONEOUTPUT.

Algorithm 1: RECTIFY ONE OUTPUT (φ(X,Y),y)
  μ := φ
  while IS_SAT(κ_{μ,y}) do
    Let π be a satisfying assignment of κ_{μ,y}
    ξ := PARTIALRECTIFIER(μ, π)
    μ := μ ∧ ξ
  return μ

This algorithm works by first setting a temporary formula to the original specification . It then repeatedly uses a SAT solver on the conflict formula . If the formula is satisfiable, the solver returns a counterexample that causes y to be conflicting.

Next, the algorithm generates a “patch” formula , called a partial rectifier. This new clause is carefully crafted to have two key properties described in Lemma 3:

  1. It must be redundant (meaning , so it doesn’t change the specification’s logic).
  2. It must block the conflict (meaning is unsatisfiable).

The patch is then conjoined with the specification: . The new formula is logically equivalent to the original but no longer has as a conflict. This loop repeats, finding and patching new conflicts, until the conflict formula finally becomes UNSAT, at which point the variable is certified to be conflict-free.

To make this process efficient, the algorithm uses counterexample generalization. Instead of just blocking the single assignment , it analyzes the circuit structure to find a more general formula that represents a large set of counterexamples. The patch is then set to , which removes many conflicts at once.

Once the variable is conflict-free in the transformed formula , we can then apply the efficient substitution rule for existential quantification: .

The FINDSKBASISVEC Algorithm

The overall procedure that computes the complete Skolem basis vector is Algorithm 2: FINDSKBASISVEC1. This algorithm orchestrates all the individual components—the basis calculation from Theorem 1 and the different existential quantification techniques (unate, conflict-free, and rectification). The algorithm initializes a “running specification” to the original specification . It then repeatedly loops through the output variables , which can be chosen based on a static order or a dynamic heuristic.

Algorithm FINDSKBASISVEC(φ, X, Y)
  α := φ; i := 1; 
  while i ≤ |Y|:
    A_i := α|_{y_i=1} ∧ ¬α|_{y_i=0}
    B_i := α|_{y_i=1} ⇔ α|_{y_i=0}
    
    if y_i is positive unate in α then α := α|_{y_i=1}  //Existentially quantify y_i
    else if y_i is negative unate in α then α := α|_{y_i=0}  //Existentially quantify y_i
    else
      μ := RECTIFYONEOUTPUT(α, y_i)  //y_i is conflict-free in μ
      α := μ^{+y_i}|_{y_i=1, ŷ_i=1}  //Existentially quantify y_i
    i := i + 1
  return <(A_i, B_i)>_{1≤i≤n}

References

Akshay, S., Chakraborty, S., & Jain, S. (2023). Counterexample Guided Knowledge Compilation for Boolean Functional Synthesis. In C. Enea & A. Lal (Eds.), Computer Aided Verification (Vol. 13964, pp. 367–389). Springer Nature Switzerland. https://doi.org/10.1007/978-3-031-37706-8_19