Idempotence

Idempotence is a relatively trivial concept that has many real world consequences.

Definition

Idempotence is the property of certain operations where they can be applied multiple times without changing the result beyond the initial application.

More specifically, we say an element in a set equipped with a binary operator is said to be idempotent under if .
The binary operation is said to be idempotent if for all .

For example, in elevators, if you press, say, floor 5, you have set your destination to floor 5. Subsequent pushes of this button do not change the request.

Examples

  • In the GCD domain, GCD and LCM are idempotent
  • In the boolean ring, multiplication is idempotent
  • The absolute value function is idempotent
    • That is, for all
  • The floor, ceiling, and fractional-part functions are idempotent
  • If a file transfer is interrupted, it can resume if it is idempotent
  • Pretty printing is idempotent. That is, if something is already "pretty", pretty-printing will do nothing.

An idempotent token is a unique token that can be used to keep track of requests to make them idempotent.