<s>[INST] Find all functions $f$ such that $f(x-f(y)) = f(f(x)) - f(y) - 1$ Find all functions $f : \mathbb{Z} \to \mathbb{Z}$ such that $f(x-f(y)) = f(f(x)) - f(y) - 1$. 
So far, I've managed to prove that if $f$ is linear, then either $f(x) = x + 1$ or $f(x) = -1$ must be true. I did this by plugging in $x=0$ to the above equation, which yields
$$ f(-f(y)) = f(f(0)) - f(y) - 1$$
and plugging in $x$ instead of $y$ and subtracting, this becomes
$$ f(-f(y)) - f(-f(x)) = f(x) - f(y)$$
Assuming $f(x) = ax + b$ then gives
\begin{align*}
f(-ay-b) - f(-ax-b) = ax - ay &\Rightarrow -a^2y - ab + a^2x + ab = a(x-y) \\&\Rightarrow a^2(x-y) = a(x-y) .
\end{align*}
Thus $a=1$ or $a=0$. If $a=0$, then the original equation becomes $b = b - b - 1$, thus $b=-1$. If $a=1$, the original equation becomes
$$ x-y-b+b = x+2b-y-b-1 \Longrightarrow b=1.$$
I briefly tried finding a quadratic function that works but didn't find anything. So my question is: how can I either show that $f$ must be linear or find all other representations?
 [/INST] If the functions attains $0$ at some point, it is linear and $f(n)=n+1$.
Suppose $f(y)=0$, for some $y \in \mathbb{Z}$ then we find for $x \in \mathbb{Z}$
$$f(x)=f(x-f(y))=f(f(x))-f(y)-1 = f(f(x))-1$$
So in particular $x=y$ gives $f(0)= 1$.
Now, if $f(n)=n+1$, then $x=n$ gives $$n+1 = f(n) =f(f(n))-1= f(n+1)-1$$
So $f(n+1) = n+2$, thus for $n \in \mathbb{N}$ we have $f(n) = n+1$.
For the other way, let $x=0$ and $y=n-1$ then
$$f(-n) = f(x - f(n-1)) = f(f(x)) -f(n-1) -1 =f(1) - n-1 =-n+1$$
So we see that if $f(y) =0$ for some $y \in \mathbb{Z}$, we have $f(x) = x+1$.
So we can now assume $f(x) \neq 0$ for all $x \in \mathbb{Z}$.
If there exists an $y \in \mathbb{Z}$ such that $y=f(y)$, then $f(x) =-1$.
Suppose there exists an $y \in \mathbb{Z}$ such that $f(y)=y$, then with $x=y$
$$f(0) = f(y-f(y)) = f(f(y)) - f(y) - 1 = y-y-1 =-1$$
So we have $f(0)=-1$. Then we have if $f(y+n)=y$ for $n \ge 0$ that
$$f(y+n+1) = f(y+n-f(0)) = f(f(y+n)) -f(0)-1 = f(y) =y$$
So we see that $f(y+n) = y$ for every $n \in \mathbb{N}$.
Now, if $y>0$, we would find with $x=2y$
$$y = f(y)=f(2y -f(y)) = f(f(2y))-f(y)-1 = f(y)-f(y)-1 =-1$$
So $y <0$, and then we have $-1 = f(0) = f(y +(-y)) =y$ and so we find $y=-1$.
Now, we have for all $x \in \mathbb{Z}$
$$-1 = f(0) = f(f(x) -f(x)) = f(f(f(x))) - f(x)-1$$
And so $f(x) = f(f(f(x)))$, and so if $f(-1-k)=-1$ for $k\ge 0$ we have
$$ f(-1-k) = f(-1-k-1 -f(0)) = f(f(-1-k-1)) -f(0)-1 = f(f(-1-k-1))$$
Then we let $f$ act on both sides and we get
$$-1 = f(-1) = f(f(-1-k)) = f(f(f(-1-(k+1)))) = f(-1-(k+1))$$
So we see $f(-1-n)=-1$ for all $n \in \mathbb{N}$.
So we have $f(x) = -1$ for all $x \in \mathbb{Z}$.
</s>