当前位置: X-MOL 学术J. Funct. Program. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Elaborating dependent (co)pattern matching: No pattern left behind
Journal of Functional Programming ( IF 1.1 ) Pub Date : 2020-01-21 , DOI: 10.1017/s0956796819000182
JESPER COCKX , ANDREAS ABEL

In a dependently typed language, we can guarantee correctness of our programmes by providing formal proofs. To check them, the typechecker elaborates these programs and proofs into a low-level core language. However, this core language is by nature hard to understand by mere humans, so how can we know we proved the right thing? This question occurs in particular for dependent copattern matching, a powerful language construct for writing programmes and proofs by dependent case analysis and mixed induction/coinduction. A definition by copattern matching consists of a list of clauses that are elaborated to a case tree, which can be further translated to primitive eliminators. In previous work this second step has received a lot of attention, but the first step has been mostly ignored so far. We present an algorithm elaborating definitions by dependent copattern matching to a core language with inductive data types, coinductive record types, an identity type, and constants defined by well-typed case trees. To ensure correctness, we prove that elaboration preserves the first-match semantics of the user clauses. Based on this theoretical work, we reimplement the algorithm used by Agda to check left-hand sides of definitions by pattern matching. The new implementation is at the same time more general and less complex, and fixes a number of bugs and usability issues with the old version. Thus, we take another step towards the formally verified implementation of a practical dependently typed language.

中文翻译:

详细说明相关(共同)模式匹配:没有留下任何模式

在依赖类型语言中,我们可以通过提供形式证明来保证程序的正确性。为了检查它们,类型检查器将这些程序和证明详细说明为低级核心语言。然而,这种核心语言本质上是人类难以理解的,那么我们怎么知道我们证明了正确的事情呢?这个问题特别适用于依赖共模式匹配,这是一种强大的语言结构,用于编写程序和通过依赖案例分析和混合归纳/共归纳来证明。通过 copattern 匹配的定义由一个列表组成条款详细说明为案例树, 可以进一步翻译成原始的消除器. 在以前的工作中,这第二步受到了很多关注,但到目前为止,第一步大多被忽略了。我们提出了一种算法,通过依赖共模式匹配与具有归纳数据类型、共归纳记录类型、标识类型和由良好类型案例树定义的常量的核心语言匹配来详细说明定义。为了确保正确性,我们证明精化保留了用户子句的第一次匹配语义。基于这项理论工作,我们重新实现了 Agda 使用的算法,通过模式匹配检查定义的左侧。新的实现同时更通用、更简单,并修复了旧版本的一些错误和可用性问题。因此,我们朝着正式验证的实际依赖类型语言的实现又迈出了一步。
更新日期:2020-01-21
down
wechat
bug