15

For most practical purposes, the codomain is part of the definition of a function. The codomain is specified at the moment we write $f:A \to B$, and is exactly what makes the word "surjective" meaningful.

EDIT: by "part of the definition", I mean "as an item of the ordered pair below".

However, in set theory, the definition of function as a binary relation (i.e. a subset $R$ of $A \times B$) does not include its codomain - if we define the function as a set $R$ satisfying certain properties, then we cannot really decide what the codomain is from $R$. (The domain and image can, however, be extracted from the set $R$ easily.)

Of course, to define the relation $R$ using a formula $\phi$, we also need to specify a set of objects from which we are choosing to form $R$. See Axiom schema of specification in ZFC. For example, we may define $R=\{(x,y)\in \mathbb Z^2, x=y\}$, but the set $\mathbb Z^2$ (the "domain" and "codomain") is not part of the structure of $R$.

And in fact, sometimes, we need to change the codomain of a function, just like we often need to restrict or extend the domain. For example, when we use the word "embedding", we usually mean "isomorphism onto the image", so we are implicitly and temporarily "seeing" the image as the "codomain".

So, when we write done a function $f$, do we actually mean the pair $(R, B)$, the graph of $f$ and the codomain? Does this depend on the writing style and the convenience of notation for the problem we are solving?

Arctic Char
  • 16,007
Ma Joad
  • 7,420
  • 3
    As far as I’m concerned it depends on the context, though my default is that it’s simply the set of ordered pairs. – Brian M. Scott Nov 09 '20 at 20:07
  • 8
    This absolutely depends on context - which in my opinion is deeply annoying, but is thoroughly entrenched. In my experience, most mathematicians outside of logic do consider the codomain to be explicitly part of the function, whereas many logicians find it the ordered-pairs-only definition a bit more convenient and don't see anything lost by dropping the extra information about the codomain. – Noah Schweber Nov 09 '20 at 20:08
  • I agree it probably depends on the author. In almost every case, it is implied that a function lives in some category where it is a morphism between two objects with underlying sets. So morally I'd say the codomain is part of the definition. Set theorists would be the main people who care about the distinction though. – pancini Nov 09 '20 at 20:11
  • 1
    @ElliotG I disagree with your last sentence. I think it is important in math education to have that matter settled. The function is an object that is introduced in the curriculum a lot earlier than sets, and it is expected of students to be able to answer questions such as "are the functions $f$ and $g$ equal or not" - the answer should not depend on who taught them math and where. My 2p. –  Nov 09 '20 at 20:18
  • 4
    The phrasing "a subset $R$ of $A \times B$" would naturally (albeit implicitly) single out $B$ as a codomain. "A set $R$ of ordered pairs where each element of $A$ appears exactly once as the first element of a pair" avoids the mention of anything like a codomain. – Arthur Nov 09 '20 at 20:19
  • As you say, expressing the codomain is necessary in order to be able to express "surjectivity", and such expressions are part of many mathematical theorems (I can think of several examples off the top of my head in topology and group theory). From another point of view, many branches of mathematics make steady use of category theory and in particular the "morphisms" of a category are often the "structure preserving functions". Again topology comes to mind: you need the codomain to even define continuous functions. – Lee Mosher Nov 09 '20 at 20:21
  • 2
    @LeeMosher: I’m a topologist (admittedly with a relatively strong background in set theory), but I default to the set-theoretic definition. – Brian M. Scott Nov 09 '20 at 20:34
  • @BrianM.Scott this reminds me of another debate (?): does the definition of a $K(G,n)$ include an isomorphism $\pi_n(K(G,n))\to G$? – pancini Nov 09 '20 at 20:40
  • @StinkingBishop you're right. I guess I meant that, if there is an implied ambient codomain like $\Bbb R$, there is no harm in saying things like "$f$ surjects onto $[c,d]$ but not onto $\Bbb R$." – pancini Nov 09 '20 at 21:10
  • @BrianM.Scott Hi Brian, I would love you feedback on this question I came up with after reading this post - this is best asked with an example: if we have a function $f : \mathbb{R} \to \mathbb{R}$ defined by $y= f(x) := x^2$, why do we say $x^2$ is the definition of $f$ when $f$ is a set defined by ${(x,y) \in \mathbb{R} \times \mathbb{R}: f(x) := x^{2}}$? Is this simply a shorthand way of getting around writing out $f$ as a set every time? – Taylor Rendon Feb 10 '21 at 22:21
  • 1
    @TaylorRendon: Basically, it’s a convenient shorthand, and one that corresponds nicely to the way that we actually tend to think about functions, i.e., as rules for associating an output to each allowable input. – Brian M. Scott Feb 10 '21 at 22:28
  • @BrianM.Scott - That makes sense! So its appropriate saying that "$x^2$ is the definition of the function $f$" is shorthand for writing out $f$ as a set? – Taylor Rendon Feb 12 '21 at 18:28
  • @TaylorRendon: Yes, though in most settings (e.g., calculus) it really doesn’t matter that $f$ is a set, and we don’t actually think of it as a set. – Brian M. Scott Feb 12 '21 at 18:30
  • @BrianM.Scott - Gotcha. Thank you for your time Brian, that helped a lot! – Taylor Rendon Feb 12 '21 at 19:41
  • @TaylorRendon: You’re welcome! – Brian M. Scott Feb 12 '21 at 19:43

2 Answers2

6

TL;DR I don't think you need one to describe a function, but I think you need a codomain to define a function.

(The original iteration)

However, in set theory, the definition of function as a binary relation (i.e. a subset of $×$) does not include its codomain

Sure it does, you just did it: it's $B$. You can't specify ordered pairs without mentioning $B$. What does $(a,b)$ even mean if you don't know what set $b$ is from? (Edit: Of course you can build an ordered pair with two arbitrary sets. What I wanted to express, but failed to make clear, is that to use comprehension to select ordered pairs it would be necessary to mention $B$. The discussion is in the commentary to Arthur's comment below.)

It's not entirely unnatural to discern based on codomains

Also, $(,)$ does mean something if, for example, we change $$ to a larger set, and this does not affect $$.

This is part of the "is the codomain a part of the function?" question. I would say it is not so clear that it "does not affect $R$."

In Mac Lane's formulation of category theory, for example, each arrow has two associated objects of categories: the domain, and the codomain. This definition allows two technically different arrows which otherwise might be "the same function" to have different codomains, one properly containing the other.

Now look what happens when we define extensions of functions: say that we have a function $R\subseteq A\times B$ and a function $S\subseteq C\times D$ where $A\subseteq C$ and $B\subseteq D$. We say that $S$ extends $R$ if $R(a)=S(a)$ for every $a\in A$.

Of course, if $A=C$ the "bigger codomain" is just a special case of extension. From this viewpoint one can avoid confusing $R$ with its extension $S$, although for all intents and purposes we usually think of them as being the same thing "with different codomain."

While Mac Lane's formulation of category theory is largely independent of set theory, I think the mindset above is a thing in set theory too.

Regarding Arthur's comment:

A set $$ of ordered pairs where each element of appears exactly once as the first element of a pair" avoids the mention of anything like a codomain.

I will concede that this is a description of a function, but I would argue it does not allow one to define a function. (I'm operating under ZF only.)

Think about what it would take to try to define a function using this description. You have in hand, we suppose, the sets that will be elements of the domain and the sets that will be their images. For each assignment $a\mapsto b$, you can form $\{\{a\},\{a,b\}\}$ using the axiom of pairing, no problem.

But now you need something to pull all of these into a single set that is your set of ordered pairs. But how does one do that? I do not believe the axiom of comprehension can handle this$^\ast$. As the wiki notes, "the axiom schema of specification can only construct subsets". I think attempting to pull all the pairs into a single set would amount to using unrestricted comprehension, which is of course not safe.

A thought experiment

What I'm trying to get at is that to realize functions as sets, picking a codomain seems as necessary as specifying a domain.

How about we double-down on the logic that the codomain can be done away with completely with this thought experiment: if one believes that a function doesn't need a codomain, should we also believe that a partial function don't need a domain specified either? It's just "a set of ordered pairs, period." Is the domain not meaningful because we can extend it at will?


$^\ast$ (With a finite domain, you might be able to combine pairing, powerset and union to assemble them into a set, but of course I want to discuss infinite domains too.)

rschwieb
  • 153,510
  • 5
    Well, the sentence you quote can be re-phrased in such a way that does not mention $B$. See one of the comments above. Also, $(a,b)$ does mean something if, for example, we change $B$ to a larger set, and this does not affect $R$. So we cannot recover $B$ from $R$. Hence $R$ itself does not include information of codomain $B$. – Ma Joad Nov 09 '20 at 20:39
  • @MaJoad I never claimed $B$ is uniquely determined so that it could be recovered from any set of ordered pairs representing it , I just mean that in defining the function as a collection of ordered pairs, you inevitably mention the set that contains the last elements at some point, implicitly or explicitly. I don’t see anything above that contradicts that. – rschwieb Nov 09 '20 at 20:49
  • @MaJoad I see Arthur's comment that you are referring to, and I think there is a distinction to be made, which I've elaborated on in what I wrote. – rschwieb Nov 10 '20 at 11:36
  • 2
    "you inevitably mention the set that contains the last elements at some point" I would say, you inevitably mention a set that contains the last elements, not "the" set. – littleO Nov 10 '20 at 11:47
  • 1
    @littleO I agree: you eventually mention a set, which becomes the set for the context :) – rschwieb Nov 10 '20 at 11:48
0

My point of view is the following.

A function is defined to be a functional relation. A relation is by definition a triple $(A,B,R)$ where $R\subseteq A\times B$, where $A$, $B$, and $R$ are (possibly empty) sets.

Under this definition when you formally give a function $(A,B,\Gamma)$, you specify its domain, its codomain, and its graph (the latter, in the case of a function, must satisfy the usual functional condition: $\forall a\in A \exists!\;b\in B: (a,b)\in \Gamma$).

This way the notion of surjectivity makes sense.

Another reason why we should prefer a definition of relation (and hence of function) to explicitly include the whole triple $(A,B,R)$ is that, this way, the collection of sets $\mathrm{Rel}(A,B)$ forms the collection of hom-sets of a category $\mathrm{Rel}$ (one axiom a general category $\mathcal C$ has to satisfy is that, for $(A,B)\neq(A',B')$, the hom-sets $\mathcal{C}(A,B):=\mathrm{Hom}_\mathcal{C}(A,B)$ and $\mathcal{C}(A',B')$ must have empty intersection).

Of course, for fixed $(A,B)$, there's a bijection between $\mathrm{Rel}(A,B)$ as I've defined it and the set of subsets of $A\times B$.

BTW, I find it quite strange that set theorists prefer the definition of relation that doesn't specify the codomain. Somehow, I think set theorists who don't use the "relations as triples" definition are just "wrong". Set theorists sometimes have to take the union of functions (which means increasing unions of graphs of extensions of a function), which for them is just literally a union of sets. I think the mild abuse of language necessary to define the "union" of functions in the "relations as triples" framework is well worth accepting.

Qfwfq
  • 723