Given two integers $X$ and $Y$, each can be encoded in binary $X=(x_4 x_3 x_2 x_1)$ and $Y=(y_4 y_3 y_2 y_1)$, how do I encode each one of the constraints
$$|X-Y|\geq n \quad\text{and}\quad|X-Y|= n$$ when $n$ is a given natural number (say, 10) as a boolean formula over $x_1,\dots, x_4, y_1, \dots, y_4$?