What is the truth value if any for $f(x)=y$ when $x$ is outside of the domain of $f$?

What is the truth value if any for $f(x)=y$ when $x$ is outside of the domain of $f$? Could it be false or undefined?


The natural way to look at it is that the expression is ill-formed and so it doesn't make sense to ask its truth value. This is the case in type-theory-based formalisms.

In something like first-order set theory, though, syntax like $f(x)$ comes from extension by definitions, so your equation is shorthand for a well-formed sentence that does have a truth value. Whether it's true or false depends on technical details that "shouldn't matter" because they don't affect the truth value when the notation is used in the intended way, i.e. when the function argument is an element of the function's domain.


In set theory, where a function is simply a set of ordered pairs satisfying a uniqueness condition, $f(x)= y$ is syntactic sugar defined to mean $(x,y)\in f$. Thus the statement is false if $x \notin \operatorname{domain}(f)$.

In programming, the “truth value” of the 11th element of a 10-element Boolean array is undefined, and trying to access it will raise an index out of bounds exception in languages that perform bounds checking; it would yield garbage in languages that don’t (for example, C).