Skip to main content

Resource Usage Analysis of Logic Programs via Abstract Interpretation Using Sized Types*

  • A. SERRANO (a1), P. LOPEZ-GARCIA (a2) (a3) and M. V. HERMENEGILDO (a3) (a4)

We present a novel general resource analysis for logic programs based on sized types. Sized types are representations that incorporate structural (shape) information and allow expressing both lower and upper bounds on the size of a set of terms and their subterms at any position and depth. They also allow relating the sizes of terms and subterms occurring at different argument positions in logic predicates. Using these sized types, the resource analysis can infer both lower and upper bounds on the resources used by all the procedures in a program as functions on input term (and subterm) sizes, overcoming limitations of existing resource analyses and enhancing their precision. Our new resource analysis has been developed within the abstract interpretation framework, as an extension of the sized types abstract domain, and has been integrated into the Ciao preprocessor, CiaoPP. The abstract domain operations are integrated with the setting up and solving of recurrence equations for inferring both size and resource usage functions. We show that the analysis is an improvement over the previous resource analysis present in CiaoPP and compares well in power to state of the art systems.

Hide All

A. Serrano performed this work during his former affiliation to the IMDEA Software Institute.


This research was supported in part by projects EU FP7 318337 ENTRA, Spanish MINECO TIN2012-39391 StrongSoft and TIN2008-05624 DOVES, and Madrid TIC/1465 PROMETIDOS-CM.

Hide All
Albert, E., Genaim, S., and Masud, A. N. 2011. More Precise yet Widely Applicable Cost Analysis. In 12th Verification, Model Checking, and Abstract Interpretation (VMCAI'11), Jhala, R. and Schmidt, D., Eds. Lecture Notes in Computer Science, vol. 6538. Springer Verlag, 3853.
Bagnara, R., Pescetti, A., Zaccagnini, A., and Zaffanella, E. 2005. PURRS: Towards Computer Algebra Support for Fully Automatic Worst-Case Complexity Analysis. Tech. rep. arXiv:cs/0512056 available from
Bruynooghe, M. 1991. A practical framework for the abstract interpretation of logic programs. J. Log. Program. 10, 2, 91124.
Bueno, F., López-García, P., and Hermenegildo, M. 2004. Multivariant Non-Failure Analysis via Standard Abstract Interpretation. In 7th International Symposium on Functional and Logic Programming (FLOPS 2004). Number 2998 in LNCS. Springer-Verlag, Heidelberg, Germany, 100116.
Cousot, P. and Cousot, R. 1992. Abstract Interpretation and Applications to Logic Programs. Journal of Logic Programming 13, 2-3, 103179.
Dart, P. and Zobel, J. 1992. A Regular Type Language for Logic Programs. In Types in Logic Programming. MIT Press, 157187.
Debray, S. K. and Lin, N. W. 1993. Cost Analysis of Logic Programs. ACM Transactions on Programming Languages and Systems 15, 5 (November), 826875.
Debray, S. K., Lin, N.-W., and Hermenegildo, M. 1990. Task Granularity Analysis in Logic Programs. In Proc. of the 1990 ACM Conf. on Programming Language Design and Implementation. ACM Press, 174188.
Debray, S. K., López-García, P., Hermenegildo, M., and Lin, N.-W. 1997. Lower Bound Cost Estimation for Logic Programs. In 1997 International Logic Programming Symposium. MIT Press, Cambridge, MA, 291305.
Giesl, J., Ströder, T., Schneider-Kamp, P., Emmes, F., and Fuhs, C. 2012. Symbolic evaluation graphs and term rewriting: a general methodology for analyzing logic programs. In PPDP. ACM, 112.
Grobauer, B. 2001. Cost recurrences for DML programs. In International Conference on Functional Programming. 253–264.
Hermenegildo, M. V., Bueno, F., Carro, M., López, P., Mera, E., Morales, J., and Puebla, G. 2012. An Overview of Ciao and its Design Philosophy. Theory and Practice of Logic Programming 12, 1–2 (January), 219252.
Hoffmann, J., Aehlig, K., and Hofmann, M. 2012. Multivariate amortized resource analysis. ACM Trans. Program. Lang. Syst. 34, 3, 14.
Igarashi, A. and Kobayashi, N. 2002. Resource usage analysis. In Symposium on Principles of Programming Languages. 331–342.
López-García, P., Bueno, F., and Hermenegildo, M. 2010. Automatic Inference of Determinacy and Mutual Exclusion for Logic Programs Using Mode and Type Information. New Generation Computing 28, 2, 117206.
López-García, P., Darmawan, L., and Bueno, F. 2010. A Framework for Verification and Debugging of Resource Usage Properties. In Technical Communications of the 26th Int'l. Conference on Logic Programming (ICLP'10), Hermenegildo, M. and Schaub, T., Eds. Leibniz International Proceedings in Informatics (LIPIcs), vol. 7. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 104113.
Muthukumar, K. and Hermenegildo, M. 1989. Determination of Variable Dependence Information at Compile-Time Through Abstract Interpretation. In 1989 North American Conference on Logic Programming. MIT Press, 166189.
Muthukumar, K. and Hermenegildo, M. 1992. Compile-time Derivation of Variable Dependency Using Abstract Interpretation. Journal of Logic Programming 13, 2/3 (July), 315347.
Navas, J., Mera, E., López-García, P., and Hermenegildo, M. 2007. User-Definable Resource Bounds Analysis for Logic Programs. In 23rd International Conference on Logic Programming (ICLP'07). Lecture Notes in Computer Science, vol. 4670. Springer.
Nielson, F., Nielson, H. R., and Seidl, H. 2002. Automatic complexity analysis. In European Symposium on Programming. 243–261.
Puebla, G. and Hermenegildo, M. 1996. Optimized Algorithms for the Incremental Analysis of Logic Programs. In International Static Analysis Symposium (SAS 1996). Number 1145 in LNCS. Springer-Verlag, 270284.
Rosendahl, M. 1989. Automatic Complexity Analysis. In 4th ACM Conference on Functional Programming Languages and Computer Architecture (FPCA'89). ACM Press.
Serrano, A., Lopez-Garcia, P., Bueno, F., and Hermenegildo, M. 2013. Sized Type Analysis for Logic Programs (technical communication). In Theory and Practice of Logic Programming, 29th Int'l. Conference on Logic Programming (ICLP'13) Special Issue, On-line Supplement, Swift, T. and Lamma, E., Eds. Vol. 13 (4-5). Cambridge U. Press, 114.
Vasconcelos, P. B. and Hammond, K. 2003. Inferring cost equations for recursive, polymorphic and higher-order functional programs. In IFL, Trinder, P. W., Michaelson, G., and Pena, R., Eds. Lecture Notes in Computer Science, vol. 3145. Springer, 86101.
Vaucheret, C. and Bueno, F. 2002. More Precise yet Efficient Type Inference for Logic Programs. In International Static Analysis Symposium. Lecture Notes in Computer Science, vol. 2477. Springer-Verlag, 102116.
Wegbreit, B. 1975. Mechanical Program Analysis. Communications of the ACM 18, 9 (September), 528539.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
Type Description Title
Supplementary materials

SERRANO et al.
Resource Usage Analysis of Logic Programs via Abstract Interpretation Using Sized Types

 PDF (271 KB)
271 KB


Altmetric attention score

Full text views

Total number of HTML views: 0
Total number of PDF views: 22 *
Loading metrics...

Abstract views

Total abstract views: 148 *
Loading metrics...

* Views captured on Cambridge Core between September 2016 - 24th March 2018. This data will be updated every 24 hours.