Deriving monadic quicksort (Declarative Pearl)

01/27/2021
by   Shin-Cheng Mu, et al.
0

To demonstrate derivation of monadic programs, we present a specification of sorting using the non-determinism monad, and derive pure quicksort on lists and state-monadic quicksort on arrays. In the derivation one may switch between point-free and pointwise styles, and deploy techniques familiar to functional programmers such as pattern matching and induction on structures or on sizes. Derivation of stateful programs resembles reasoning backwards from the postcondition.

READ FULL TEXT

Authors

page 1

page 2

page 3

page 4

01/23/2021

Calculating a backtracking algorithm: an exercise in monadic program derivation

Equational reasoning is among the most important tools that functional p...
03/09/2022

No Efficient Disjunction or Conjunction of Switch-Lists

It is shown that disjunction of two switch-lists can blow up the represe...
01/10/2020

State diagrams of functional programs

In the paper we introduce graphical objects (called state diagrams) rela...
03/19/2019

Elaborating Inductive Datatypes and Course-of-Values Pattern Matching to Cedille

In CDLE, a pure Curry-style type theory, it is possible to generically d...
09/19/2017

Programming from Metaphorisms

This paper presents a study of the metaphorism pattern of relational spe...
09/28/2021

Expectation-based Minimalist Grammars

Expectation-based Minimalist Grammars (e-MGs) are simplified versions of...
07/26/2017

Using Program Induction to Interpret Transition System Dynamics

Explaining and reasoning about processes which underlie observed black-b...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.