Abstract
Many algorithms use concrete data types with some additional invariants. The set of values satisfying the invariants is often a set of representatives for the equivalence classes of some equational theory. For instance, a sorted list is a particular representative wrt commutativity. Theories like associativity, neutral element, idempotence, etc. are also very common. Now, when one wants to combine various invariants, it may be difficult to find the suitable representatives and to efficiently implement the invariants. The preservation of invariants throughout the whole program is even more difficult and error prone. Classically, the programmer solves this problem using a combination of two techniques: the definition of appropriate construction functions for the representatives and the consistent usage of these functions ensured via compiler verifications. The common way of ensuring consistency is to use an abstract data type for the representatives; unfortunately, pattern matching on representatives is lost. A more appealing alternative is to define a concrete data type with private constructors so that both compiler verification and pattern matching on representatives are granted. In this paper, we detail the notion of private data type and study the existence of construction functions. We also describe a prototype, called Moca, that addresses the entire problem of defining concrete data types with invariants: it generates efficient construction functions for the combination of common invariants and builds representatives that belong to a concrete data type with private constructors.
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Benanav, D., Kapur, D., Narendran, P.: Complexity of matching problems. J. of Symbolic Computation 3(1-2), 203–216 (1987)
Bendix, P., Knuth, D.: Simple word problems in universal algebra. In: Leech, J. (ed.) Computational problems in abstract algebra, Pergamon Press, Oxford (1970)
Burton, F., Cameron, R.: Pattern matching with abstract data types. J. of Functional Programming 3(2), 171–190 (1993)
Burton, W., et al.: Views: An extension to Haskell pattern matching (1996), http://www.haskell.org/extensions/views.html
Le Chenadec, P.: Canonical forms in finitely presented algebras. Research notes in theoretical computer science. Pitman, London (1986)
Contejean, E., et al.: CiME version 2.02. LRI, CNRS UMR 8623, Université Paris-Sud, France (2004), http://cime.lri.fr/
Coq Development Team: The Coq Proof Assistant Reference Manual, Version 8.0. INRIA, France (2006), http://coq.inria.fr/
Dershowitz, N., Jouannaud, J.-P.: Rewrite systems. In: van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science, vol. B, North-Holland, Amsterdam (1990)
Doligez, D.: Zenon, version 0.4.1 (2006), http://focal.inria.fr/zenon/
Doligez, D., et al.: The Objective Caml system release 3.09, Documentation and user’s manual. INRIA, France (2005), http://caml.inria.fr/
Jones, S.P.: Haskell 98 Language and Libraries, The revised report. Cambridge University Press, Cambridge (2003)
Gaillourdet, J.-M., et al.: The new Waldmeister loop at work. In: Baader, F. (ed.) CADE 2003. LNCS (LNAI), vol. 2741, Springer, Heidelberg (2003)
Hullot, J.-M.: Compilation de formes canoniques dans les théories équationnelles. PhD thesis, Université Paris 11, France (1980)
Jouannaud, J.-P.: Modular church-rosser modulo. In: Pfenning, F. (ed.) RTA 2006. LNCS, vol. 4098, Springer, Heidelberg (2006)
Moreau, P.-E., et al.: Tom Manual version 2.3. INRIA & LORIA, Nancy, France (2006), http://tom.loria.fr/
Moreau, P.-E., Ringeissen, C., Vittek, M.: A pattern matching compiler for multiple target languages. In: Hedin, G. (ed.) CC 2003 and ETAPS 2003. LNCS, vol. 2622, Springer, Heidelberg (2003)
Okasaki, C.: Views for standard ML. In: Proc. of ML’98 (1998)
Peterson, G., Stickel, M.: Complete sets of reductions for some equational theories. J. of the ACM 28(2), 233–264 (1981)
Rao, K.: Completeness of hierarchical combinations of term rewriting systems. In: Shyamasundar, R.K. (ed.) Foundations of Software Technology and Theoretical Computer Science. LNCS, vol. 761, Springer, Heidelberg (1993)
Rioboo, R., Doligez, D., Hardin, T.: all. FoCal Reference Manual, version 0.3.1. Université Paris 6, CNAM & INRIA (2005), http://focal.inria.fr/
Thompson, S.: Laws in Miranda. In: Proc. of LFP’86 (1986)
Thompson, S.: Lawful functions and program verification in Miranda. Science of Computer Programming 13(2-3), 181–218 (1990)
Wadler, P.: Views: a way for pattern matching to cohabit with data abstraction. In: Proc. of POPL’87 (1987)
Weis, P.: Private constructors in OCaml (2003), http://alan.petitepomme.net/cwn/2003.07.01.html#5
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer Berlin Heidelberg
About this paper
Cite this paper
Blanqui, F., Hardin, T., Weis, P. (2007). On the Implementation of Construction Functions for Non-free Concrete Data Types. In: De Nicola, R. (eds) Programming Languages and Systems. ESOP 2007. Lecture Notes in Computer Science, vol 4421. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-71316-6_8
Download citation
DOI: https://doi.org/10.1007/978-3-540-71316-6_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-71314-2
Online ISBN: 978-3-540-71316-6
eBook Packages: Computer ScienceComputer Science (R0)