非自由具体数据类型构造函数的实现
On the implementation of construction functions for non-free concrete data types
摘要:
许多算法使用具体的数据类型和一些附加的不变量。满足不变量的值的集合通常是某些方程理论的等价类的代表集合。例如,一个有序列表是一个特殊的代表wrt交换性。结合论、中性元素、恒等式等理论也很常见。现在,当人们想要组合各种不变量时,可能很难找到合适的代表并有效地实现不变量。在整个程序中保持不变量甚至更困难,也更容易出错。传统上,程序员使用两种技术的组合来解决这个问题:为代表定义适当的构造函数,以及通过编译器验证确保这些函数的一致使用。确保一致性的常用方法是为代表使用抽象数据类型;不幸的是,代表上的模式匹配丢失了。一个更有吸引力的替代方法是用私有构造函数定义一个具体的数据类型,这样就可以对代表进行编译器验证和模式匹配。在本文中,我们详细介绍了私有数据类型的概念,并研究了构造函数的存在性。我们还描述了一个原型,称为Moca,解决了整个问题.
英文摘要:
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...
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。