一句话:利用 Beck 单子性定理,从伴随系统化构造状态-效应三角,统一多种程序语义单子。
在程序语言语义中,程序既可视为状态变换器,也可视为谓词变换器。作者此前引入的 state-and-effect triangle 用范畴论刻画二者关系,其核心是状态变换器与谓词变换器之间的伴随。本文利用 Jon Beck 单子性定理中的经典结果,给出一种从任意伴随系统系统化构造此类三角的通用配方。该方法的力量通过大量实例得到展示,覆盖程序语义中出现的多种单子,包括(概率)幂域。
In the semantics of programming languages one can view programs as state transformers, or as predicate transformers. Recently the author has introduced state-and-effect triangles which capture this situation categorically, involving an adjunction between state- and predicate-transformers. The current paper exploits a classical result in category theory, part of Jon Beck's monadicity theorem, to systematically construct such a state-and-effect triangle from an adjunction. The power of this construction is illustrated in many examples, covering many monads occurring in program semantics, including (probabilistic) power domains.