Repository logo

Infoscience

  • English
  • French
Log In
Logo EPFL, École polytechnique fédérale de Lausanne

Infoscience

  • English
  • French
Log In
  1. Home
  2. Academic and Research Output
  3. Journal articles
  4. Contract-Based Resource Verification for Higher-Order Functions with Memoization
 
research article

Contract-Based Resource Verification for Higher-Order Functions with Memoization

Madhavan, Ravichandhran
•
Kulal, Sumith
•
Kuncak, Viktor  orcid-logo
2017
Acm Sigplan Notices

We present a new approach for specifying and verifying resource utilization of higher-order functional programs that use lazy evaluation and memoization. In our approach, users can specify the desired resource bound as templates with numerical holes e.g. as steps <= ? not asymptotic to size(l) + ? in the contracts of functions. They can also express invariants necessary for establishing the bounds that may depend on the state of memoization. Our approach operates in two phases: first generating an instrumented first-order program that accurately models the higher-order control flow and the effects of memoization on resources using sets, algebraic datatypes and mutual recursion, and then verifying the contracts of the first-order program by producing verification conditions of the form there exists for all using an extended assume/guarantee reasoning. We use our approach to verify precise bounds on resources such as evaluation steps and number of heap-allocated objects on 17 challenging data structures and algorithms. Our benchmarks, comprising of 5K lines of functional Scala code, include lazy mergesort, Okasaki's real-time queue and deque data structures that rely on aliasing of references to first-class functions; lazy data structures based on numerical representations such as the conqueue data structure of Scala's data-parallel library, cyclic streams, as well as dynamic programming algorithms such as knapsack and Viterbi. Our evaluations show that when averaged over all benchmarks the actual runtime resource consumption is 80% of the value inferred by our tool when estimating the number of evaluation steps, and is 88% for the number of heap-allocated objects.

  • Files
  • Details
  • Metrics
Type
research article
DOI
10.1145/3009837.3009874
Web of Science ID

WOS:000408311200026

Author(s)
Madhavan, Ravichandhran
Kulal, Sumith
Kuncak, Viktor  orcid-logo
Date Issued

2017

Publisher

Assoc Computing Machinery

Published in
Acm Sigplan Notices
Volume

52

Issue

1

Start page

330

End page

343

Subjects

Languages

•

Performance

•

Reliability

•

Verification

•

complexity

•

lazy evaluation

•

dynamic programming

URL

URL

https://github.com/epfl-lara/leon/tree/inferInv
Editorial or Peer reviewed

REVIEWED

Written at

EPFL

EPFL units
LARA  
Available on Infoscience
July 10, 2017
Use this identifier to reference this record
https://infoscience.epfl.ch/handle/20.500.14299/139211
Logo EPFL, École polytechnique fédérale de Lausanne
  • Contact
  • infoscience@epfl.ch

  • Follow us on Facebook
  • Follow us on Instagram
  • Follow us on LinkedIn
  • Follow us on X
  • Follow us on Youtube
AccessibilityLegal noticePrivacy policyCookie settingsEnd User AgreementGet helpFeedback

Infoscience is a service managed and provided by the Library and IT Services of EPFL. © EPFL, tous droits réservés