We gratefully acknowledge support from
the Simons Foundation and member institutions.
Full-text links:

Download:

Current browse context:

cs.PL

Change to browse by:

cs

References & Citations

DBLP - CS Bibliography

Bookmark

(what is this?)
CiteULike logo BibSonomy logo Mendeley logo del.icio.us logo Digg logo Reddit logo ScienceWISE logo

Computer Science > Programming Languages

Title: Calculating a backtracking algorithm: an exercise in monadic program derivation

Authors: Shin-Cheng Mu
Abstract: Equational reasoning is among the most important tools that functional programming provides us. Curiously, relatively less attention has been paid to reasoning about monadic programs.
In this report we derive a backtracking algorithm for problem specifications that use a monadic unfold to generate possible solutions, which are filtered using a $\mathit{scanl}$-like predicate. We develop theorems that convert a variation of $\mathit{scanl}$ to a $\mathit{foldr}$ that uses the state monad, as well as theorems constructing hylomorphism. The algorithm is used to solve the $n$-queens puzzle, our running example. The aim is to develop theorems and patterns useful for the derivation of monadic programs, focusing on the intricate interaction between state and non-determinism.
Subjects: Programming Languages (cs.PL)
Report number: TR-IIS-19-003, Institute of Information Science, Academia Sinica
Cite as: arXiv:2101.09409 [cs.PL]
  (or arXiv:2101.09409v1 [cs.PL] for this version)

Submission history

From: Shin-Cheng Mu [view email]
[v1] Sat, 23 Jan 2021 03:27:20 GMT (43kb)

Link back to: arXiv, form interface, contact.