论文标题
基于模板的程序合成使用Stellensätze
Template-based Program Synthesis using Stellensätze
论文作者
论文摘要
基于模板的合成,也称为草图,是程序综合的局部方法,在该方法中,程序员不仅提供了规范,而且还提供了程序的高级``草图''。草图基本上是一个部分程序,可以对程序员的一般直觉进行建模,同时将低级细节留作未完成的``孔''。然后,合成引擎的作用是填充这些孔,以使完成的程序满足所需的规范。在这项工作中,我们专注于基于模板的多项式命令程序的合成,即具有真实变量,即〜命令程序,其中所有表达式出现在分配,条件和警卫中都是多项式的程序变量。虽然可以通过减少对真实的一阶理论来以声音和完整的方式解决此问题,但即使考虑使用少数线条的玩具程序,也对现代SMT求解器的公式将包含量词交替,并且对于现代SMT求解器而言也很难。此外,众所周知,用于量化器消除的经典算法是不可计算的,根本不适用于此用例。 相比之下,我们的主要贡献是一种算法,基于多种众所周知的多面体和真实的代数几何定理,即Putinar的Potitivstellensatz,真正的无效的无效的遗物,Handelman的定理和Farkas和Farkas的Lemma,这是对量化难以消除的问题,并避免了Quinces condififier consermins cormandife condartife cormandife grouds cormance cormandy cormandy(quad),以解决问题。另外,人们可以将我们的算法视为消除合成问题中出现的特定公式中量词的有效方法。然后,SMT求解器可以很容易地处理生成的QP实例。值得注意的是,我们对QP的还原是声音和半完整的,即,如果在模板中使用足够高的多项式,则它是完整的...
Template-based synthesis, also known as sketching, is a localized approach to program synthesis in which the programmer provides not only a specification, but also a high-level ``sketch'' of the program. The sketch is basically a partial program that models the general intuition of the programmer, while leaving the low-level details as unimplemented ``holes''. The role of the synthesis engine is then to fill in these holes such that the completed program satisfies the desired specification. In this work, we focus on template-based synthesis of polynomial imperative programs with real variables, i.e.~imperative programs in which all expressions appearing in assignments, conditions and guards are polynomials over program variables. While this problem can be solved in a sound and complete manner by a reduction to the first-order theory of the reals, the resulting formulas will contain a quantifier alternation and are extremely hard for modern SMT solvers, even when considering toy programs with a handful of lines. Moreover, the classical algorithms for quantifier elimination are notoriously unscalable and not at all applicable to this use-case. In contrast, our main contribution is an algorithm, based on several well-known theorems in polyhedral and real algebraic geometry, namely Putinar's Positivstellensatz, the Real Nullstellensatz, Handelman's Theorem and Farkas' Lemma, which sidesteps the quantifier elimination difficulty and reduces the problem directly to Quadratic Programming (QP). Alternatively, one can view our algorithm as an efficient way of eliminating quantifiers in the particular formulas that appear in the synthesis problem. The resulting QP instances can then be handled quite easily by SMT solvers. Notably, our reduction to QP is sound and semi-complete, i.e.~it is complete if polynomials of a sufficiently high degree are used in the templates...