一句话:提出三类判定两个 monad 间不存在分配律的定理,统一既有 no-go 结果并解决 list monad 自分配等开放问题。
Monad 在计算机科学中广泛使用,并可通过 Beck 分配律复合,但构造分配律困难且易错,已有工作多给出存在性构造,缺乏判定不存在的一般技术。本文提出三类 no-go 定理,用于证明两个 monad 之间不存在分配律。第一类推广了归因于 Plotkin 的反例,覆盖此前所有针对特定 monad 对的 no-go 结果并产生大量新结论;第二、三类为全新方法,适用于多种实际情形。作者据此否定了 list monad 是否可自分配的开放问题,指出文献中的一处错误,并证实 Beck 的猜想。文章还给出两个 monad 至多存在一个分配律的条件,证明若干已知分配律的唯一性。
Monads are commonplace in computer science, and can be composed using Beck's distributive laws. Unfortunately, finding distributive laws can be extremely difficult and error-prone. The literature contains some general principles for constructing distributive laws. However, until now there have been no such techniques for establishing when no distributive law exists. We present three families of theorems for showing when there can be no distributive law between two monads. The first widely generalizes a counterexample attributed to Plotkin. It covers all the previous known no-go results for specific pairs of monads, and includes many new results. The second and third families are entirely novel, encompassing various new practical situations. For example, they negatively resolve the open question of whether the list monad distributes over itself, reveal a previously unobserved error in the literature, and confirm a conjecture made by Beck himself in his first paper on distributive laws. In addition, we establish conditions under which there can be at most one possible distributive law between two monads, proving various known distributive laws to be unique.