S² Prover: A Second-Order SAT Solver
- S² Prover is a decision procedure for a decidable fragment of second-order logic (S²SAT) that formulates search as finite-state program synthesis.
- It reduces S²SAT to program synthesis using a CEGIS loop, combining explicit enumeration, symbolic bounded-model checking, and genetic programming.
- Empirical studies show effective solving of benchmarks in superoptimisation, termination, and QBF, while highlighting challenges in early UNSAT detection.
S² Prover is a decision procedure for the satisfiability problem of a decidable fragment of second-order logic called S²SAT, introduced in “Second-Order Propositional Satisfiability” (David et al., 2014). It is designed around the observation that static program analyses search for a second-order object—such as an invariant, countermodel, ranking function, or recurrence set—while traditional frameworks often conflate the search heuristic and the underlying SAT/SMT-based validation mechanism. S² Prover addresses this by reducing S²SAT to finite-state program synthesis and solving the resulting problem with Counterexample-Guided Inductive Synthesis (CEGIS), thereby separating problem description from search strategy.
1. Logical object: S²SAT
S²SAT is defined over the Boolean domain by formulas of the form
where each is a predicate of arity , each ranges over , and is a quantifier-free propositional formula whose atoms may be or applications with (David et al., 2014).
The fragment is presented as expressive enough to capture numerous program analysis problems, including safety proving, bug finding, termination and non-termination proving, and superoptimisation. The example
0
states that there exists a symmetric Boolean relation 1. In the intended program-analysis reading, the second-order existential block ranges over candidate proofs or witnesses, while the first-order quantification expresses the universal or existential conditions that those candidates must satisfy.
2. Complexity and expressive range
The central complexity result is that checking satisfiability of an S²SAT formula with 2 first-order variables is NEXPTIME-complete (David et al., 2014). The upper bound is obtained by interpreting the first-order fragment as a structure of size 3 and applying Fagin’s Theorem, under which existential second-order logic over finite structures captures exactly NEXPTIME. The lower bound is obtained by encoding the run of a nondeterministic exponential-time Turing machine on an input of length 4 as an S²SAT formula whose second-order variables encode the transition relation over configurations.
Within the paper’s framing, this complexity result justifies both the fragment’s generality and the need for a solver architecture that is not tied to a single first-order backend. The motivating claim is that traditional analyzers are monolithic because second-order solvers are scarce, whereas SAT/SMT technology is mature. S² Prover is positioned as an attempt to close that gap by providing a dedicated decision procedure for a second-order fragment while retaining a practical reduction path to propositional reasoning.
3. Reduction to finite-state program synthesis
The solver reduces every S²SAT instance 5 to a finite-state synthesis problem of the form
6
where 7 is a loop-free program computing the candidate second-order functions, 8 is a finite domain, and 9 checks that 0 satisfies the original QBF-like constraint on all inputs (David et al., 2014).
The resulting synthesis problem is solved by a standard CEGIS refinement loop. The loop begins with an empty test set, synthesizes a candidate program consistent with the current test inputs, and then verifies that candidate by searching for a counterexample. If no such counterexample exists, the candidate is returned; otherwise, the counterexample is added to the test set and the process repeats. The paper states three key properties of this loop. First, it is sound: when a candidate 1 is returned, verification has proved 2. Second, it is semi-complete: if there exists some 3 such that 4, CEGIS eventually finds it, provided the search over programs is complete. Third, it terminates for UNSAT: since every total function 5 has a finite-size program encoding of length at most 6, the procedure can stop once the program-size bound exceeds this threshold and conclude UNSAT.
This reduction is the core abstraction behind S² Prover. It turns second-order search into finite-state program search, allowing the second-order unknowns to be represented as synthesized code rather than as uninterpreted relational objects.
4. Search architecture and implementation
S² Prover runs three candidate-generation strategies in parallel: explicit enumeration by increasing program length 7 in loop-free static single-assignment form, symbolic bounded-model checking using CBMC on the 8 encoding of 9, and genetic programming with incremental evolution over the current test set (David et al., 2014).
The language 0 of candidate programs is parameterised by three quantities: 1, the program length measured in number of instructions; 2, the word width measured in bits per register; and 3, the number of distinct constants allowed. The search traverses the lattice 4 starting from 5, increasing 6 up to 7, then increasing 8, and, when verification fails on full-width 9, trying smaller 0 for constant generalisation or increasing 1. This parameterisation gives the procedure an explicit mechanism for controlling search breadth while systematically enlarging the hypothesis space.
The background formalism is a 2 encoding. The implementation uses a 3 interpreter for 4, with 5 written in 6 by invoking that interpreter on candidate 7 and input 8 and then asserting the original QBF-style constraints. Because 9 is loop-free C with bounded loops and recursion, it is decidable via bounded model checking. The paper states that CBMC generates a propositional formula of size 0 for each synthesis or verification check, and that this formula is solved by a SAT/SMT-BV solver.
The reported implementation size is approximately 1 kLOC of OCaml plus a C/C++ harness. This implementation detail is significant because it situates S² Prover as a concrete system rather than only a reduction argument.
5. Formal guarantees
Several theoretical results are stated for the synthesis language and the overall solver construction (David et al., 2014). Theorem 1, the universality of 2, states that every total function 3 with 4 is computed by some loop-free 5-program. This is the basis for the claim that the reduction to finite-state synthesis does not lose expressiveness over finite domains.
Theorem 2, the optimality of the 6 encoding, states that no alternative encoding scheme can assign strictly shorter representations to all functions, and that 7’s 8-bit encoding is asymptotically optimal. In the paper’s presentation, this gives an information-theoretic justification for the chosen representation of candidate solutions.
Theorem 3 states that CEGIS instantiated with 9 background theory and the stopping criterion is a decision procedure for S²SAT. The paper also gives a proposition on Kolmogorov-bounded iterations: if the shortest program 0 solving 1 has size 2, then the number of CEGIS iterations is at most 3. This does not change the worst-case NEXPTIME classification, but it formalizes the dependence of the synthesis loop on proof length rather than only on input size. A plausible implication is that instances admitting short synthesized witnesses should be significantly easier than the ambient worst-case complexity suggests.
6. Empirical profile
The empirical evaluation uses three benchmark families: superoptimisation and deobfuscation (4), termination and non-termination from SVCOMP’15 (5), and QBF in simple and hard variants (6), with a timeout of 7 seconds (David et al., 2014). The reported aggregate result is that S² Prover solved 8 of 9 benchmarks.
| Category | Solved / #bench | Avg time (s) |
|---|---|---|
| Superoptimisation | 22 / 29 | 7.9 |
| Termination | 33 / 78 | 11.8 |
| QBF (simple) | 4 / 4 | 1.8 |
| QBF (hard) | 1 / 7 | 1.5 |
| Total/Overall | 59 / 113 | 565.2 |
Additional per-category figures are also reported. For superoptimisation, the average specification size is 0 LOC, the average solution length is 1 instructions, and the average number of CEGIS iterations is 2. For termination, the corresponding values are 3 LOC, 4 instructions, and 5 iterations. For QBF (simple), they are 6 LOC, 7 instructions, and 8 iteration; for QBF (hard), 9 LOC, 0 instructions, and 1 iterations.
The breakdown of solver wins in candidate and CEGIS phases is given as 2 for explicit enumeration, 3 for genetic programming, and 4 for CBMC proof-of-correctness. Time-distribution is reported as 5 synthesis and 6 verification. The accompanying discussion states that many real-world analysis tasks admit short second-order proofs, so CEGIS finds them quickly, whereas unsatisfiable instances, such as wrong-property termination queries, incur complete search up to the 7 bound. Early UNSAT detection is identified as an open challenge.
7. Scope, future directions, and terminological distinction
The conclusion identifies four future directions: automated proof-length generalisation to detect UNSAT earlier, integration with abstract interpretation and interpolation for combined first-order and second-order reasoning, domain-specific search-space heuristics, and extension to richer background theories such as algebraic datatypes (David et al., 2014). These directions are consistent with the paper’s broader claim that S² Prover separates problem description from search strategy and thereby paves the way for modular second-order analysis engines.
The notation “S²” in S² Prover refers to “Second-Order” in S²SAT, not to a two-prover interactive setting. This distinction matters because adjacent literature uses superficially similar language for a different research area. “Multi-Prover Commitments Against Non-Signaling Attacks” studies two-prover and three-prover commitment schemes under classical, quantum, and non-signaling attack models, including an impossibility result for perfectly hiding single-round two-prover commitments and a positive three-prover construction (Fehr et al., 2015). “Oracularization and Two-Prover One-Round Interactive Proofs against Nonlocal Strategies” studies two-prover one-round games, oracularization, and soundness against entangled, commuting-operator, and no-signaling strategies (0810.0693). S² Prover is not a prover in that interactive-proof sense; it is an overview-based solver for a decidable second-order propositional satisfiability problem.