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.
Similar content being viewed by others
References
Melquiond, G.: Inf. Comput. 216 (14) (2012). doi:10.1016/j.ic.2011.09.005
Vafeiadis, V.: In: ITP, Lecture Notes in Computer Science, vol. 7998, pp. 328–337. Springer (2013)
Knuth, D. E.: The Art of Computer Programming, vol. 4A, chap. 7.1.4. Addison-Wesley (2011), Binary decision diagrams
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
Verma, K.N., Goubault-Larrecq, J.: Reflecting BDDs in Coq. Rapport de recherche RR-3859. INRIA (2000)
Braibant, T., Jourdan, J.H., Monniaux, D.: Supplementary Material. https://github.com/braibant/hash-consing-coq
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)
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
The Why3 platform 0.80. http://why3.lri.fr
Huet, G.: Constructive Computation Theory. Course notes, available at http://yquem.inria.fr/huet/PUBLIC/CCT.pdf
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)
Sozeau, M.: Subset coercions in Coq. In: TYPES, vol. 4502., pp. 237–252, Lecture Notes in Computer Science. Springer (2007)
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
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 Programming
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.)
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
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
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
Ortner, V., Schirmer, N.: Verification of BDD Normalization. In: TPHOLs, vol. 3603, pp. 261–277. Springer (2005), Lecture Notes in Computer Science
Boyer, R. S., Hunt Jr., W. A.: Function memoization and unique object representation for ACL2 functions In: ACL2, pp. 81–89. ACM (2006)
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
Goubault-Larrecq, J. HimML: HimML is a map-oriented ML (2008), http://www.lsv.ens-cachan.fr/goubault/himml-dwnld.html
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
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Braibant, T., Jourdan, JH. & Monniaux, D. Implementing and Reasoning About Hash-consed Data Structures in Coq. J Autom Reasoning 53, 271–304 (2014). https://doi.org/10.1007/s10817-014-9306-0
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10817-014-9306-0