Sets and Formal Languages
Aligned to the AQA 7517 specification
- Level
- Intermediate
- Reading time
- 5 min
- Published
- 13 June 2026
- Updated
- 1 July 2026
On this page
Key takeaways
- A set is an unordered collection of distinct elements, so {1, 2, 2, 3} is the same as {1, 2, 3} and cannot contain duplicates.
- Union A ∪ B contains elements in A, B or both; intersection A ∩ B contains elements in both; complement A̅ contains all elements of the universal set U not in A.
- The Cartesian product A × B is the set of all ordered pairs (a, b) with a ∈ A and b ∈ B, and |A × B| = |A| × |B|.
- An alphabet Σ is a finite non-empty set of symbols, a string is a finite sequence of those symbols, and Σ* is the infinite set of all strings over Σ including the empty string ε.
- Σ* is countable but the set of all languages over Σ is uncountable, so there are more problems than programs and most problems cannot be solved by any program.
How much of this have you taken in?
Quiz yourself on this section, free, no card needed.
Key terms
- Set
- An unordered collection of distinct elements containing no duplicates.
- Union (∪)
- The set of all elements that are in A, in B, or in both.
- Intersection (∩)
- The set of all elements that are in both A and B.
- Complement (A̅)
- The set of all elements of the universal set U that are not in A.
- Universal set (U)
- The set of all elements under consideration in a given context, of which every other set is a subset.
- Cardinality
- The size of a set, that is the number of elements it contains.
- Cartesian product (A × B)
- The set of all ordered pairs (a, b) where a ∈ A and b ∈ B.
- Alphabet (Σ)
- A finite, non-empty set of symbols over which strings are formed.
- String
- A finite sequence of symbols drawn from an alphabet Σ.
- Empty string (ε)
- The string with zero symbols, so |ε| = 0; it is not itself a symbol in Σ.
- Σ*
- The set of all possible strings over Σ including ε; infinite even when Σ is finite.
- Countable set
- A set whose elements can be listed in a sequence, that is put into one-to-one correspondence with ℕ.
Frequently asked questions
∅ is the empty set, which contains no elements, so |∅| = 0. {∅} is a set containing one element, the empty set itself, so |{∅}| = 1. They are different.
Σ* is the set of all possible strings over the alphabet Σ, including the empty string ε. It is an infinite set even when Σ is finite. A language is any subset of Σ*.
Because Σ* is countable, meaning there are countably many possible programs, but the set of all languages over Σ is uncountable, meaning there are uncountably many possible problems. There are therefore more problems than programs, so most problems cannot be solved by any program.
Generate revision on any topic you study
Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set, personalised to your level.
Lessons on anything
Structured, level-matched lessons on any topic you study
Practice quizzes
Find out what you actually know before the exam does
Flashcard sets
Lock in key concepts with instant revision cards
Ask Aica
Stuck on something? Get a clear explanation, any time
Finite State Machines
Regular Expressions
Related lessons
9 min
8 min
6 min