Skip to main content
3 of 3
added 131 characters in body
ABu
  • 529
  • 2
  • 11

In actual programming languages, a function is not forced to deal explicity with input is not meant to. For a function f(x) you can say something like:

// x must satisfy x != 0, otherwise inv(x) results in undefined behaviour.
double inv(double x) { return 1/x; }

In computer since though, using $\bot$ is a very useful symbolic tool to express such indefinitions in piecewise-defined functions:

$$ f(x):\Bbb R\rightarrow\Bbb R = \begin{cases} \frac{1}{x} & \quad x\neq 0\\ \bot & \quad\text{otherwise} \end{cases} $$

So in short no, a programming language doesn't require to have any equivalent symbol. A language is only required of course of having tools for implementing well-defined cases. Any other precondition could be expressed in comments, documentation, etc, so the responsability of checking the input is transfered to the caller (this strategy is called design by contract).

NOTE: Some languages also have exceptions, but exceptions are more of a helper tool for error handling methods and not so much for expressing undefinition.

ABu
  • 529
  • 2
  • 11