Satisfiability and Synthesis Modulo Oracles

Elizabeth Polgreen, Andrew Reynolds, Sanjit A. Seshia

Introduction

Standard program synthesis and Satisfiability Modulo Theories (SMT) solvers have long been constrained by a "white-box" requirement. To reason about a system, these solvers traditionally require the problem to be defined entirely using explicit logical formulas. While effective for simple arithmetic or logic, this approach fails when faced with complex, real-world components like compiled C code, external mathematical libraries, or proprietary executables. This paper introduces a unified framework for Satisfiability and Synthesis Modulo Oracles (SMTO/SyMO), enabling solvers to interact with external "black-box" oracles during the search for a solution.

The SMTO/SyMO Framework

The core innovation of this work is the formalization of oracle function symbols within standard logical theories. Instead of attempting to encode a complex function—such as a prime number check or a matrix stability test—into thousands of static SMT constraints, the solver delegates these evaluations to an external oracle.

The SyMO framework architecture, illustrating the interaction between the synthesizer, the SMTO solver, and the oracle interface.

The framework distinguishes between two types of feedback from the oracle:

  1. Assumptions: Logical formulas that restrict the behavior of the oracle function symbol, typically used during the verification phase to confirm if a candidate solution meets the specification.
  2. Constraints: Formulas that guide the synthesis search. For example, if a candidate program fails on a specific input, the oracle provides a counterexample (a constraint) that the next candidate must satisfy.

The authors implemented this framework in a prototype meta-solver called Delphi. Delphi alternates between a synthesis phase (using an off-the-shelf solver like CVC4) and a verification phase where it queries the external oracles. This allows the solver to treat the oracle as a source of truth without needing to understand its internal logic.

Experimental Evaluation

Delphi was evaluated across a diverse set of benchmarks designed to test its ability to handle problems that are traditionally difficult for SMT solvers:

  • Image Processing: Synthesizing pixel-level transformations (e.g., brightening, inverting, or cropping) on 256x256 JPEG images.
  • Digital Controller Synthesis: Generating floating-point controllers for Linear Time-Invariant (LTI) systems, requiring stability and safety guarantees.
  • Educational Mathematics: Solving GCSE-level problems involving prime numbers and other non-linear mathematical properties that are difficult to encode in pure SMT.
  • Programming by Example (PBE): Standard benchmarks to measure the overhead of the oracle interface on simpler tasks where oracles are not strictly necessary.

Key Results and Insights

The results demonstrate that delegating complex reasoning to specialized oracles is a significant performance multiplier. In the image processing domain, Delphi solved 9 out of 10 benchmarks in an average of 21.6 seconds. In contrast, the state-of-the-art CVC4 solver failed on every single task, timing out due to the massive size of the static encodings.

Example of an image transformation synthesized by Delphi. The solver uses an oracle to check pixel values rather than encoding the entire image as a static formula.

The failure of traditional solvers in these domains is often due to the "encoding explosion." For a 256x256 image, a static SMT encoding requires over 50,000 constraints upfront. Delphi avoids this by dynamically generating a small number of highly informative constraints only when the oracle identifies a failure point, making the problem tractable.

Similarly, in control systems, Delphi solved 104 out of 112 stability benchmarks by offloading matrix calculations to the Eigen C++ library. CVC4, attempting to solve the same problems through pure logical reasoning, managed only 16. Even on standard PBE tasks, the overhead of calling external binaries was negligible, with Delphi performing on par with native solvers.

Conclusion and Future Work

The SMTO/SyMO framework proves that delegation is a powerful tool for program synthesis. By treating complex components as black boxes, solvers can tackle real-world engineering problems that were previously out of reach. While the current framework focuses on semantic constraints (input-output behavior), future research will look into incorporating syntactic constraints to restrict the shape of synthesized code and developing cost-aware strategies to optimize the communication between the solver and the oracles.

Summary updated

BibTeX
@inproceedings{polgreen2022satisfiability,
  author = {Elizabeth Polgreen and Andrew Reynolds and Sanjit A. Seshia},
  title = {{Satisfiability and Synthesis Modulo Oracles}},
  booktitle = {VMCAI},
  year = {2022},
  doi = {10.1007/978-3-030-94583-1\_13},
}
Figure