# FOL - Functions that don't apply to all elements in the domain of discourse

In FOL, we often have functions which take as input some elements from the domain of discourse and give us another element from the domain of discourse. I'm looking into how to use FOL in the context of mathematics: set theory, arithmetic, etc.

The problem that I've noticed is that in mathematics, we often have functions (in the sense of FOL) which only output another element in the domain of discourse for certain inputs. For example, the function sqrt(x) will give another element in the domain when x is a nonnegative number, but not when x is negative.

I've only taken logic class and we used the book Language, Proof, and Logic. In this book they said that when constructing FOL languages, we should try to make functions refer to elements in the domain of discourse for any inputs.

How does FOL handle functions that don't produce an output for certain inputs?

• Duplicate question on math.se: math.stackexchange.com/questions/845450/… – Not_Here Jul 29 '17 at 19:31
• There are multiple ways to do what you're asking as are outlined in the question on math.se. Personally I would follow the suggestion of defining a predicate instead of a function. (It's a result due to Bertrand Russell that functions can be rewritten as predicates, e.g. F(x)=y is rewritten to Pxy=True) – Not_Here Jul 29 '17 at 19:45
• The usual one-sorted FOL doesn't, but many-sorted FOL does. However, since any many-sorted FOL theory can be translated to a one-sorted FOL theory, textbooks tend not to mention the many-sorted version, since they are focused on studying FOL (it's easier to study a simpler system) rather than using FOL. Sadly, even textbooks that aim to teach beginners (of which LPL is a good one) end up pandering to the higher-level preference for one-sorted FOL, despite the reality that many-sorted FOL is more user-friendly. – user21820 Jun 7 at 7:53