Tables and Splits: Concatenation, Star, Prefixes
Practice concatenation of languages with a product table, powers and star with split searches, cutting a word into two parts, and prefixes, suffixes and substrings. Every question is drawn at random and checked at once.
Last updated:
Four small exercises on the operations on languages
The tool below draws practice questions and checks the answers at once.
Press “New question” for another one. The question code lets you return to the same question (add ?seed= and the code to the address, for example ?seed=7).
The score counts each question once, at its first check.
- Concatenation table. The concatenation is the set of all words with and . Fill in the product of every pair, see when two different pairs give the same word (a collision), and compare the number of words with the product of the numbers of words of and .
- Powers and star. , , and is the set of all products of any number of words of (the empty product is ). The tool shows a split into words of for a word that belongs, and tries every split for a word that does not.
- Split marker. Mark where to cut a word into so that and . There can be no valid split, one, or several.
- Prefix, suffix, substring. A prefix of is a beginning of it, a suffix is an ending, and a substring is any block of consecutive letters (all three may be empty, and itself is all three). Classify a word, then build , and of a small language.
The tool needs JavaScript. Use the questions below on paper instead.
Questions on paper
Question 1. Let and . List and compare with .
Hint
Write the nine products in a table and look for equal words.
Answer
The products are , , , , , , , and .
So and : three pairs collide on and two pairs on and on .
Question 2. Let . Which of , , belong to ?
Does belong to ?
Hint
Try every place to cut the word into two parts and ask whether both parts are in .
For , cut from the left and see where the cut fails.
Answer
and belong to . For the cuts are , , and , and each has a part outside , so .
It is not in either: the words of that can start with are and , and after either of them the rest ( or ) starts with , which no word of does.
Question 3. Let , and . Find all splits with and .
Hint
Write the four places where can be cut and check in each whether both parts are in the languages.
Answer
The cuts are , , and . The first fails because and the last because .
The other two work: and . So there are two valid splits.
Question 4. How many different prefixes, suffixes and substrings does have (counting and )?
Hint
A prefix is determined by its length: write the prefix of length , , and so on.
For substrings write first the length and then the starting place.
Answer
Prefixes: (5). Suffixes: (5). Substrings: (9).
Question 5. Which words are both a prefix and a suffix of ?
Answer
They are , and .
Back to Languages: Operations and Equalities, or see the glossary.