5 ms·
I think the assumption is that String is a possibly infinitely long ordered list of fixed-size characters, in which case it is countably infinite. Edit: I actu
by saagarjha 8y ago
I think the assumption is that String is a possibly infinitely long ordered list of fixed-size characters, in which case it is countably infinite.
Edit: I actually meant "arbitrarily long but finite" instead of "possibly infinitely"; thanks dagw.
- rcthompson 8y agoWe're not talking about the size of single values, we're talking about the cardinality of the set of all distinct values of a given type. I.e. "How many different Strings are there?"
- saagarjha 8y agoYes, I'm aware of that. The set of all languages over a finite alphabet should be countably infinite, since you can list them all. For example, for the alphabet {0, 1} all your strings are just the binary representations of natural numbers, which is countable since ℕ is.
- dagw 8y agoIf you only allow arbitrarily long, but finite, strings then the set is countable. If you allow infinitely long strings then the cardinality of that set is uncountable. For a trivial example consider the string representation of every element in ℝ in the alphabet {0-9,.}
- saagarjha 8y agoYes, you're right; this is what I meant, and I see why my current wording is wrong.
- tomp 8y agoEach string is finite, its characters come from a finite set; that’s countably infinite (think of it as integers written in base Unicode). Bitsequences are infinitely long, so that’s uncountably infinite or continuity (think of it as real numbers between 0 and 1, written in binary).
- rcthompson 8y agoThe point of the original comment was that if you consider BitSequences to be of infinite length, then for consistency you also have to allow infinite-length strings. Otherwise you're ignoring the limitations of machine representation for one type but not the other, which is comparing apples to oranges.
- nicky0 8y ago*infinite?
- saagarjha 8y agoYup, sorry. Fixed.
- pedrosorio 8y ago> String is a possibly infinitely long ordered list of fixed-size characters, in which case it is countably finite. BitSequence, as defined in the blogpost, is an "infinitely long ordered list of fixed-size characters" (where the size is 1 bit in this case) - the set of all BitSequence values is infinite - and uncountable. By the same logic, the set of infinite strings is also uncountable (as the GP says, it's trivial to do an injection from BitSequence to infinite strings, so it can't have lower cardinality).
- saagarjha 8y agoYes, you're right. I have amended my comment; I had meant to say that Strings must have finite length. The "meat" of my comment was an argument that Strings could not infinitely long, which was exactly the opposite of what I actually ended up saying ;)
- hawkice 8y agoIt's not uncountable because they have to be computable, which makes them countable again.
- nicky0 8y agoI think there is some confusion of terminology going on here. What you are calling "uncountable" is what is also known as "countably infinite".
- pedrosorio 8y agoThere is no confusion here. The set of infinite strings is not countably infinite, it has cardinality larger than the set of integers.
- brianpgordon 8y agoWhy? If your alphabet is [0-9] then it seems like your set is just the integers, and those are countably infinite. This case is even more restricted, where you only have two elements in the alphabet. So where does the continuum come in?