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

page 1

page 2

page 3

page 4

research
01/23/2021

Calculating a backtracking algorithm: an exercise in monadic program derivation

Equational reasoning is among the most important tools that functional p...
research
05/15/2023

Quantifier-free induction for lists

We investigate quantifier-free induction for Lisp-like lists constructed...
research
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...
research
01/10/2020

State diagrams of functional programs

In the paper we introduce graphical objects (called state diagrams) rela...
research
09/19/2017

Programming from Metaphorisms

This paper presents a study of the metaphorism pattern of relational spe...
research
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...
research
09/28/2021

Expectation-based Minimalist Grammars

Expectation-based Minimalist Grammars (e-MGs) are simplified versions of...

Please sign up or login with your details

Forgot password? Click here to reset