# Templates and Recurrences: Better Together

## Author(s): Breck, Jason; Cyphert, John; Kincaid, Zachary; Reps, Thomas

To refer to this page use: http://arks.princeton.edu/ark:/88435/pr1hn8d
DC FieldValueLanguage
dc.contributor.authorBreck, Jason-
dc.contributor.authorCyphert, John-
dc.contributor.authorKincaid, Zachary-
dc.contributor.authorReps, Thomas-
dc.date.accessioned2021-10-08T19:45:09Z-
dc.date.available2021-10-08T19:45:09Z-
dc.date.issued2020-06en_US
dc.identifier.citationBreck, Jason, John Cyphert, Zachary Kincaid, and Thomas Reps. "Templates and recurrences: better together." Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation (2020): pp. 688-702. doi:10.1145/3385412.3386035en_US
dc.identifier.urihttps://arxiv.org/pdf/2003.13515.pdf-
dc.identifier.urihttp://arks.princeton.edu/ark:/88435/pr1hn8d-
dc.description.abstractThis paper is the confluence of two streams of ideas in the literature on generating numerical invariants, namely: (1) template-based methods, and (2) recurrence-based methods. A template-based method begins with a template that contains unknown quantities, and finds invariants that match the template by extracting and solving constraints on the unknowns. A disadvantage of template-based methods is that they require fixing the set of terms that may appear in an invariant in advance. This disadvantage is particularly prominent for non-linear invariant generation, because the user must supply maximum degrees on polynomials, bases for exponents, etc. On the other hand, recurrence-based methods are able to find sophisticated non-linear mathematical relations, including polynomials, exponentials, and logarithms, because such relations arise as the solutions to recurrences. However, a disadvantage of past recurrence-based invariant-generation methods is that they are primarily loop-based analyses: they use recurrences to relate the pre-state and post-state of a loop, so it is not obvious how to apply them to a recursive procedure, especially if the procedure is non-linearly recursive (e.g., a tree-traversal algorithm). In this paper, we combine these two approaches and obtain a technique that uses templates in which the unknowns are functions rather than numbers, and the constraints on the unknowns are recurrences. The technique synthesizes invariants involving polynomials, exponentials, and logarithms, even in the presence of arbitrary control-flow, including any combination of loops, branches, and (possibly non-linear) recursion. For instance, it is able to show that (i) the time taken by merge-sort is O(n log(n)), and (ii) the time taken by Strassen’s algorithm is O(nlog2(7)).en_US
dc.format.extent688 - 702en_US
dc.language.isoen_USen_US
dc.relation.ispartofProceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementationen_US
dc.rightsAuthor's manuscripten_US
dc.titleTemplates and Recurrences: Better Togetheren_US
dc.typeConference Articleen_US
dc.identifier.doi10.1145/3385412.3386035-
pu.type.symplectichttp://www.symplectic.co.uk/publications/atom-terms/1.0/journal-articleen_US

Files in This Item:
File Description SizeFormat