Cohesive Systems logoCOHESIVE SYSTEMS

Search Cohesive Systems

Ready

Search Cohesive Systems

Find product pages, building blocks, technical articles, and graph definitions.

Algebras and Coalgebras

Algebras and coalgebras provide complementary ways to model construction and behavior.

An algebra consumes structure into a value:

FAAF A\to A

A coalgebra unfolds a value into observable structure or next behavior:

AFAA\to FA

Algebras

Algebras are useful for folds, accumulation, interpretation, and summarization.

Examples:

  • Folding committed events into state samples.
  • Accumulating observations into a projection.
  • Interpreting a command value into a transition decision.
  • Reducing validation results into accept, reject, or nil.

Coalgebras

Coalgebras are useful for behavior, observation, transition systems, and processes that expose next steps.

Examples:

  • A state machine exposing possible next transitions.
  • A process exposing its next required input, timeout, or command.
  • A behavior exposing current value and future evolution.
  • An observer exposing what it can observe, emit, or request next.

Algebras and coalgebras are connected to event-state duality. Folding events into state is algebraic. Observing state for possible events or future behavior is coalgebraic. Neither side fully replaces the other.

Related concepts: behavior, event-state duality, event, state, transition, observer, process graphs, duality and symmetry.