Term for a function that handles all possible inputs?

100 Views Asked by At

I'm a software developer, not a mathematician, but I remember listening to a talk where someone was talking about "composability" of functions and category theory.

I distinctly remember there was a term for a type of function that would be able to map all possible inputs to some sort of output, and it had something to do with it being more "pure" in a way, meaning it would be something that most "badly written functions" (in the world of programming) wouldn't do. I suppose in code, you would use something like a try catch so you would always at least get an exception.

I don't think it's "functionally complete" since that has something to do with NAND gates and EE. I don't think it had anything to do with sets or relations (but I might be wrong). Also did not have anything to do with injection, surjection or bijection.

Can someone knowledgable tell me what that term is?

1

There are 1 best solutions below

1
On BEST ANSWER

The term you want is total function. In maths a total function is different from a partial function in that it has a defined value for all possible inputs. In computer science, a total function typically refers to a function that is guaranteed to terminate (though the term tends to come up more in areas like Computability theory and functional programming than it does in every day imperative programming).

It's a very important idea in certain areas of Computer Science. Theorem proving, which is an area I'm interested in, is usually constrained to consider only total functions, since the types of non terminating functions can be so general as to allow you to prove obviously false assertions.