Arithmetic function to return lowest in-parameter

$$f(x,y)=\frac{x+y-|x-y|}{2}$$


Oscar gave a nice interpretation of the above formula in his follow-up question, but I'll give a dumb derivation here for completeness.

Making use of Iversonian brackets, we have

$$\min(x,y)=x[y \geq x]+y[y < x]$$

and since $[\neg p]=1-[p]$,

$$\min(x,y)=x[y \geq x]+y(1-[y \geq x])=y-(y-x)[y-x \geq 0]$$

Now, there is the identity

$$\frac{u+|u|}{2}=u[u \geq 0]$$

and so we have

$$\min(x,y)=y+\frac{x-y-|x-y|}{2}$$

which simplifies to the desired expression.

The extension to more than two arguments is no longer as compact, though, since one now has to contend with products of Iversonian brackets ($[p \land q]=[p]\cdot[q]$).