Skip to main content

Computing Abstract Distances in Logic Programs

  • Conference paper
  • First Online:
Book cover Logic-Based Program Synthesis and Transformation (LOPSTR 2019)

Abstract

Abstract interpretation is a well-established technique for performing static analyses of logic programs. However, choosing the abstract domain, widening, fixpoint, etc. that provides the best precision-cost trade-off remains an open problem. This is in a good part because of the challenges involved in measuring and comparing the precision of different analyses. We propose a new approach for measuring such precision, based on defining distances in abstract domains and extending them to distances between whole analyses of a given program, thus allowing comparing precision across different analyses. We survey and extend existing proposals for distances and metrics in lattices or abstract domains, and we propose metrics for some common domains used in logic program analysis, as well as extensions of those metrics to the space of whole program analyses. We implement those metrics within the CiaoPP framework and apply them to measure the precision of different analyses on both benchmarks and a realistic program.

Research partially funded by MINECO TIN2015-67522-C3-1-R TRACES project, and the Madrid P2018/TCS-4339 BLOQUES-CM program. We are also grateful to the anonymous reviewers for their useful comments.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Some of these attempts (and others) are further explained in the related work section (Sect. 6).

  2. 2.

    Actually that only guarantees that \(d'\) is a pseudo-metric. Proving that it is indeed a metric is more involved and not really relevant to our discussion.

References

  1. Armstrong, T., Marriott, K., Schachte, P., Søndergaard, H.: Boolean functions for dependency analysis: algebraic properties and efficient representation. In: Le Charlier, B. (ed.) SAS 1994. LNCS, vol. 864, pp. 266–280. Springer, Heidelberg (1994). https://doi.org/10.1007/3-540-58485-4_46

    Chapter  Google Scholar 

  2. Banda, G., Gallagher, J.P.: Analysis of linear hybrid systems in CLP. In: Hanus, M. (ed.) LOPSTR 2008. LNCS, vol. 5438, pp. 55–70. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-00515-2_5

    Chapter  Google Scholar 

  3. Bjørner, N., Gurfinkel, A., McMillan, K., Rybalchenko, A.: Horn clause solvers for program verification. In: Beklemishev, L.D., Blass, A., Dershowitz, N., Finkbeiner, B., Schulte, W. (eds.) Fields of Logic and Computation II. LNCS, vol. 9300, pp. 24–51. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-23534-9_2

    Chapter  Google Scholar 

  4. Bruynooghe, M.: A practical framework for the abstract interpretation of logic programs. J. Logic Program. 10, 91–124 (1991)

    Article  MathSciNet  Google Scholar 

  5. Bueno, F., García de la Banda, M., Hermenegildo, M.V.: Effectiveness of global analysis in strict independence-based automatic program parallelization. In: International Symposium on Logic Programming, pp. 320–336. MIT Press, November 1994

    Google Scholar 

  6. Casso, I., Morales, J.F., Lopez-Garcia, P., Hermenegildo, M.V.: Computing abstract distances in logic programs. Technical report CLIP-2/2019.0, The CLIP Lab, IMDEA Software Institute and T.U., Madrid, July 2019. http://arxiv.org/abs/1907.13263

  7. Cortesi, A., Filé, G., Winsborough, W.: Comparison of abstract interpretations. In: Kuich, W. (ed.) ICALP 1992. LNCS, vol. 623, pp. 521–532. Springer, Heidelberg (1992). https://doi.org/10.1007/3-540-55719-9_101

    Chapter  Google Scholar 

  8. Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Proceedings of POPL 1977, pp. 238–252. ACM Press (1977)

    Google Scholar 

  9. Dart, P., Zobel, J.: A Regular type language for logic programs. In: Pfenning, F. (ed.) Types in Logic Programming, pp. 157–187. MIT Press, Cambridge (1992)

    MATH  Google Scholar 

  10. De Angelis, E., Fioravanti, F., Pettorossi, A., Proietti, M.: VeriMAP: a tool for verifying programs through transformations. In: Ábrahám, E., Havelund, K. (eds.) TACAS 2014. LNCS, vol. 8413, pp. 568–574. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-642-54862-8_47

    Chapter  Google Scholar 

  11. De Raedt, L., Ramon, J.: Deriving distance metrics from generality relations. Pattern Recogn. Lett. 30(3), 187–191 (2009). https://doi.org/10.1016/j.patrec.2008.09.007

    Article  Google Scholar 

  12. Debray, S.K.: Static inference of modes and data dependencies in logic programs. ACM Trans. Program. Lang. Syst. 11(3), 418–450 (1989)

    Article  Google Scholar 

  13. Di Pierro, A., Wiklicky, H.: Measuring the precision of abstract interpretations. LOPSTR 2000. LNCS, vol. 2042, pp. 147–164. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-45142-0_9

    Chapter  Google Scholar 

  14. Garcia-Contreras, I., Morales, J.F., Hermenegildo, M.V.: Semantic code browsing. TPLP (ICLP 2016 Special Issue) 16(5–6), 721–737 (2016)

    MathSciNet  MATH  Google Scholar 

  15. García de la Banda, M., Hermenegildo, M.V.: A practical application of sharing and freeness inference. In: 1992 Workshop on Static Analysis, WSA 1992, pp. 118–125. No. 81–82 in BIGRE. IRISA, Beaulieu, September 1992

    Google Scholar 

  16. de la Banda, M.G., Hermenegildo, M.V., Bruynooghe, M., Dumortier, V., Janssens, G., Simoens, W.: Global analysis of constraint logic programs. ACM TOPLAS 18(5), 564–614 (1996)

    Article  Google Scholar 

  17. Grebenshchikov, S., Gupta, A., Lopes, N.P., Popeea, C., Rybalchenko, A.: HSF(C): a software verifier based on Horn clauses. In: Flanagan, C., König, B. (eds.) TACAS 2012. LNCS, vol. 7214, pp. 549–551. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-28756-5_46

    Chapter  Google Scholar 

  18. Grätzer, G.: General Lattice Theory, 2nd edn. (1998). https://doi.org/10.1007/978-3-0348-7633-9

  19. Gurfinkel, A., Kahsai, T., Komuravelli, A., Navas, J.A.: The SeaHorn verification framework. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 343–361. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21690-4_20

    Chapter  Google Scholar 

  20. Hermenegildo, M., Puebla, G., Bueno, F., Lopez-Garcia, P.: Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Sci. Comput. Progr. 58(1–2), 115–140 (2005)

    Article  MathSciNet  Google Scholar 

  21. Hermenegildo, M., Warren, R., Debray, S.K.: Global flow analysis as a practical compilation tool. JLP 13(4), 349–367 (1992)

    Article  Google Scholar 

  22. Horn, A., Tarski, A.: Measures in Boolean algebras. Trans. Am. Math. Soc. 64(3), 467–497 (1948)

    Article  MathSciNet  Google Scholar 

  23. Hutchinson, A.: Metrics on terms and clauses. In: van Someren, M., Widmer, G. (eds.) ECML 1997. LNCS, vol. 1224, pp. 138–145. Springer, Heidelberg (1997). https://doi.org/10.1007/3-540-62858-4_78

    Chapter  Google Scholar 

  24. Jacobs, D., Langen, A.: Accurate and efficient approximation of variable aliasing in logic programs. In: North American Conference on Logic Programming (1989)

    Google Scholar 

  25. Kafle, B., Gallagher, J.P., Morales, J.F.: Rahft: a tool for verifying horn clauses using abstract interpretation and finite tree automata. In: Chaudhuri, S., Farzan, A. (eds.) CAV 2016. LNCS, vol. 9779, pp. 261–268. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-41528-4_14

    Chapter  Google Scholar 

  26. Kelly, A.D., Macdonald, A., Marriott, K., Søndergaard, H., Stuckey, P.J., Yap, R.H.C.: An optimizing compiler for CLP \(\mathscr {R}\). In: Montanari, U., Rossi, F. (eds.) CP 1995. LNCS, vol. 976, pp. 222–239. Springer, Heidelberg (1995). https://doi.org/10.1007/3-540-60299-2_14

    Chapter  Google Scholar 

  27. Liqat, U., et al.: Energy consumption analysis of programs based on XMOS ISA-level models. In: Gupta, G., Peña, R. (eds.) LOPSTR 2013. LNCS, vol. 8901, pp. 72–90. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-14125-1_5

    Chapter  Google Scholar 

  28. Logozzo, F., Popeea, C., Laviron, V.: Towards a quantitative estimation of abstract interpretations (extended abstract). In: Workshop on Quantitative Analysis of Software, June 2009

    Google Scholar 

  29. Madsen, M., Yee, M., Lhoták, O.: From Datalog to FLIX: a declarative language for fixed points on lattices. In: PLDI, pp. 194–208. ACM (2016)

    Google Scholar 

  30. Marriott, K., Søndergaard, H., Jones, N.: Denotational abstract interpretation of logic programs. ACM Trans. Program. Lang. Syst. 16(3), 607–648 (1994)

    Article  Google Scholar 

  31. Méndez-Lojo, M., Navas, J., Hermenegildo, M.V.: A flexible, (C)LP-based approach to the analysis of object-oriented programs. In: King, A. (ed.) LOPSTR 2007. LNCS, vol. 4915, pp. 154–168. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78769-3_11

    Chapter  MATH  Google Scholar 

  32. Muthukumar, K., Hermenegildo, M.: Determination of variable dependence information at compile-time through abstract interpretation. In: NACLP 1989, pp. 166–189. MIT Press, October 1989

    Google Scholar 

  33. Muthukumar, K., Hermenegildo, M.: Combined determination of sharing and freeness of program variables through abstract interpretation. In: ICLP 1991, pp. 49–63. MIT Press, June 1991

    Google Scholar 

  34. Navas, J., Bueno, F., Hermenegildo, M.: Efficient top-down set-sharing analysis using cliques. In: Van Hentenryck, P. (ed.) PADL 2006. LNCS, vol. 3819, pp. 183–198. Springer, Heidelberg (2005). https://doi.org/10.1007/11603023_13

    Chapter  Google Scholar 

  35. Navas, J., Méndez-Lojo, M., Hermenegildo, M.V.: User-definable resource usage bounds analysis for Java bytecode. In: BYTECODE 2009. ENTCS, vol. 253. Elsevier, March 2009

    Google Scholar 

  36. Nienhuys-Cheng, S.-H.: Distance between Herbrand interpretations: a measure for approximations to a target concept. In: Lavrač, N., Džeroski, S. (eds.) ILP 1997. LNCS, vol. 1297, pp. 213–226. Springer, Heidelberg (1997). https://doi.org/10.1007/3540635149_50

    Chapter  MATH  Google Scholar 

  37. Puebla, G., Bueno, F., Hermenegildo, M.: An assertion language for constraint logic programs. In: Deransart, P., Hermenegildo, M.V., Małuszynski, J. (eds.) Analysis and Visualization Tools for Constraint Programming. LNCS, vol. 1870, pp. 23–61. Springer, Heidelberg (2000). https://doi.org/10.1007/10722311_2

    Chapter  Google Scholar 

  38. Ramon, J., Bruynooghe, M.: A framework for defining distances between first-order logic objects. In: Page, D. (ed.) ILP 1998. LNCS, vol. 1446, pp. 271–280. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0027331

    Chapter  Google Scholar 

  39. Sotin, P.: Quantifying the precision of numerical abstract domains. Research report, INRIA, February 2010. https://hal.inria.fr/inria-00457324

  40. Van Roy, P., Despain, A.: High-performance logic programming with the aquarius prolog compiler. IEEE Comput. Mag. 25, 54–68 (1992)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ignacio Casso .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Casso, I., Morales, J.F., López-García, P., Giacobazzi, R., Hermenegildo, M.V. (2020). Computing Abstract Distances in Logic Programs. In: Gabbrielli, M. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2019. Lecture Notes in Computer Science(), vol 12042. Springer, Cham. https://doi.org/10.1007/978-3-030-45260-5_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-45260-5_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-45259-9

  • Online ISBN: 978-3-030-45260-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics