There are two different concepts of function that will be important to us. The first is the mathematical concept: a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output. [From Wikipedia]. Thus, given the current framework, any task can be considered a function wherein the mechanism is abstracted away, leaving only the inputs and associated outputs. The important takeaway here is multiple realizability. Any task, any physical process, is multiply realizable as long as we only care about the inputs and outputs.
The second concept of function refers to working or operating in a proper or particular way. Thus, we say the function of the eyeball is to relay visual information to the brain. When referring to this concept of function we sometimes use the terms “purpose” or “goal”, and we usually associate it with a particular physical mechanism. Note that this “purpose” is not intrinsic to the mechanism. Instead, “purpose” is part of an explanation of why the mechanism came to exist.
There are some physical systems which, by their organization, tend to move the environment toward a particular state. These systems have been described as self-organizing, or cybernetic, and include lightning, vortexes, rivers, etc. A subset of these systems can create new mechanisms, which mechanisms can contribute to the goal (target state) of the creating system. Natural selection is such a system. The mechanisms thus created can be said to have the purpose or function or goal of moving the environment toward the goal state associated with the mechanism-creating system. For natural selection, that goal state is the out-of-equilibrium state of an existing creature. But this function generally requires the mechanism to be situated in a specific context. If you take the mechanism out of this context it is likely to lose the “purpose” sense of function while potentially retaining the mathematical sense of its function. So, a heart has the purpose of pumping blood, but only so long as it is situated in an animal. Mechanisms can also be re-purposed. Consider a computer being used as a door stop, or paperweight.
Some people will object to assigning “purpose” to naturally occurring mechanisms, as they consider “purpose” to be associated only with the intentions of an intelligent agent. But “purpose” (or “goal”, etc.) is the closest existing term to describe the concept in question, and so some of us add the descriptor “teleonomic” when referring to naturally derived purpose, and “teleologic” when referring to the intentional purpose of an agent. Richard Dawkins, when addressing this issue, used the term “archeo-purpose”, but apparently that didn’t catch on, so we’re going to go with teleonomic. Actually, we prefer to just drop the extra term, as teleologic purpose is just a meta-teleonomic purpose. But we’ll use “teleonomic” when pressed.
Finally, I get to point out that function in the sense of purpose, either teleonomic or teleologic, is Aristotle’s final cause. Recall that in the framework:
Input1 -> [mechanism1] -> Output1
Input1 is the material cause, [mechanism1] is the efficient cause, and Output1 is the formal cause. So how does function fit into the framework? Consider
Input0 -> [mechanism0] -> Output0 = [mechanism1]
Aristotle’s final cause derives from the mechanism which creates the mechanism of interest, assuming there is some sense in which the original mechanism0 tends to move the environment toward a goal state by creating mechanisms that do so.