函数式程序员的结构归纳原理
Structural Induction Principles for Functional Programmers
摘要:
用户定义的递归类型是现代函数式程序设计语言(如Haskell、Clean和ML语言家族)的基本特征。由递归类型结构上的递归定义的程序的性质一般用递归类型上的结构归纳法来证明。如何从数据类型声明中生成结构归纳原理在定理证明领域是众所周知的。这些方法值得在函数式编程社区中更好地了解。现有的函数式编程教科书掩盖了这方面的内容。然而,如果函数式程序员不知道如何写出一个新类型的结构归纳原理,他们又该如何推理呢?在本文中,我们描述了一个算法,以产生结构归纳原则,从数据类型声明。我们还讨论了这些方法是如何在怀俄明大学的函数式编程课程中教授的。该算法的Haskell实现包含在附录中。
英文摘要:
User defined recursive types are a fundamental feature of modern functional programming languages like Haskell, Clean, and the ML family of languages. Properties of programs defined by recursion on the structure of recursive types are generally proved by structural induction on the type. It is well known in the theorem proving community how to generate structural induction principles from data type declarations. These methods deserve to be better know in the functional programming community. Existing functional programming textbooks gloss over this material. And yet, if functional programmers do not know how to write down the structural induction principle for a new type - how are they supposed to reason about it? In this paper we describe an algorithm to generate structural induction principles from data type declarations. We also discuss how these methods are taught in the functional programming course at the University of Wyoming. A Haskell implementation of the algorithm is included in an appendix.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。