## On the implementation of construction functions for non-free concrete data types

Venue: | in "16th European Symposium on Programming - ESOP’07 |

Citations: | 9 - 0 self |

### BibTeX

@INPROCEEDINGS{Blanqui_onthe,

author = {Frédéric Blanqui and Thérèse Hardin and Pierre Weis},

title = {On the implementation of construction functions for non-free concrete data types},

booktitle = {in "16th European Symposium on Programming - ESOP’07},

year = {},

pages = {00095110}

}

### OpenURL

### Abstract

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 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. 1

### Citations

751 | Rewrite systems
- Dershowitz, Jouannaud
- 1992
(Show Context)
Citation Context ...eral theorem for the existence of valid families of construction functions based on rewriting theory. We recall the notions of rewriting and completion. The interested reader may find more details in =-=[8]-=-. Standard rewriting. A rewrite rule is an ordered pair of terms (l, r) written l → r. A rule is left-linear if no variable occurs twice in its left hand side l. As usual, the set Pos(t) of positions ... |

141 | Views: a way for pattern matching to cohabit with data abstraction
- Wadler
- 1987
(Show Context)
Citation Context ...tunately, abstract data types preclude pattern matching, a very useful feature of modern programming languages [10,11,16,15]. There have been various attempts to combine both features in some way.In =-=[23]-=-, P. Wadler proposed the mechanisms of views. A view on an ADT α is given by providing a concrete data type (CDT) γ and two functions in : α → γ and out : γ → α such that in ◦ out = idγ and out ◦ in =... |

135 |
Complete sets of reductions for some equational theories
- Peterson, Stickel
- 1981
(Show Context)
Citation Context ...R,AC is confluent modulo AC if (← ∗ R,AC =AC→ ∗ R,AC ) ⊆ (→∗ R,AC =AC← ∗ R,AC ). Completion modulo AC. Given a finite set E of equations and an ACcompatible reduction ordering ≻, completion modulo AC =-=[18]-=- tries to find a finite set R of rules such that: • R is included in ≻, • →R,AC is confluent modulo AC, • E and R ∪ EAC have same theory: =E = =R∪EAC. Definition 10 A theory E has a complete presentat... |

92 |
98 language and libraries: The Revised Report Cambridge
- Jones, Haskell
- 2003
(Show Context)
Citation Context ...ns. Hence, an invariant can be ensured by using appropriate construction functions. Unfortunately, abstract data types preclude pattern matching, a very useful feature of modern programming languages =-=[10,11,16,15]-=-. There have been various attempts to combine both features in some way.In [23], P. Wadler proposed the mechanisms of views. A view on an ADT α is given by providing a concrete data type (CDT) γ and ... |

65 | A Pattern Matching Compiler for Multiple Target Languages
- Moreau, Ringeissen, et al.
- 2003
(Show Context)
Citation Context ...ns. Hence, an invariant can be ensured by using appropriate construction functions. Unfortunately, abstract data types preclude pattern matching, a very useful feature of modern programming languages =-=[10,11,16,15]-=-. There have been various attempts to combine both features in some way.In [23], P. Wadler proposed the mechanisms of views. A view on an ADT α is given by providing a concrete data type (CDT) γ and ... |

57 |
Complexity of Matching Problems
- Benanav, Kapur, et al.
- 1987
(Show Context)
Citation Context ...y of construction functions is valid. � The construction functions described in the proof are not very efficient since they are based on rewriting with pattern matching modulo AC, which is NPcomplete =-=[1]-=-, and do not take advantage of the fact that, by definition of PDTs, they are only applied to terms already in normal form. We can therefore wonder whether they can be defined in a more efficient way ... |

28 |
Pattern Matching with Abstract Data Types
- Burton, Cameron
- 1993
(Show Context)
Citation Context ...sider for instance the translations between cartesian and polar coordinates), these views have never been implemented. Following the suggestion of W. Burton and R. Cameron to use the in function only =-=[3]-=-, some propositions have been made for various programming languages but none has been implemented yet [4,17]. In [3], W. Burton and R. Cameron proposed another very interesting idea which seems to ha... |

22 | Views for standard ML
- Okasaki
- 1998
(Show Context)
Citation Context ...implemented. Following the suggestion of W. Burton and R. Cameron to use the in function only [3], some propositions have been made for various programming languages but none has been implemented yet =-=[4,17]-=-. In [3], W. Burton and R. Cameron proposed another very interesting idea which seems to have attracted very little attention. An ADT must provide construction and observation functions. When an ADT i... |

17 |
Laws in Miranda
- Thompson
(Show Context)
Citation Context ...there exists a representative for each equivalence class and, if so, whether a representative of C(t1 . . . tn) can be efficiently computed knowing that t1 . . . tn are themselves representatives. In =-=[21,22]-=-, S. Thompson describes a mechanism introduced in the Miranda functional programming language for implementing such non-free concrete data types without precluding pattern matching. The idea is to pro... |

15 |
Completeness of hierarchical combinations of term rewriting systems
- Rao
(Show Context)
Citation Context ... expected by using or extending results on the modularity of completeness for the combination of rewrite systems. The completeness of hierarchical combinations of non-AC-rewrite systems is studied in =-=[19]-=-. Note however that the modularity of confluence for AC-rewrite systems has been formally established only recently in [14]. Note that the construction function definitions of type 1 or 2 provide the ... |

14 |
The Objective Caml system release 3.09, Documentation and user’s
- Leroy, Doligez, et al.
- 2005
(Show Context)
Citation Context ...ns. Hence, an invariant can be ensured by using appropriate construction functions. Unfortunately, abstract data types preclude pattern matching, a very useful feature of modern programming languages =-=[10,11,16,15]-=-. There have been various attempts to combine both features in some way.In [23], P. Wadler proposed the mechanisms of views. A view on an ADT α is given by providing a concrete data type (CDT) γ and ... |

6 |
Views: An Extension to Haskell Pattern Matching. http://haskell.org/development/views.html
- Burton, Meijer, et al.
- 1996
(Show Context)
Citation Context ...implemented. Following the suggestion of W. Burton and R. Cameron to use the in function only [3], some propositions have been made for various programming languages but none has been implemented yet =-=[4,17]-=-. In [3], W. Burton and R. Cameron proposed another very interesting idea which seems to have attracted very little attention. An ADT must provide construction and observation functions. When an ADT i... |

6 |
Lawful functions and program verification
- Thompson
- 1990
(Show Context)
Citation Context ...there exists a representative for each equivalence class and, if so, whether a representative of C(t1 . . . tn) can be efficiently computed knowing that t1 . . . tn are themselves representatives. In =-=[21,22]-=-, S. Thompson describes a mechanism introduced in the Miranda functional programming language for implementing such non-free concrete data types without precluding pattern matching. The idea is to pro... |

5 | The new Waldmeister loop at work
- Gaillourdet, Hillenbrand, et al.
(Show Context)
Citation Context ...ms have a complete presentation: (commutative) monoids, (abelian) groups, rings, etc. See [13,5] for a catalog. Moreover, there are automated tools implementing completion modulo AC. See for instance =-=[6,12]-=-. A term may have distinct R, AC-normal forms but, by confluence modulo AC, all normal forms are AC-equivalent and one can easily define a notion of normal form for AC-equivalent terms [13]: Definitio... |

5 |
Modular church-rosser modulo
- Jouannaud
(Show Context)
Citation Context ...eteness of hierarchical combinations of non-AC-rewrite systems is studied in [19]. Note however that the modularity of confluence for AC-rewrite systems has been formally established only recently in =-=[14]-=-. Note that the construction function definitions of type 1 or 2 provide the same results with call-by-value, call-by-name or lazy evaluation strategy. The detailed study of the complexity of theses d... |

2 |
Canonical forms in finitely presented algebras. Research Notes in Theoretical Computer Science
- Chenadec
- 1986
(Show Context)
Citation Context ...patible reduction ordering for which the AC-completion of E¬AC successfully terminates.Many interesting systems have a complete presentation: (commutative) monoids, (abelian) groups, rings, etc. See =-=[13,5]-=- for a catalog. Moreover, there are automated tools implementing completion modulo AC. See for instance [6,12]. A term may have distinct R, AC-normal forms but, by confluence modulo AC, all normal for... |

2 |
version 0.4.1
- Zenon
- 2006
(Show Context)
Citation Context ...rst-class citizens. Their compilation produces both a file checkable by the theorem prover Coq [7] and a OCaml source code. Proofs are done either within Coq or via the automatic theorem prover Zenon =-=[9]-=-, which issues a Coq file when it successes. Every Focal unit has a special field, giving the type of the data manipulated in this unit. Thus, it would be very interesting to do a full integration of ... |

1 |
Computational problems in abstract algebra, chapter Simple word problems in universal algebra
- Bendix, Knuth
- 1970
(Show Context)
Citation Context ... confluent and terminating, then every term has a unique normal form. Standard completion. Given a finite set E of equations and a reduction ordering ≻, the standard Knuth-Bendix completion procedure =-=[2]-=- tries to find a finite set R of rewrite rules such that: • R is included in ≻, • →R is confluent, • R and E have same theory: =E = =R. Note that completion may fail or not terminate but, in case of s... |

1 |
Compilation de formes canoniques dans les thories quationnelles
- Hullot
- 1980
(Show Context)
Citation Context ...patible reduction ordering for which the AC-completion of E¬AC successfully terminates.Many interesting systems have a complete presentation: (commutative) monoids, (abelian) groups, rings, etc. See =-=[13,5]-=- for a catalog. Moreover, there are automated tools implementing completion modulo AC. See for instance [6,12]. A term may have distinct R, AC-normal forms but, by confluence modulo AC, all normal for... |

1 |
Private constructors
- Weis
(Show Context)
Citation Context ... only the construction functions can be used for that purpose. Therefore, one can both ensure some invariants and offer pattern matching. These types have been introduced in OCaml by the third author =-=[24]-=- under the name of concrete data type with private constructors, or private data type (PDT) for short. Now, many invariants on concrete data types can be related to some equational theory. Take for in... |