Synthesis with Asymptotic Resource Bounds

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(n log(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-andconquer programs that cannot be synthesized by prior solvers.

[1]  Loris D'Antoni,et al.  Syntax-Guided Synthesis with Quantitative Syntactic Objectives , 2018, CAV.

[2]  Martin Hofmann,et al.  Multivariate amortized resource analysis , 2012, TOPL.

[3]  Benjamin C. Pierce,et al.  Local type inference , 2000, TOPL.

[4]  Louay Bazzi,et al.  On the Solution of Linear Recurrence Equations , 1998, Comput. Optim. Appl..

[5]  Benjamin C. Pierce,et al.  Local type inference , 1998, POPL '98.

[6]  Antonio Flores-Montoya Cost Analysis of Programs Based on the Refinement of Cost Relations , 2017 .

[7]  Di Wang,et al.  Resource-guided program synthesis , 2019, PLDI.

[8]  J. Saxe,et al.  A general method for solving divide-and-conquer recurrences , 1980, SIGA.

[9]  Elvira Albert,et al.  Closed-Form Upper Bounds in Static Cost Analysis , 2011, Journal of Automated Reasoning.

[10]  Ben Wegbreit,et al.  Mechanical program analysis , 1975, CACM.

[11]  Martin Hofmann,et al.  Resource Aware ML , 2012, CAV.

[12]  Zachary Kincaid,et al.  Non-linear reasoning for invariant synthesis , 2017, Proc. ACM Program. Lang..

[13]  Manuel Eberl,et al.  Proving Divide and Conquer Complexities in Isabelle/HOL , 2017, Journal of Automated Reasoning.

[14]  Xin-She Yang,et al.  Introduction to Algorithms , 2021, Nature-Inspired Optimization Algorithms.

[15]  Jan Hoffmann,et al.  Exponential Automatic Amortized Resource Analysis , 2020, FoSSaCS.

[16]  Armando Solar-Lezama,et al.  Program synthesis from polymorphic refinement types , 2016, PLDI.

[17]  Manuel Kauers,et al.  The Concrete Tetrahedron - Symbolic Sums, Recurrence Equations, Generating Functions, Asymptotic Estimates , 2011, Texts & Monographs in Symbolic Computation.

[18]  Arthur Charguéraud,et al.  A Fistful of Dollars: Formalizing Asymptotic Complexity Claims via Deductive Program Verification , 2018, ESOP.

[19]  Peng Wang,et al.  TiML: a functional language for practical complexity analysis with invariants , 2017, Proc. ACM Program. Lang..

[20]  Armando Solar-Lezama,et al.  Program synthesis from polymorphic refinement types , 2015, PLDI.

[21]  Zachary Kincaid,et al.  Templates and recurrences: better together , 2020, PLDI.