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...
翻译:基于模板的合成, 也称为草图, 是一种本地化的程序合成方法, 程序员不仅提供一个规格, 而且还提供高层次的“ sketch' ” 程序。 素描基本上是一个部分程序, 用来模拟程序员的一般直观, 而将低层次的细节保留为未执行的“ 洞穴” 。 合成引擎的作用就是填补这些洞口, 这样完成的程序就能满足所期望的规格 。 在这项工作中, 我们侧重于基于模板的多语种程序合成, 包括真实变量, 即 ~ 简化程序, 其中所有在任务、 条件和警卫中的表达方式都是多级的 Q; 虽然这个问题可以通过降低程序头等理论的直观和完整的方式来解决, 但所产生的公式将包含一个量化的变异种, 即使在考虑微调程序时, 也可以通过几条线来彻底地消除。 此外, 彩色的经典算算法是难以形容的, 并且不能完全适用于此用途的边端点 QQQ 。, 并且 以直径的平面的平面的平面的变的变的变式 。 。,, 平式的变式的变式的变式的变式的变式的变式的变式的变式的变式的变式的变式,, 以一个正常的变式的变式是, 。