4. The numbers $2 x, 1, y-1$ form an arithmetic sequence in the given order, and $y+3,|x+1|+|x-1|$, $\cos (\arccos x)$ form a geometric sequence in the given order. Then $x+y+x y=$
4. 3.

Since $2 x, 1, y-1$ form an arithmetic sequence, we have
$$
2 x+y-1=2 \Rightarrow y=3-2 x \text {. }
$$

And $\cos (\arccos x)=x,-1 \leqslant x \leqslant 1$, it follows that,
$$
|x+1|+|x-1|=2 \text {. }
$$

From the second condition, we get $\quad(y+3) x=4$.
Substituting (1) into (2) yields
$$
2 x^{2}-6 x+4=0 \text {. }
$$

Solving gives $x=1, x=2$ (discard).
$\therefore$ The solution that satisfies the conditions is $x=1, y=1$.
Thus, $x+y+x y=3$.