We present a method for synthesizing recursive functions that satisfy both a functional specification and an asymptotic resource bound. Prior methods for synthesis with a resource metric require the user to specify a concrete expression exactly describing resource usage, whereas our method uses big-O notation to specify the asymptotic resource usage. Our method can synthesize programs with complex resource bounds, such as a sort function that has complexity O(nlog(n)). Our synthesis procedure uses a type system that is able to assign an asymptotic complexity to terms, and can track recurrence relations of functions. These typing rules are justified by theorems used in analysis of algorithms, such as the Master Theorem and the Akra-Bazzi method. We implemented our method as an extension of prior type-based synthesis work. Our tool, SynPlexity, was able to synthesize complex divide-and-conquer programs that cannot be synthesized by prior solvers.
翻译:我们提出了一个组合递归函数的方法,该方法既符合功能规格,又符合无症状资源的约束。 先前的与资源衡量标准合成的方法要求用户指定一个具体表达方式,确切描述资源使用情况,而我们的方法则使用大标记来指定无症状资源使用情况。我们的方法可以将程序与复杂的资源界限合成,例如具有复杂的 O(nlog(n)) 的排序函数。我们的合成程序使用一种能够给术语指定无症状复杂性的型号系统,并可以跟踪功能的复发关系。这些打字规则可以用用于算法分析的术语(如主理论和Akra-Bazzi 方法)来证明。我们的方法是作为先前基于类型合成工作的扩展。我们的工具,即SynPlexity,能够合成无法由前解决者合成的复杂分解和共解程序。