4. $[\mathbf{1 0}]$ Find all functions $f: \mathbb{R}^{+} \rightarrow \mathbb{R}^{+}$such that
$$
f(x+f(y+x y))=(y+1) f(x+1)-1
$$
for all $x, y \in \mathbb{R}^{+}$.
$\left(\mathbb{R}^{+}\right.$denotes the set of positive real numbers.)
Let $P(x, y)$ denote the assertion that
$$
f(x+f(y+x y))=(y+1) f(x+1)-1 .
$$

Claim 1. $f$ is injective. Proof: If $f(a)=f(b)$ then $P\left(x, \frac{a}{x+1}\right), P\left(x, \frac{b}{x+1}\right)$ yields $a=b$, since $f(x+1) \in \mathbb{R}^{+}$so in particular is nonzero. ○ Now $P\left(x, \frac{1}{f(x+1)}\right)$ yields
$$
f\left(x+f\left(\frac{x+1}{f(x+1)}\right)\right)=f(x+1)
$$
hence by injectivity
$$
x+f\left(\frac{x+1}{f(x+1)}\right)=x+1
$$
so that
$$
f\left(\frac{x+1}{f(x+1)}\right)=1 \text {. }
$$

By injectivity, this equals some constant $c$, so that
$$
\frac{x+1}{f(x+1)}=c
$$
for all $x \in \mathbb{R}^{+}$. Now letting $x, y>1$ in $P(x, y)$ automatically yields
$$
\frac{x}{c}+\frac{y+x y}{c^{2}}=(y+1)\left(\frac{x+1}{c}\right)-1,
$$
which immediately yields $c=1$ if we take $x, y$ large. Finally, we have $f(x+1)=x+1 \forall x \in \mathbb{R}^{+}$. Finally, $P\left(x, \frac{y}{x+1}\right)$ yields
$$
f(x+f(y))=\left(\frac{y}{x+1}+1\right) f(x+1)-1=x+y,
$$
so that fixing $y$ and letting $x>1$ yields
$$
x+f(y)=x+y,
$$
so that $f(y)=y$. This was for arbitrary positive $y$, so that $f(x)=x \forall x \in \mathbb{R}^{+}$, which clearly works.