Images of Elements under Repeated Composition of Injection form Equivalence Classes

Theorem
Let $S$ be a set.

Let $f: S \to S$ be an injection.

Let the sequence of mappings:
 * $f^0, f^1, f^2, \ldots, f^n, \ldots$

be defined as:
 * $\forall n \in \N: f^n \left({x}\right) = \begin{cases}

x & : n = 0 \\ f \left({x}\right) & : n = 1 \\ f \left({f^{n-1} \left({x}\right)}\right) & : n > 1 \end{cases}$

Let $\mathcal R \subseteq S \times S$ be the relation on $S$ defined as:
 * $\mathcal R = \left\{{\left({a, b}\right) \in S \times S: \exists k \in \Z: b = f^k \left({a}\right) \lor \exists j \in \Z: a = f^j \left({b}\right)}\right\}$

Then $\mathcal R$ is an equivalence relation.

Proof
Checking in turn each of the criteria for equivalence:

Reflexivity
By definition, $f^0$ is the identity mapping.

So by definition of $f^0$:
 * $\forall a \in S: a = f^0 \left({a}\right)$

That is:
 * $a \mathop {\mathcal R} a$

So $\mathcal R$ has been shown to be reflexive.

Symmetry
Let $a \mathop {\mathcal R} b$.

That is:
 * $b = f^k \left({a}\right)$

for some $k \in \Z$.

Let $g_k$ be the restriction of $f^k$ to its image.

From Injection to Image is Bijection, $g^k$ is a bijection.

From Inverse of Bijection is Bijection:
 * $\left({g^k}\right)^{-1} \left({b}\right) = a$

Consider the extension $\left({f^k}\right)^{-1}$ of $\left({g^k}\right)^{-1}$ to its codomain which is $S$.

From Inverse of Injection is Functional Relation, $\left({f^k}\right)^{-1} \left({b}\right) = a$ is well-defined.

By interpreting $\left({f^k}\right)^{-1} \left({b}\right) = a$ as $f^{-k} \left({b}\right) = a$, it follows that we can set $j = -k$ and so:


 * $\exists j \in \Z: f^j \left({b}\right) = a$

That is:
 * $b \mathop {\mathcal R} a$

So $\mathcal R$ has been shown to be symmetric.

Transitivity
Let $a \mathop {\mathcal R} b$ and $b \mathop {\mathcal R} c$.

That is:
 * $b = f^{k_1} \left({a}\right)$
 * $c = f^{k_2} \left({b}\right)$

where $k_1, k_2 \in \Z$.

That is:
 * $c = f^{k_2} \left({f^{k_1} \left({a}\right)}\right)$

By Composition of Repeated Compositions of Injections:
 * $c = f^{k_2} \left({f^{k_1} \left({a}\right)}\right) = f^{k_1 + k+2} \left({a}\right)$

and so:
 * $a \mathop {\mathcal R} c$

So $\mathcal R$ has been shown to be transitive.

$\mathcal R$ has been shown to be reflexive, symmetric and transitive.

Hence by definition it is an equivalence relation.