Algorithmic paradigms such as divide-and-conquer (D&C) are proposed to guide developers in designing efficient algorithms, but it can still be difficult to apply algorithmic paradigms to practical tasks. To ease the usage of paradigms, many research efforts have been devoted to the automatic application of algorithmic paradigms. However, most existing approaches to this problem rely on syntax-based program transformations and thus put significant restrictions on the original program. In this paper, we study the automatic application of D&C and several similar paradigms, denoted as D&C-like algorithmic paradigms, and aim to remove the restrictions from syntax-based transformations. To achieve this goal, we propose an efficient synthesizer, named AutoLifter, which does not depend on syntax-based transformations. Specifically, the main challenge of applying algorithmic paradigms is from the large scale of the synthesized programs, and AutoLifter addresses this challenge by applying two novel decomposition methods that do not depend on the syntax of the input program, component elimination and variable elimination, to soundly divide the whole problem into simpler subtasks, each synthesizing a sub-program of the final program and being tractable with existing synthesizers. We evaluate AutoLifter on 96 programming tasks related to 6 different algorithmic paradigms. AutoLifter solves 82/96 tasks with an average time cost of 20.17 seconds, significantly outperforming existing approaches.
翻译:诸如分治(D&C)之类的算法范式被提出以指导开发者设计高效算法,但将算法范式应用于实际任务仍可能具有困难。为简化范式使用,许多研究工作致力于算法范式的自动应用。然而,现有方法大多依赖于基于语法的程序转换,从而对原始程序施加了显著限制。本文研究了分治及若干类似范式(统称为分治类算法范式)的自动应用问题,旨在消除基于语法转换的限制。为实现此目标,我们提出了一种高效合成器AutoLifter,其不依赖于基于语法的转换。具体而言,应用算法范式的主要挑战来自合成程序的规模,AutoLifter通过应用两种不依赖输入程序语法的新颖分解方法——组件消除与变量消除——来可靠地将整体问题分解为更简单的子任务,每个子任务合成最终程序的一个子程序,且可通过现有合成器处理。我们在涉及6种不同算法范式的96个编程任务上评估AutoLifter。AutoLifter成功解决82/96个任务,平均耗时20.17秒,显著优于现有方法。