In quantum mechanics, it's said that the total energy of a system can only take certain discrete values. That is, the set of all possible energies of a system can be indexed by the natural numbers and is countably infinite. However, $E=T+U$, where $T$ is the kinetic energy and is a function of momentum, and $U$ is the potential energy and is a function of position. The problem is that the domain of $T$ and $U$ is the set of all real numbers (or arguably only positive reals, but the cardinality is equivalent).
More formally, think of E as the cartesian product of T and U, where each ordered pair (t,u) in E represents the quantity t+u (the multiplicity of different ordered pairs representing the same sum shouldn't make a difference). The cartesian product of two countable sets is countable, but the cartesian product of one uncountable set and one countable set, or of two uncountable sets, is uncountable. So for E to be countable, and therefore discrete, both T and U most be countable. Analyzing U can be complicated since it can take several different forms, but T has only one form, that is: T=(p^2)/2m. Notice that T is strictly monotonic (strictly increasing for increasing input p). This implies that there is a 1-1 correspondence between the set of allowed p and the set of allowed t, and therefore the cardinalities of these sets is equal. However, p can take any real value and is uncountable. Therefore, T must also be uncountable which implies that E is uncountable and therefore not discrete.
I'm rather confident that the mathematical logic I use here is correct, so my mistake must be a misinterpretation of the underlying physics. Can someone please explain what exactly this misinterpretation is and where I went wrong?