Abstract

The cost analysis of a program is a function from the size of its input to the number of steps the program takes to run. In this work we address two difficulties associated with constructing cost analyses. First, what is the cost of a higher-order program? If an expression takes a function as input, what is the “size” of that input? If an expression evaluates to a function, what is its “cost”? Second, how can we automate the cost analysis of arbitrary programs? In this work we develop a static cost analysis system for a functional target language with structural list recursion. The cost of evaluating a target expression is defined to be the size of its evaluation derivation in the operational semantics. The complexity of a target expression is a pair consisting of a cost and a potential, which is a measure of size. A translation function ‖ · ‖ maps target expressions to complexities. Our main result is the following soundness theorem: If t is a term in the target language, then the cost component of ‖t‖ is an upper bound on the cost of evaluating t. We formalize the mathematical development of the system in the proof assistant Coq, a dependently typed functional programming language and interactive theorem prover. We implement target language typing and evaluation in Coq, as well as an independent complexity language to reason about complexities. By formalizing the proof of the soundness theorem in Coq, we obtain a system which automatically generates certified upper bounds on the complexity of target-language terms.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.