Journal of Automated Reasoning

, Volume 53, Issue 3, pp 271–304 | Cite as

Implementing and Reasoning About Hash-consed Data Structures in Coq

  • Thomas Braibant
  • Jacques-Henri Jourdan
  • David Monniaux
Article

Abstract

We report on four different approaches to implementing hash-consing in Coq programs. The use cases include execution inside Coq, or execution of the extracted OCaml code. We explore the different trade-offs between faithful use of pristine extracted code, and code that is fine-tuned to make use of OCaml programming constructs not available in Coq. We discuss the possible consequences in terms of performances and guarantees.We use the running example of binary decision diagrams and then demonstrate the generality of our solutions by applying them to other examples of hash-consed data structures.

Keywords

Coq Hash-consing Binary decision diagrams 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Melquiond, G.: Inf. Comput. 216 (14) (2012). doi:10.1016/j.ic.2011.09.005
  2. 2.
    Vafeiadis, V.: In: ITP, Lecture Notes in Computer Science, vol. 7998, pp. 328–337. Springer (2013)Google Scholar
  3. 3.
    Knuth, D. E.: The Art of Computer Programming, vol. 4A, chap. 7.1.4. Addison-Wesley (2011), Binary decision diagramsGoogle Scholar
  4. 4.
    Verma, K. N., Goubault-Larrecq, J.: Reflecting BDDs in Coq. In: Proc. ASIAN, vol. 1961, pp. 162–181. Springer (2000), LNCS. doi:10.1007/3-540-44464-5_13
  5. 5.
    Verma, K.N., Goubault-Larrecq, J.: Reflecting BDDs in Coq. Rapport de recherche RR-3859. INRIA (2000)Google Scholar
  6. 6.
    Braibant, T., Jourdan, J.H., Monniaux, D.: Supplementary Material. https://github.com/braibant/hash-consing-coq
  7. 7.
    Blanchet, B., Cousot, P., Cousot, R., Feret, J., Mauborgne, L., Miné, A., Monniaux, D., Rival, X.: In: The Essence of Computation: Complexity, Analysis, Transformation, pp. 85–108. LNCS 2566. Springer (2002)Google Scholar
  8. 8.
    Conchon, S., Filliâtre, J. C.: Type-safe modular hash-consing. In: ACM SIGPLAN Workshop on ML. Portland, Oregon (2006), http://www.lri.fr/filliatr/ftp/publis/hash-consing2.pdf
  9. 9.
    The Why3 platform 0.80. http://why3.lri.fr
  10. 10.
    Huet, G.: Constructive Computation Theory. Course notes, available at http://yquem.inria.fr/huet/PUBLIC/CCT.pdf
  11. 11.
    Charguéraud, A.: In: Chakravarty, M.M.T., Hu, Z., Danvy, O. (eds.), pp. 418–430. Proceeding of the 16th ACM SIGPLAN International Conference on Functional programming (ICFP). ACM (2011)Google Scholar
  12. 12.
    Sozeau, M.: Subset coercions in Coq. In: TYPES, vol. 4502., pp. 237–252, Lecture Notes in Computer Science. Springer (2007)Google Scholar
  13. 13.
    Jeremy Bradley, N. D.: Compositional BDD construction: A lazy algorithm. Tech. Rep. CSTR-98-005, Department of Computer Science, University of Bristol (1998), http://www.cs.bris.ac.uk/Publications/Papers/1000250.pdf
  14. 14.
    Christiansen, J., Huch, F.: A purely functional implementation of ROBDDs in Haskell. In: Nilsson, H. (ed.) Trends in Functional Programming, vol. 7, pp. 55–71. Intellect (2006), Trends in Functional ProgrammingGoogle Scholar
  15. 15.
    Beckert, B., Hähnle, R.: Verification of Object-Oriented Software: The KeY Approach, vol. 4334. LNCS, Springer (2007), doi:10.1007/978-3-540-69061-0 Schmitt, P. H. (ed.)
  16. 16.
    Bulwahn, L., Krauss, A., Haftmann, F., Erkök, L., Matthews, J.: Imperative functional programming with Isabelle/HOL. In: Theorem Proving in Higher Order Logics (TPHOL), LNCS, vol. 5170, pp. 134–149. Springer (2008), doi:10.1007/978-3-540-71067-7_14
  17. 17.
    Giorgino, M., Strecker, M.: Correctness of pointer manipulating algorithms illustrated by a verified BDD construction. In: Giannakopoulou, D., Méry, D. (eds.) Formal Methods (FM), LNCS, vol. 7436, pp. 202–216. Springer (2012), doi:10.1007/978-3-642-32759-9_18
  18. 18.
    Armand, M., Grégoire, B., Spiwack, A., Théry, L.: Extending Coq with Imperative Features and Its Application to SAT Verification. In: Proc. ITP, LNCS, vol. 6172, pp. 83–98. Springer (2010), doi:10.1007/978-3-642-14052-5_8
  19. 19.
    Ortner, V., Schirmer, N.: Verification of BDD Normalization. In: TPHOLs, vol. 3603, pp. 261–277. Springer (2005), Lecture Notes in Computer ScienceGoogle Scholar
  20. 20.
    Boyer, R. S., Hunt Jr., W. A.: Function memoization and unique object representation for ACL2 functions In: ACL2, pp. 81–89. ACM (2006)Google Scholar
  21. 21.
    Goubault, J.: HimML: Standard ML with Fast Sets and Maps. In: 5th ACM SIGPLAN Workshop on ML and its Applications (1994), http://citeseerx.ist.psu.edu/viewdoc/summary?, doi:10.1.1.40.4967
  22. 22.
    Goubault-Larrecq, J. HimML: HimML is a map-oriented ML (2008), http://www.lsv.ens-cachan.fr/goubault/himml-dwnld.html
  23. 23.
    Goubault, J.: Implementing functional languages with fast equality, sets and maps: an exercise in Hash Consing. Tech. rep. Bull S.A. Research Center (1994), http://citeseerx.ist.psu.edu/viewdoc/summary? doi:10.1.1.41.1757

Copyright information

© Springer Science+Business Media Dordrecht 2014

Authors and Affiliations

  • Thomas Braibant
    • 1
  • Jacques-Henri Jourdan
    • 1
  • David Monniaux
    • 2
  1. 1.Inria Paris-RocquencourtDomaine de VoluceauLe ChesnayFrance
  2. 2.VERIMAGCNRS & Université de GrenobleGièresFrance

Personalised recommendations