Recently I received a programming task: There are 2 numbers, you need to output the greatest, without using conditional and bit operators, without using branching and functions. Only integer operations are allowed. After some thought, I derived the formula: $$ \forall a,b \in\mathbb{Z}\mathop{\bullet} \max(a,b)= \frac{(a+b)+(a-b)\times\Big(\big(2\times(a-b)+1\big)\mod 2\Big)}{2}$$ i.e. it behaves as follows for any integers $a$ and $b$: $$ \max(a,b)=\left\{\begin{matrix}a,& a\gt b\\b,&a\lt b\\a,&a=b\end{matrix}\right.$$
My question is: how can we strictly proof it? I mean in this formula I replaced absolute value with an expression that uses only integer operations, but I'm not pretty sure about severity.