I want to design a function which outputs the maximum value between two integers, something like this $f(x,y) = \begin{cases} 1, & \text{if } x > y, \\ 0, & \text{otherwise}. \end{cases}$ , using only additions, substractions and multiplications.
I would like to have a single equation $f(x,y) = x *y *x ..$ where $*$ maybe any operation from the ones mentioned above, if necessary division can be used too but preferably not.
I can restrict the operation to a finite algebraic field $Z_t$.
For equality comparison, I can define the function $EQU(x,y) = \begin{cases} 1, & \text{if } x == y, \\ 0, & \text{otherwise}. \end{cases}$
If $t$ is prime, the equality comparison can be computed like this $EQU(x,y)=1-(x-y)^\phi$, where the Euler totient $\phi(t)=t-1$, because $t$ is prime. Now, I am asking if something similar could be done for greater than comparison.
I need these comparison functions for a homomorphic encryption application where functions are computed as arithmetic circuits.
$$f(x,y) = \frac{1}{2}(x+y+\mid x-y \mid)$$