Notions of iteration range from the arguably most general Elgot iteration to a very specific Kleene iteration. The fundamental nature of Elgot iteration has been extensively explored by Bloom and Esik in the form of iteration theories, while Kleene iteration became extremely popular as an integral part of (untyped) formalisms, such as automata theory, regular expressions and Kleene algebra. Here, we establish a formal connection between Elgot iteration and Kleene iteration in the form of Elgot monads and Kleene monads, respectively. We also introduce a novel class of while-monads, which like Kleene monads admit a relatively simple description in purely algebraic terms, and like Elgot monads cover a large diversity of models that meaningfully support while-loops, but may fail to support a Kleene-style iteration operator altogether, or else fail the Kleene algebra laws.
翻译:迭代的概念范围从可以说最一般的电传到非常具体的Kleene迭代。 Bloom 和 Esik 以迭代理论的形式广泛探讨了电传的根本性质,而 Kleene 迭代作为(非类型)正规主义的一个组成部分,例如自动式的理论、 普通表达和 Kleene 代数。 这里, 我们分别建立了 Elgot 迭代和 Kleene 代迭代之间的正式联系, 分别以 Elgot monads 和 Kleene monads 的形式。 我们还引入了新型的时代代代代词, 像 Kleene monads 那样在纯粹的代数术语中接受相对简单的描述, 而像 Elgot monads 一样包含大量多样的模式, 这些模式在滑动时可以提供有意义的支持, 但是可能无法支持 Kleene 式的迭代运算操作, 或者不执行 Kleene algebra 法律 。