Some algebra

Software engineering needs it

State transformations

s' = f(i, s)

Given an input and the current state of a system, when a transition function is applied to them, a new state in the system is produced.

s : current state

s': new state

i : input

f : transition function

A more general rule is:

s' = f(i, s, e)

e: environment (higher level parameter)

A transition function including an empty-set environment {}, or a non-empty one which doesn't contribute to the transition, is called pure, while when the environment is a non-empty set, the transition function is called impure.

Hypothesis: in an impure transition function, it is always possible to extract a lower order pure transition function which does not depend on the environment. This extracted function is often defined functional core, while the higher order function is often defined imperative shell.