# Is cardinality a well defined function?

I was wondering if the cardinality of a set is a well defined function, more specifically, does it have a well defined domain and range?

One would say you could assign a number to every finite set, and a cardinality for an infinite set. So the range would be clear, the set of cardinal numbers. But what about the domain, here we get a few problems. This should be the set of all sets, yet this concept isn't allowed in mathematics as it leads to paradoxes like Russell's paradox.

So how do we formalize the notion of 'cardinality'? It seems to behave like a function that maps sets into cardinal numbers, but you can't define it this way as that definition would be based on a paradoxical notion. Even if we only restrict ourselves to finite sets the problem pops up, as we could define the set {A} for every set, thereby showing a one-to-one correspondence between 'the set of all sets' (that doesn't exist) and the 'set of all sets with one element'.

So how should one look at the concept of cardinality? You can't reasonably call it a function. Formalizing this concept without getting into paradoxes seems very hard indeed.

• The collection of all cardinals isn't a set either – Alessandro Codenotti Oct 26 '16 at 12:07

The cardinality function is well-defined, but it is what known as a class function. Since every set has a cardinality, the domain of the function $A\mapsto |A|$ has to be the class of all sets, so this is indeed a proper class. And since every set has a strictly large cardinal, the class of cardinals is not a set either.

Using the axioms of set theory, we can canonically determine an object, in the set theoretic universe, which will represent the cardinal $|A|$. So the function $A\mapsto|A|$ is indeed definable.

It should be pointed, perhaps, that this class function is also amenable. Namely, restricting it to any set of sets will result in a function which is itself a set. Namely, a set of sets can only have a set of distinct cardinals. This is a direct consequence of the Replacement axiom.

There is some inherent difficulty at first when talking about existence of proper classes, and whether or not they are well-defined objects. In the case of $\sf ZFC$ and related theories, existence means "a set", but when we say that a class exists and it is well-defined, we mean to say that there is a definition which is provably giving us the function that we want. This is the case in your question.

But one can also work in class theories like $\sf KM$ (Kelley–Morse) or $\sf NBG$ (von Neumann–Godel–Bernays), and there the function assigning every set its cardinality is still a class function and not a set, but now it exists in "an internal way" as an object of the universe.

• One minor(?) point here: you're right, as long as you have the axiom of choice. When you say "every set has a cardinality," you need choice. Without choice, only the well-orderable sets have a well-defined cardinality. Even the Hartog function can't quite fix that problem. Otherwise, you are spot-on: the function taking any (well-orderable) set to its cardinality is a definable and amenable class function. As my thesis advisor used to say: "We will be assuming the axiom of choice throughout, primarily because it's true!" – user128390 Oct 26 '16 at 21:13
• No. No. No. If we stop treating the ordinals like gods, everything becomes fine. Cardinal is an object which represents the equivalence class of sets under bijections. It does not have to be an element of that class, just to be uniquely identified, and this is doable via Scott's trick. Moreover the notion of "cardinality" is just a notion of "same size". Do you want to tell me that there are no bijections between the reals and $\mathcal P(\Bbb n)$ in the absence of choice? Nonsense! :) Finally, karagila.org/2013/… :) – Asaf Karagila Oct 26 '16 at 21:19
• Asaf, would it be fair to say that the class of strongly inaccessible cardinals is necessarily well-ordered? More vaguely: what's the weakest notion of "difficult to access from below" such that the class of all cardinals that are difficult to access from below is automatically well-ordered? I suppose that by "$\kappa$ inaccessible" I probably mean that $V_\kappa$ models second-order ZF, if that helps. (Unless you think that's a bad definition, in which case, that's not what I mean.) – goblin Oct 28 '16 at 9:45
• @goblin: Any class of ordinals is well ordered. I don't understand your question... As for the definition of an inaccessible, it's a fine definition (see Blass, Löwe and Dimitriou about inaccessible cardinals in ZF for more about that). – Asaf Karagila Oct 28 '16 at 9:58
• @AsafKaragila, yes, sorry. It was a foolish question... – goblin Oct 29 '16 at 2:51

The collection of all sets does not form a set in ZF(-style) set theory, indeed. Note that the same is true for the collection of all cardinals: there is no set containing all cardinals, because then its union would be a set as well, and it would be a greater cardinal than any of its elements.

So the function $X \mapsto |X|$ is not a function internally to ZFC. However, it can be made a function externally: that is, there is a formula $\phi(x,y)$, in two free variables, which holds if and only if $y$ is the cardinality of $x$. For this formula, we can prove $\phi(x,y) \land \phi(x,y') \to y = y'$, and we can prove $\forall x \exists y \phi(x,y)$. Hence, if we want to, we can introduce a function symbol $\mathrm{Card}$ to the language of set theory, such that $\mathrm{Card}(x)$ is interpreted as the unique $y$ such that $\phi(x,y)$. This is fine for the purposes for which we want to use cardinality.

Note also that if you are looking at a more limited part of the universe of sets, say $V_\alpha$ for some ordinal $\alpha$, then the restriction of the meta-function $\mathrm{Card}$ to this set does form a set.

• If it doesn't form a set within ZF(C) theory, then in what kind of framework does it exist? As far as I know ZFC is the basis of mathematics these days and they are considered fundamental axioms. If something lies outside it, that imply's there is some more fundamental framework that incorporates ZFC. – Dirkboss Oct 26 '16 at 13:23
• I don't really have a good answer for you; I guess it might also depend on what you mean by the word "exist", and what is necessary for a function that "exists". The closest thing to an answer I have is something like this: when I tell you $|X|$ you intuitively understand what I mean (namely the unique cardinal which admits a bijection to $X$). That makes it a function. This function is not represented by a (ZFC-)set, the way most functions are, so it is not a ZFC-function. However, we can talk about it in the language of ZFC, which is what we "work in", and that is good enough for us. – Mees de Vries Oct 26 '16 at 13:33
• @Dirkboss: This is a difficult question to answer if you're not comfortable with the distinction between theory and meta-theory, where classes exist. One can consider instead class-set theories like von Neumann--Godel--Bernays or Kelley--Morse, where classes are objects and there the function assigning cardinals does exist, but it still isn't a set. – Asaf Karagila Oct 26 '16 at 14:33
• @Dirkboss: Says who that ZFC is the basis of mathematics these days? It is one basis that provides successfully a foundation on which much of modern mathematics can be built, but it is by no means the only foundations.. and there are many others. Also, "can build" does not mean "is needed to build", and even most modern mathematics (especially in applied fields) hardly need ZFC. Even a set theorist I know stated that the axiom of foundation (in ZFC) is simply to ensure nice models of ZFC (if a model exists to begin with). It is not at all 'fundamental', in other words. – user21820 Oct 27 '16 at 16:27
• @Dirkboss: And note that going to MK set theory does not fix the issue you are raising with some apparently well-defined collection being 'outside', because in MK too there is no class of all classes $x$ such that $x \notin x$. Asking "why should it be like that" would be a philosophy of mathematics question, and hence opinion-based. Also, you should know Godel's incompleteness theorem, which shows that every sufficiently nice formal system can't prove everything that is true about itself and nothing that is false, simply put. – user21820 Oct 27 '16 at 16:33

Being equinumerous or bijective is an equivalence relation on sets: $x\equiv y$ iff there is a bijection $f:x\text{ onto }y$. The problem is to define a total set function (a proper class of course) $F$ satisfying $x\equiv y$ iff $F(x)=F(y)$.

In ZFC this is done by the cardinality function $F(x)=\text{card}(x)$, whose values are cardinals, and it satisfies $x\equiv F(x)$, that is, is a true transversal.

In ZF, this is done by $F(x)=$ the set of all sets $y$ with $x\equiv y$, which have the least von Neumann's rank among all such sets, and then generally $x\not\equiv F(x)$, of course.

I don't know though if anyone has succeed to prove that in ZF there is no true transversal for $\equiv$.

• If $x$ is non-empty, then the class of all sets with $x \equiv y$ is not a set. Also, for your last sentence, I guess you mean to ask whether it is consistent with ZF for there to be no transversal; as you point out, in ZFC (which is consistent with ZF) there certainly is a transversal. – LSpice Oct 27 '16 at 1:56
• Indeed, it is consistent with ZF that there is no true transversal for $\equiv$: see Asaf's answer to this question. That said, I don't think this really answers the question - the OP isn't asking how cardinality is defined, but rather what type of object the "cardinality map" is (which you answer in parantheticals - a class function - although I'd argue that calling it a "total set function" is somewhat misleading, since you mean a map on/to sets, not a map which is a set). – Noah Schweber Oct 27 '16 at 2:11
• I am not able to find an answer there. – Vladimir Kanovei Oct 27 '16 at 2:33
• Pincus proved that it is consistent to have a definable choice of representatives for the Scott cardinals. You can find the fact this is not provable in Jech's Axiom of Choice book in chapter 11. – Asaf Karagila Oct 27 '16 at 8:05
• Pincus' paper: ams.org/mathscinet-getitem?mr=366666 – Asaf Karagila Oct 27 '16 at 8:11