[Paper Review] Using Program Synthesis for Program Analysis
This paper introduces the synthesis fragment, a decidable fragment of second-order logic that captures key program analysis problems like safety, termination, and superoptimization. It proposes a program synthesis-based decision procedure that efficiently solves these problems by synthesizing finite-state programs, outperforming existing SyGuS-based approaches in both performance and specification conciseness.
In this paper, we identify a fragment of second-order logic with restricted quantification that is expressive enough to capture numerous static analysis problems (e.g. safety proving, bug finding, termination and non-termination proving, superoptimisation). We call this fragment the {\it synthesis fragment}. Satisfiability of a formula in the synthesis fragment is decidable over finite domains; specifically the decision problem is NEXPTIME-complete. If a formula in this fragment is satisfiable, a solution consists of a satisfying assignment from the second order variables to \emph{functions over finite domains}. To concretely find these solutions, we synthesise \emph{programs} that compute the functions. Our program synthesis algorithm is complete for finite state programs, i.e. every \emph{function} over finite domains is computed by some \emph{program} that we can synthesise. We can therefore use our synthesiser as a decision procedure for the synthesis fragment of second-order logic, which in turn allows us to use it as a powerful backend for many program analysis tasks. To show the tractability of our approach, we evaluate the program synthesiser on several static analysis problems.
Motivation & Objective
- To identify a decidable fragment of second-order logic expressive enough to encode core program analysis problems such as safety proving, bug finding, and termination analysis.
- To develop a complete program synthesis algorithm for finite-state functions, enabling the use of synthesis as a decision procedure for the synthesis fragment.
- To design a solver that is modular, scalable, and efficient for program analysis tasks by decoupling problem formulation from solving strategies.
- To outperform existing synthesis-based approaches like SyGuS by supporting unbounded lexicographic ranking functions and efficient constant handling without syntactic templates.
- To evaluate the approach on real-world static analysis problems, demonstrating its practicality and superiority in performance and specification size.
Proposed method
- Define the synthesis fragment as a restricted second-order logic with decidable satisfiability over finite domains, proven to be NEXPTIME-complete.
- Reduce logical satisfiability in the synthesis fragment to finite-state program synthesis, where each satisfying assignment corresponds to a program computing a required function.
- Implement a hybrid synthesis algorithm combining bounded model checking (CBMC), explicit state model checking, and genetic programming to explore candidate solutions.
- Introduce a generalization strategy that first finds simple solutions for restricted cases and incrementally generalizes them to full solutions.
- Use a concise C-like specification language that avoids syntactic templates (unlike SyGuS), enabling direct encoding of complex functions like lexicographic ranking functions.
- Support first-class constants and unbounded-dimensional outputs in the synthesis language, enabling efficient representation of complex program analysis constructs.
Experimental results
Research questions
- RQ1Can a decidable fragment of second-order logic be defined that captures a broad range of static analysis problems, including safety, termination, and superoptimization?
- RQ2Can program synthesis serve as a complete and efficient decision procedure for this fragment over finite domains?
- RQ3How does a synthesis-based approach compare to existing approaches like SyGuS in terms of specification size, performance, and expressiveness—particularly for complex constructs like lexicographic ranking functions?
- RQ4To what extent does generalization and hybrid search (symbolic, explicit, and stochastic) improve the scalability and efficiency of solving high-complexity logic problems?
- RQ5Can the synthesis algorithm efficiently handle existential quantification over first-order variables and constants, especially when these are encoded inefficiently in other frameworks?
Key findings
- The synthesis fragment is NEXPTIME-complete and decidable over finite domains, providing a solid theoretical foundation for program analysis via logic.
- Kalashnikov, the implemented synthesizer, solved 18 out of 20 safety benchmarks with an average runtime of 11.3 seconds, significantly outperforming the SyGuS-based eSolver, which solved only 7 out of 20.
- Kalashnikov's specifications were approximately 11% the size of equivalent SyGuS specifications (341 vs. 3140 lines), demonstrating superior conciseness.
- The solver’s performance is heavily influenced by the Kolmogorov complexity of the proof: shorter proofs are found quickly, indicating high efficiency for problems with compact solutions.
- Generalization and hybrid search strategies (CBMC, explicit, GP) contributed significantly to solving, with 46% of candidates found via explicit state model checking and 31% via genetic programming.
- The solver’s ability to natively handle unbounded lexicographic ranking functions and efficient constant encoding (vs. unary chains in SyGuS) enabled it to solve problems that SyGuS could not express or handle efficiently.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.