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

10/30/2020
by   Hsiang-Shang Ko, et al.
0

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.

READ FULL TEXT

page 4

page 5

page 6

page 7

page 13

page 22

page 24

page 27

research
01/10/2019

PML 2 : Integrated Program Verification in ML

We present the PML 2 language, which provides a uniform environment for ...
research
09/02/2020

Check Your (Students') Proofs-With Holes

Cyp (Check Your Proofs) (Durner and Noschinski 2013; Traytel 2019) verif...
research
08/30/2017

Type Safe Redis Queries: A Case Study of Type-Level Programming in Haskell

Redis is an in-memory data structure store, often used as a database, wi...
research
12/03/2020

Quantum Hoare Type Theory

As quantum computers become real, it is high time we come up with effect...
research
07/20/2022

Auto-active Verification of Graph Algorithms, Written in OCaml

Functional programming offers the perfect ground for building correct-by...
research
10/09/2021

Toward Hole-Driven Development with Liquid Haskell

Liquid Haskell is an extension to the Haskell programming language that ...

Please sign up or login with your details

Forgot password? Click here to reset