Functions

Intuition

Defining "functions"

Traditionally, math focuses on unary functions.

Esp. in CS, convenient to define functions of other arities.

Total vs. partial functions

Math "functions" vs. Programming language "functions"


Some properties of functions

Draw diagrams of mapping. For each, consider f:XY.

Example proof: If f is bijective, then f is invertable.

Intuitively fairly obvious from diagram, but how can we prove this? The proof follows the intuition, but makes some things more explicit.

Given that f is bijective, we'll construct a function g:YX. Then we show that this particular g is f's inverse.

Define g: For all y′Y, we define g(y′) as the element x′ such that f maps x′ to y′.

Weird wording. Are we sure g is well-defined?

g sounds like an inverse of f, but is it really?

Several related questions left for your consideration:


Defining specific functions

Class might skim or even skip this, depending on time.

You have lots of experience with this. But, here's a few CS-useful specifics you might not be familiar with.