State events #
A standard event signature for stateful computations. The polynomial functor
StateE σ has two events:
get— returns the current state of typeσ.put s— replaces the current state withs, returningPUnit.
interpState eliminates state events from a tree over StateE σ + E,
threading an initial state through the computation and leaving every external
E-event visible. runState is its conventional runner alias. Both use a
direct productive corecursor, so their computation rules are exact equalities
rather than merely weak bisimulations.
Rocq references:
Events/State.v—stateE,interp_state,run_state.
State events over a state space σ : Type u. The answer types are:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Issue a get event, returning the current state.
Instances For
State interpretation #
One productive layer of state interpretation. The corecursor state stores the current state together with the source tree. State operations become silent steps, while external events remain visible.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Interpret state operations in t, starting from s, and return the final
state together with the computation result. External events remain visible.
The direction universe of E agrees with that of σ only because the summands
of the source signature StateE σ + E (PFunctor.add) share a direction
universe. The final result universe is independent.
Equations
Instances For
Conventional runner name for interpState.
Equations
- t.runState s = t.interpState s