F-coalgebras #
An F-coalgebra for an endofunctor F on Type is a type S together with a
structure map out : S → F S.
This is the categorical dual of MonadAlgebra: where an algebra collapses a
functor layer, a coalgebra observes one layer of structure from a state.
Main definitions #
Coalg F S: typeclass packagingout : S → F S.Coalg.Hom S₁ S₂: a functionS₁ → S₂that commutes with the structure maps (Functor.map f ∘ out = out ∘ f). Equipped with coercion,id,comp.
Relationship to Mathlib and Poly #
CategoryTheory.Endofunctor.Coalgebra in Mathlib defines coalgebras for
endofunctors on an arbitrary category. This file instead provides a Lean-native
typeclass for Type-endofunctors, following the style of MonadAlgebra.
The Type-level definition suffices for the interaction framework, where
the step functors (StepOver Γ, Machine.StepFun) are polynomial
endofunctors on Type in the sense of the Poly book (Spivak, 2022).
An F-coalgebra on S is a structure map out : S → F S.
Named Coalg to avoid collision with Mathlib.RingTheory.Coalgebra.
This is the dual of MonadAlgebra. No [Functor F] constraint is imposed on the
class itself so that the definition applies to arbitrary type-level maps.
- out : S → F S
Instances
Coalg morphisms #
A coalgebra morphism between F-coalgebras on S₁ and S₂ is a function
that commutes with the structure maps:
out
S₁ -----> F S₁
| |
f F f
| |
v v
S₂ -----> F S₂
out
In the interaction framework, coalgebra morphisms between processes correspond to forward simulations that preserve step structure.
- toFun : S₁ → S₂
The underlying function between state spaces.
Instances For
The identity coalgebra morphism.