I am studying the following tree definition:
Let $T$ be a finite set and a function: $p: T \mathbin{\backslash} \{r\} \rightarrow T$. Then, $(T,p)$ is a tree if and only if, for all $x \in T, p^k(x) = x$ implies $k=0$.
where $r$ is the root of $T$, $p(x)$ is the father of $x$, and $p^k(x)$ is an ancestor of $x$, with $k \geq 1$.
I have the following proof of $\leftarrow$ sense of the iff:
We will show that if $T$ is not a tree, then there is an integer $k>0$ such as $p^k(y) = y$ for a $y \in T$.
There exists a $x \in T \mathbin{\backslash} \{r\}$ such as $p^k(x) \in T\mathbin{\backslash} \{r\}$ for all $k \in \{0,1,..., |T|-1 \}$. Since $|I| > |T \mathbin{\backslash} \{r\} |$, by the pigeonhole principle, there exists $i,j \in I, i < j$, such as $p^i(x) = p^j(x)$. Then, $p^k(y) = y$ with $y = p^i(x)$ and $k=j-i$.
Can someone explain to me why $p^k(p^i(x)) = p^i(x)$ with $k=j-i$ ?
This doesn't agree with your definition. You want to show that there is no periodic point. By definition, a tree is acyclic. So it suffices to show that $p$ will end up traversing a cycle. That's how you should go about contrapositive.
You also never define your set $I$.
So we know that $p^{i}(x) = p^{j}(x)$. So $p^{i}(x)$ says to iterate on $p$ $i$ times (compose $p$ with itself $i$ times). The $p^{k}$ term says let's compose $p$ a few more times with itself $(j-i$ more times to be exact) such that we have $p^{j}(x)$. You're really just counting function compositions.