[Paper Review] State monads and their algebras
This paper establishes that the state monad functor $ U: X \mapsto X^S $ is monadic in cartesian closed categories when the state object $ S $ is non-empty and the category has regular epi-mono factorization. It proves that the comparison functor from the base category to the category of $ T $-algebras is an equivalence, showing that $ T $-algebras are precisely the exponential objects $ X^S $ with evaluation maps, and provides an equational presentation of these algebras using a signature with state update and lookup operations.
State monads in cartesian closed categories are those defined by the familiar adjunction between product and exponential. We investigate the structure of their algebras, and show that the exponential functor is monadic provided the base category is sufficiently regular, and the exponent is a non-empty object.
Motivation & Objective
- To determine under what categorical conditions the state monad functor $ U: X \mapsto X^S $ is monadic.
- To characterize the structure of $ T $-algebras for the state monad $ T = UF $, where $ F(X) = S \times X $ and $ U(X) = X^S $.
- To show that the comparison functor $ K: \mathbf{C} \to \mathbf{Alg}^T $ is an equivalence, implying monadicity of $ U $, under regularity and non-emptiness conditions on $ S $.
- To provide an equational presentation of $ T $-algebras using a signature with state lookup and update operations, aligning with functional programming semantics.
Proposed method
- Uses Beck's monadicity criterion to verify monadicity of the functor $ U: X \mapsto X^S $ in cartesian closed categories.
- Constructs an inverse functor $ L: \mathbf{Alg}^T \to \mathbf{C} $ to the comparison functor $ K $, mapping $ T $-algebras to their underlying sets of states.
- Defines a natural isomorphism between $ LK $ and the identity on $ \mathbf{C} $, and between $ KL $ and the identity on $ \mathbf{Alg}^T $, proving equivalence.
- Introduces a signature $ \Sigma $ with a lookup symbol $ \mathtt{l} $ of arity $ S $ and update symbols $ \mathtt{u}_s $ of arity 1, and an equational theory $ E $ capturing state behavior.
- Shows that $ T $-algebras correspond exactly to $ \langle \Sigma, E \rangle $-algebras, with $ A^S $ as the canonical model.
- Establishes that evaluation morphisms $ \epsilon_Y: S \times Y^S \to Y $ are split epimorphisms, and $ q_Y^*: Y \to Y^S $ is a monomorphism, enabling the construction of the isomorphism $ \xi_Y $.
Experimental results
Research questions
- RQ1Under what conditions is the state monad functor $ U: X \mapsto X^S $ monadic in a cartesian closed category?
- RQ2What is the precise categorical structure of $ T $-algebras for the state monad $ T = UF $, where $ F(X) = S \times X $?
- RQ3Can the category of $ T $-algebras be equivalent to the base category $ \mathbf{C} $, and if so, under what assumptions on $ \mathbf{C} $ and $ S $?
- RQ4How can the algebras of the state monad be presented using a finite equational theory in the context of cartesian closed categories?
- RQ5Do the equational axioms from functional programming (e.g., from [5]) coincide with the categorical structure of $ T $-algebras when both interpretations are available?
Key findings
- The functor $ U: X \mapsto X^S $ is monadic in any cartesian closed category $ \mathbf{C} $ that admits regular epi-mono factorization and for which the state object $ S $ is non-empty.
- The comparison functor $ K: \mathbf{C} \to \mathbf{Alg}^T $, sending $ Y \mapsto \langle Y^S, \epsilon_Y^S \rangle $, is an equivalence of categories.
- Every $ T $-algebra is isomorphic to an algebra of the form $ \langle Y^S, \epsilon_Y^S \rangle $, meaning $ T $-algebras are precisely the exponential objects $ Y^S $ equipped with evaluation.
- The category of $ T $-algebras is equivalent to the category of $ \langle \Sigma, E \rangle $-algebras, where $ \Sigma $ includes a lookup operation $ \mathtt{l} $ and update operations $ \mathtt{u}_s $, and $ E $ encodes state consistency axioms.
- The evaluation map $ \epsilon_Y: S \times Y^S \to Y $ is a split epimorphism, and the map $ q_Y^*: Y \to Y^S $ is a monomorphism, enabling the construction of a natural isomorphism $ \xi_Y $ that witnesses the equivalence.
- In the category of sets, the $ T $-algebra structure on $ Y^S $ corresponds exactly to the standard interpretation of stateful computations with state lookup and update.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.