About the notation of branched functions

When notating function definitions with case distinction, we use curly braces. We will pursue the simple question of whether this representation can be eliminated and the function can be traced back to a notation that can do without it. For example, can the function

$$f: \mathbb{R} \to \mathbb{R}, f(x) = \left\{\begin{matrix} 42, & \text{falls } x = 0 \\ x, & \text{sonst} \end{matrix}\right.$$

with the help of the four basic arithmetic operations using a one-line term?

This is impossible and we prove this with the help of consistency.

We consider the sequence \((x_n)\) with \(x_n = \frac{1}{n}\). For this sequence, \( \lim_{ n \to \infty } x_n = \lim_{ n \to \infty } \frac{1}{n} = 0\). Furthermore, \(\lim_{ n \to \infty } f(x_n) = \lim_{ n \to \infty } \frac{1}{n} = 0 \neq 42 = f(0)\). Thus, \(f\) is discontinuous at the position \(x=0\), i.e. discontinuous overall.

Since the sum and the product of continuous functions are continuous again due to the chaining clauses, one can only generate continuous functions (in particular never \(f\) ) with the help of the four basic arithmetic operations.

However, if we allow, for example, the discontinuous signum function, we can easily find such a notation, because then

$$f: \mathbb{R} \to \mathbb{R}, f(x) = sgn^2(x-42)+42.$$

For a general function \(f\) with case distinction applies

$$f,g,h,a: \mathbb{R} \to \mathbb{R}, f(x) = \begin{Bmatrix} g(x), & \text{falls } a(x) = 0 \\ h(x), & \text{falls } a(x) \neq 0 \end{Bmatrix} = sgn^2 \left(a(x)\right)\cdot h(x) + \left(1-sgn^2\left(a(x)\right)\right)\cdot g(x).$$

On the other hand, if you look at functions in programming languages, branches can be resolved. For example, in PHP the signum function can be mapped with:


Also \(f\) can be displayed without any if-/else-control structures with:


If you also want to do without comparison operators, you can go one step further and immerse yourself in the beautiful world of bitwise operators: