【24h】

Dualizing Generalized Algebraic Data Types by Matrix Transposition

机译:通过矩阵换位对广义代数数据类型进行对偶

获取原文

摘要

We characterize the relation between generalized algebraic datatypes (GADTs) with pattern matching on their constructors one hand, and generalized algebraic co-datatypes (GAcoDTs) with copattern matching on their destructors on the other hand: GADTs can be converted mechanically to GAcoDTs by refunctionalization, GAcoDTs can be converted mechanically to GADTs by defunctionalization, and both defunctionalization and refunctionalization correspond to a transposition of the matrix in which the equations for each constructor/destructor pair of the (co-)datatype are organized. We have defined a calculus, GADT~T, which unifies GADTs and GAcoDTs in such a way that GADTs and GAcoDTs are merely different ways to partition the program. We have formalized the type system and operational semantics of GADT~T in the Coq proof assistant and have mechanically verified the following results: (1) The type system of GADT~ T is sound, (2) defunctionalization and refunctionalization can translate GADTs to GAcoDTs and back, (3) both transformations are type- and semantics-preserving and are inverses of each other, (4) (co-)datatypes can be represented by matrices in such a way the aforementioned transformations correspond to matrix transposition, (5) GADTs are extensible in an exactly dual way to GAcoDTs; we thereby clarify folklore knowledge about the "expression problem". We believe that the identification of this relationship can guide future language design of "dual features" for data and codata.
机译:我们一方面描述了在其构造函数上进行模式匹配的广义代数数据类型(GADT),另一方面在其析构函数上进行了模式匹配的广义代数数据类型(GAcoDTs)之间的关系:通过重新功能化,GADT可以机械地转换为GAcoDT,可以通过去官能化将GAcoDTs机械地转化为GADT,去官能化和重新官能化都对应于矩阵的转置,在该矩阵中,组织了(共)数据类型的每个构造函数/析构函数对的方程。我们定义了一种演算GADT_T,该演算将GADT和GAcoDT统一起来,以使GADT和GAcoDT只是分区程序的不同方式。我们已经在Coq证明助手中正式定义了GADT〜T的类型系统和操作语义,并机械验证了以下结果:(1)GADT〜T的类型系统是健全的;(2)脱官能和重新官能化可以将GADT转换为GAcoDT前后,(3)两种转换都是类型和语义保留的,并且彼此相反。(4)(共)数据类型可以由矩阵表示,其方式为上述转换对应于矩阵转置,(5) GADT可以以完全双重的方式扩展到GAcoDT。因此,我们澄清了有关“表达问题”的民间传说知识。我们认为,这种关系的确定可以指导数据和元数据的“双重特征”的未来语言设计。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号