Languages
This section will be about strings, languages and language operations. You can find the related notes here. Note: When discussing the empty string you may see with \(\lambda\) or \(\varepsilon\). Please be aware that these are the same string, namely the string of length 0.
Definitions and Properties
I first introduce what we mean by a string and a language in the context of theoretical computer science. I provide some common properties of these objects that will re-occur throughout the course.
Operations on languages
Much like sets, languages also have associated operations. I discuss some of these along with some exercises. Extra exercises are at the end of the handout for you to practice!
Exercises
b) Prove by induction that \[ (w \cdot v)^R = v^R \cdot w^R. \]
Exercise. Given \( \Sigma = \{a, b\} \), \( L_1 = \{a, ab, abab\} \), \( L_2 = \{(ab)^n : n \in \mathbb{N}\} \).
What is the result of the following language operations?
- \( L_1 \cup L_2 \)
- \( L_1 \cap L_2 \)
- \( L_1 - L_2 \)
- \( L_2 - L_1 \)
Exercise. Given \( \Sigma = \{a, b\} \) and \( L_1 = \{a, ab, abab\} \). How many strings of length 0, 1, and 2 are there in \( L_1^* \)?
Exercise. Given \( \Sigma = \{a, b\} \), \( L_1 = \{a^n : n \in \mathbb{N}\} \), \( L_2 = \{b^n : n \in \mathbb{N}\} \).
What is the result of the following language operations?
- \( L_1 \cdot L_2 \)
- \( (L_1)^2 \cdot (L_2)^2 \)
- \( L_1^* \cdot L_2^* \)
Exercise. Given \( \Sigma = \{0\} \) and \( L \subset \Sigma^* \). Are the following statements true or false?
- If \( L \) is finite and \( n \in \mathbb{N} \), \( n \geq 2 \), then \( |L^n| = |L|^n \).
- If \( L \) is finite then \( |L^*| = |\mathbb{N}| \).
Exercise. Let \( \Sigma = \{a, b\} \) be an alphabet and let \( L_1, L_2 \subseteq \Sigma^* \) be languages. Find particular examples for \( L_1 \) and \( L_2 \) such that the following statements are satisfied.
- \( L_1^0 = \{\varepsilon\} \)
- \( |L_1 \cup L_1^2| = |L_1| + |L_1|^2 \)
- \( L_1 \subseteq L_2 \ \text{and}\ L_1 \cdot L_2 = L_2 \cdot L_1 \)
- \( L_1 \cdot L_2 = L_1 \)
- \( |L_1 \cdot L_2| = |L_1 \times L_2| \)