4.6.1 · D5Theory of Computation
Question bank — Alphabet, string, language — formal definitions
Recall Symbols & rules used on this sheet (skim before you start)
This practice sheet is self-contained — here is every symbol it uses, in one place.
- ==== (Sigma) — an alphabet: a finite, non-empty set of atomic symbols, e.g. .
- ==== (epsilon) — the empty string: a string with zero symbol-positions, . It is a string, never a symbol of .
- ==== — the length of string = number of symbol-positions in it.
- ==== — the set of all strings of length exactly . Fact: , and .
- ==== (Kleene star) — all finite strings, including .
- ==== (Kleene plus) — all strings of length , excluding .
- ==== — a language: any subset of , i.e. a (possibly infinite) set of strings.
- ==== — the empty language: a set with zero strings, . (Not the same as , which has one string!)
- Concatenation of languages: (all glued pairs, as a set).
- Powers: , ; and .
- Complement over : ==== — every string not in .
True or false — justify
The empty string belongs to every alphabet .
False. is a string (length 0) living on the String floor; an alphabet contains symbols on the Alphabet floor. Every alphabet's contains , but itself never does.

and are the same language.
False. has zero strings (); has one string, the empty one (). Empty box vs. box holding one blank sheet — see the box diagram below.


is uncountable, like the real numbers in .
False. holds only finite strings, so we can shortlex-list them (length 0, then length 1, then length 2, …), giving every string a definite position — a bijection with , hence countable. A real in needs an infinite digit-string, which no such list reaches. See the two figures below.
Concatenation of strings is commutative: always.
False. — position order is part of a string's identity. Concatenation is associative and has identity , but not commutative.
For any alphabet, .
True. (the plus) is every string of length ; adding back the single length-0 string gives all finite strings, which is . And , so the union genuinely adds one new element.

.
False. By the power rule and is included for every . So even when , the term contributes : thus . See the union-strip figure below.
A language must be a finite set of strings.
False. A language is any subset of , so it may be infinite (e.g. all even-length strings) — the definition places no size restriction.
Every language over is a subset of .
True. That is the definition of "language": . Restrictions like "regular" or "context-free" come later to classify which a machine can recognise — see Regular Languages.
because is one string.
False. counts symbol-positions, not strings. has no positions, so . "One string" is a fact about the set (size 1), not about the length.
for every string .
True. is the identity of concatenation ("do nothing" string), so gluing it on either side changes nothing: .
An alphabet may be infinite as long as it is non-empty.
False. An alphabet must be finite and non-empty. Concretely: a DFA has a finite transition table with one outgoing edge per symbol from each state; if were infinite, each state would need infinitely many edges — the table can never be written down, so the finite-machine model collapses.
Spot the error
" is a perfectly good alphabet — it's just small."
The error is allowing the empty set. must be non-empty; with no symbols you could write nothing, so only — a useless theory with exactly one possible input.
"Since accepts nothing and accepts nothing meaningful, both have size 0."
has size 1 — it contains the empty string as a member. Only has size 0. Counting the box's contents, holds one item (a blank sheet).
" because concatenating with 'nothing' leaves alone."
Wrong: . Recall ; here there is no to pick, so no pair — hence no string — is produced. The identity for concatenation is , not .
" since is empty."
Wrong: . Using with and every gives , reproducing all of . is the multiplicative identity.
"The string is the same as the language — same symbols."
Two errors. is an ordered string on the String floor; is a set (a Language) and equals since sets ignore order and duplicates. Order and repetition matter for strings, never for sets.
" because there are no length-0 strings."
Wrong: . There is exactly one length-0 string, , over any alphabet. So .
" for — four products."
The four products (, , , ) are right, but is a set; the duplicate collapses to one. Correct: .
Why questions
Why is length defined recursively (, ) instead of "just count the letters"?
So the property we want — — is forced rather than assumed. Recursion pins down the base and one honest step, and induction proves everything else, including .
Why is a language allowed to be any subset of with no rule attached?
Because a language is exactly "the set of inputs we accept," and at the definition stage we impose no constraint. Constraints (regular, context-free) come later to sort which languages machines like a DFA can recognise.
Why must an alphabet be finite?
A machine reading input must be able to react to every possible symbol. A finite lets a finite machine handle every case; an infinite never could.
Why is countable even though it is infinite?
Every string is finite in length, so we can order them shortlex — length 0, then length 1, then length 2… — a complete list with a definite position for each. That listing is a bijection with the natural numbers .
Why does the set of all languages end up uncountable even though is countable?
Taking the power set of a countably infinite set gives an uncountable set (Cantor's diagonal argument). This is the seed of undecidability — more languages exist than machines to recognise them. See Countability and Diophantine Diagonalization.
Why does concatenation make a monoid but not a group?
It is associative and has identity (monoid). But no non-empty string has an inverse: once , you can never concatenate back down to . No inverses ⇒ not a group.
Why does the reversal always satisfy ?
Reversal only re-orders positions; it adds and removes nothing. It's a bijection on the same positions, so the count is unchanged.
Why must include even though has no strings?
Because starts at , and is defined as for every language (it means "zero copies concatenated = the empty word"). The slice contributes regardless of ; every later slice () is empty. Union: .
Edge cases
Is a substring of every string ?
Yes. Take with ; the empty string sits between any two positions. It is also a prefix and a suffix of everything.
Is when ?
Yes. and is even. The tempting "no string ⇒ not in a length-language" ignores that is a legitimate even number.
What is when (single symbol)?
The infinite set — one string of each length. A single-symbol alphabet is valid (finite, non-empty) and still generates infinitely many strings.
Can ever be anything other than ?
No. By definition for every string , even itself. "Repeat zero times" leaves the blank word, matching .
Is the complement over equal to ?
Yes. By definition , so removing nothing leaves everything: . Dually .
If , what is ?
Still . Every power concatenates copies of , which produces only , so the union collapses to .
Does include for any ?
Only for : . For every , holds strings of length exactly , so (length 0) is excluded.