arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2101.09409cs.PL
收藏

计算回溯算法:一元程序推导练习

Calculating a backtracking algorithm: an exercise in monadic program derivation

Shin-Cheng Mu

摘要:

等式推理是函数式编程提供给我们的最重要的工具之一。奇怪的是,相对较少的注意力已经支付给一元程序的推理。在这份报告中,我们推导出一个回溯算法的问题规格,使用一元展开生成可能的解决方案,这是过滤使用$\mathit{scanl}$类谓词。我们开发的定理,转换的变化$\mathit{scanl}$的$\mathit{foldr}$,使用状态单子,以及定理构造hypolomorphism。该算法被用来解决$n$ -queens问题,我们的运行例子。其目的是发展定理和模式的一元程序的推导有用,重点是国家和非决定性之间的复杂的相互作用。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑