论文标题

编程变质算法:类型驱动算法设计的实验

Programming Metamorphic Algorithms: An Experiment in Type-Driven Algorithm Design

论文作者

Ko, Hsiang-Shang

论文摘要

在依赖类型的编程中,可以将基本结构属性的证据隐式嵌入到程序中,而无需明确编写。除了保留撰写单独的证据的努力外,相应键入的编程的最显着和迷人的方面是,它使交互式类型驱动的开发的想法更加强大,在这种想法中,表达类型的信息成为有用的提示,可以帮助程序员完成程序。不过,没有很多尝试利用这个想法的全部潜力的尝试。作为偏离常规属性的涉及依赖性键入的编程,并且证明了交互式类型驱动的开发的想法具有更大的潜力,我们在?类型驱动的算法设计中进行了一个实验?:我们开发了算法?我们从它们在成熟类型中提供的规格中从互动中提供了有用的互动,以了解互动的环境。我们选择的算法问题是变质,其定义行为正在消耗数据结构来计算中间值,然后从该值中产生尾巴结构,但是还有其他方法可以计算变质。我们在相互键入的语言AGDA提供的交互式开发环境中开发了Gibbons的流媒体算法和中ano的拼图模型,将有关这些算法的直觉思想转变为正式条件和正式条件和程序,这些条件和程序是正确的。

In dependently typed programming, proofs of basic, structural properties can be embedded implicitly into programs and do not need to be written explicitly. Besides saving the effort of writing separate proofs, a most distinguishing and fascinating aspect of dependently typed programming is that it makes the idea of interactive type-driven development much more powerful, where expressive type information becomes useful hints that help the programmer to complete a program. There have not been many attempts at exploiting the full potential of the idea, though. As a departure from the usual properties dealt with in dependently typed programming, and as a demonstration that the idea of interactive type-driven development has more potential to be discovered, we conduct an experiment in ?type-driven algorithm design?: we develop algorithms from their specifications encoded in sophisticated types, to see how useful the hints provided by a type-aware interactive development environment can be. The algorithmic problem we choose is metamorphisms, whose definitional behaviour is consuming a data structure to compute an intermediate value and then producing a codata structure from that value, but there are other ways to compute metamorphisms. We develop Gibbons?s streaming algorithm and Nakano?s jigsaw model in the interactive development environment provided by the dependently typed language Agda, turning intuitive ideas about these algorithms into formal conditions and programs that are correct by construction.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源