Defining a piecewise function using restricted operations Question
Can the piecewise function
$$f(x) = \begin{cases}
    0 & \text{if $x > 0$} \\
    1 & \text{if $x = 0$} \\
    0 & \text{if $x < 0$} \\
\end{cases}$$
be defined using only the operations $+ , -, *, /, |\cdots|, \max$, and $\min$?

What I have tried
I can define the first and last pieces: $0$ if $x > 0$ or $x < 0$ with
$$1 - \frac{x}{x}$$
But this will fail with a division by $0$ in the case where $x = 0$
$$1 - \frac{0}{0}$$
I can fix the division error by forcing a 1 on the bottom.
$$a(x) = 1 - \frac{x}{\max(1, x) \min(-1, x)}$$
This works for most negatives and $0$ and fails when $-1 < x < 0$ and $x > 0$. When $x > 0$, $a(x) = 2$. Fixing this requires another max to check a number is positive. Defining $b(x)$ to be $2$ when $x > 0$ and $0$ when $x = 0$ or $x <= -1$ 
$$b(x) = 2\frac{\max(0, x)}{\max(1, x) \min(-1, x)}$$
Combining them to get
$$c(x) = a(x) - b(x) = 1 - \frac{x - 2\max(0, x)}{\max(1, x) \min(-1, x)}$$
This mess is what I want except when $-1 < x < 0$ and $0 < x < 1$. This is as far as I have gotten.
 A: Following Lærne's answer, I would like  to elucubrate on how the problem coould be solved with infinite operations.
Let then define $$ g(x) = \max (0, - \vert x \vert  +1)$$
This is a "tent" function, that equals $0$ if $\vert x \vert > 1$, and equals $1$ for $x = 0$, being continuous and piecewise linear.
An approximation to the function $f$ indicated by the OP can be built to any degree of accuracy as $$f(x) \approx  g(x)^n $$
(intuitively speaking, where $f(x) = 0$ or $f(x) = 1$ nothing happens upon multypling, while for any $x : 1 < g(x) < 1 , \,\,\, g(x)^k < g(x)^j $ when $ k > j$)
Fellow Mathstackexchangers more versed on convergence issues could maybe formalise the limiting operation.
 I believe $g^n \to f$ pointwise as $n \to \infty$.
A: Let's do algebra on functions, by defining for functions $f$ and $g$, $(f+g)(x) = f(x) + g(x)$, and so on with other operators.
Note that $f$ is not a continuous function.  However, $+$, $-$, $\times$, $|\dots|$, $\max$ and $\min$ all produces continuous function if you provide them continuous function.  Since all you base functions, $x \mapsto x$ and the constant functions $x \mapsto c$, are continuous on $\mathbb R$, you won't be able to create a non-continous function with finitely many operators.
That leaves only the division $\frac{\dots}{\dots}$, which is continuous on $\mathbb R \setminus \{ 0 \}$.  However it is undefined on $0$, which means that either you would be left with undefined values, which you cannot since $f$ is defined everywhere, or your denominator is guaranteed to be all positive (or all negative) and the division will operate only on a fully continuous component and your result will again be continuous.
On $\mathbb R$, your problem cannot be solved with finitely many operations of  $+$, $-$, $\times$, $\frac{\dots}{\dots}$, $|\dots|$, $\max$ and $\min$.
A: Note: The solution below is true only for integer values of $x$, i.e., $x \in \{\ldots, -3, -2, -1, 0, 1, 2, 3, \ldots\}$
Let
\begin{equation}
f(x) = 1 - \dfrac{\max [\text{abs }\{ \max(0, x)\}, \text{abs }\{ \min(0, x)\}]}{\max [1, \text{abs}(x)]}
\end{equation}


*

*Case I: When $x < 0$
\begin{align}
f(x) & = 1 - \dfrac{\max [\text{abs }\{ \max(0, x)\}, \text{abs }\{ \min(0, x)\}]}{\max [1, \text{abs}(x)]} \\
     & = 1 - \dfrac{\max [0,  \text{abs}(x)\}]}{\text{abs(x)}} = 1 - \dfrac{\text{abs}(x)}{\text{abs}(x)} = 1- 1 = 0
\end{align}

*Case II: When $x = 0$
\begin{align}
f(x) & = 1 - \dfrac{\max [\text{abs }\{ \max(0, x)\}, \text{abs }\{ \min(0, x)\}]}{\max [1, \text{abs}(x)]} \\
     & = 1 - \dfrac{\max [0, 0\}]}{1} = 1 - \dfrac{0}{\text{abs}(x)} = 1- 0 = 1
\end{align}

*Case III: When $x > 0$
\begin{align}
f(x) & = 1 - \dfrac{\max [\text{abs }\{ \max(0, x)\}, \text{abs }\{ \min(0, x)\}]}{\max [1, \text{abs}(x)]} \\
     & = 1 - \dfrac{\max [x,  0]}{x} = 1 - \dfrac{x}{x} = 1- 1 = 0
\end{align}


Edit: A simple form can be 
\begin{equation}
f(x) = 1 - \dfrac{\max[0, \text{abs}(x)]}{\max[1, \text{abs}(x)]}
\end{equation}
A: Suppose $\epsilon \rightarrow 0^+$, the piecewise function can be defined as 
\begin{equation}
f(x) = 1 - \dfrac{\max[0, \text{abs}(x)]}{\max[\epsilon, \text{abs}(x)]}
\end{equation}
A: You asked how to define your function with an infinite number of operations
from your list.
Here it is defined by means of an infinite sum:
$$
f(x) =
  \max(0,1-|x|)
 + \frac12\sum_{n=1}^\infty (\min(1,|2^n x+1|) + \min(1,|2^n x-1|) - 2).
$$
The first part of this, $\max(0,1-|x|),$ is zero except for $-1<x<1,$
where its graph is an isoceles triangle whose vertices are
$(-1,0),$ $(1,0),$ and $(0,1)$.
Each of the terms of the sum is zero except for 
$-\frac{2}{2^n}<x<\frac{2}{2^n},$ where its graph consists of two
isoceles triangles with vertices at
$\left(-\frac{2}{2^n},0\right),$ $(0,0),$ and 
$\left(-\frac{1}{2^n},-1\right)$ (first triangle)
and at $(0,0),$ $\left(\frac{2}{2^n},0\right),$ and 
$\left(\frac{1}{2^n},-1\right)$ (second triangle).
The function 
$$
f_m(x) =
  \max(0,1-|x|)
 + \frac12\sum_{n=1}^m (\min(1,|2^n x+1|) + \min(1,|2^n x-1|) - 2)
$$
defined by taking only a partial sum is zero everywhere except
for $-\frac{1}{2^m}<x<\frac{1}{2^m},$
where its graph is an isoceles triangle with vertices
$\left(-\frac{1}{2^n},0\right),$ $\left(\frac{1}{2^n},0\right),$ and 
$(0,1).$
So for any $x\neq 0,$ $f_m(x) = 0$ whenever $m$ is large enough,
whereas $f_m(0) = 1$ for all $m.$
