Strings and language operations
First identify the universe, the empty objects and the quantifiers. Many apparent counting constraints disappear when an existentially chosen substring is allowed to be empty.
1.1 Strings and counting
An alphabet is a finite, nonempty set of symbols. A string is a finite sequence of symbols; is its length, its reversal and its number of occurrences of symbol . The empty string has length zero. contains all strings of length ; contains all finite strings, including .
1.2 Language algebra
Past papers · CS 2014–2026 (23 papers): 2 questions, 3 marks
A language is a subset of . Concatenation chooses its two strings independently: . In particular, ; the two bound indices do not impose equality.
For a language , ; suffix and substring use analogous existential contexts. A homomorphism assigns a string to each symbol and extends by , . It may erase symbols. Its inverse image is .
1.3 Quantifiers and hidden simplifications
Past papers · CS 2014–2026 (23 papers): 3 questions, 6 marks
In , choosing gives every string. If both and must be nonempty, the language is exactly the strings of length at least three whose first and last symbols agree: a one-symbol suffices. Over its expression is .
Repeated copies differ from reversed copies. With nonempty , is not regular. Intersecting with gives , which requires an unbounded comparison. If is restricted to , however, one symbol suffices and the language is .
Last-minute recall
- Specify the alphabet before taking complement.
- is always .
- Concatenation chooses independent strings unless the definition explicitly couples them.
- Count words, not accepting paths or regex parses.
- Try the smallest permitted existential choices first.
- Distinguish copies from mirrors .