MCS-212 · Block 2 Unit 2

Automata and Languages

Section 2 of 8

Block 2 · Unit 2Automata and Languages10 min · Section 2 of 8

2.2Kleene closure and products of languages

Covers IGNOU MCS-212 §2.2.2, 2.2.3 (product of sets of strings), Ex.2

Languages are sets, so we can take unions and intersections. Two further operations are special to languages: the product (concatenate a string from one language with a string from another) and the star (concatenate any number of strings from a language). These two operations are exactly what regular expressions are built from.

Kleene star and positive closure

For an alphabet, Σ∗\Sigma^* is the set of all strings over Σ\Sigma: if Σ={0,1}\Sigma = \{0, 1\}, then Σ∗={λ,0,1,00,01,10,11,000,… }\Sigma^* = \{\lambda, 0, 1, 00, 01, 10, 11, 000, \dots\}. Every language over Σ\Sigma is a subset of Σ∗\Sigma^*.

Proof. S∗⊆(S∗)∗S^* \subseteq (S^*)^*, because every string of S∗S^* is a product of one string of S∗S^*. Conversely, a string of (S∗)∗(S^*)^* is x1x2…xnx_1 x_2 \dots x_n with each xi∈S∗x_i \in S^*; each xix_i is a product of strings of SS, so the whole string is a product of strings of SS, i.e. it is in S∗S^*. Hence (S∗)∗⊆S∗(S^*)^* \subseteq S^*. ■\blacksquare

Key takeaways

  • STST: a string of SS followed by a string of TT.
  • S∗={λ}∪S∪SS∪…S^* = \{\lambda\} \cup S \cup SS \cup \dots; S+=S∪SS∪…S^+ = S \cup SS \cup \dots
  • Σ∗\Sigma^* is the set of all strings over Σ\Sigma.
  • (S∗)∗=S∗(S^*)^* = S^*.

Practice questions

Answer on paper first, then check. The explanation matters more than the letter you chose.

Question 1 · multiple choice

Which string is in {ab,b}∗\{ab, b\}^*?

Show answer

Answer: C. babbbabb

babb=b⋅ab⋅bbabb = b \cdot ab \cdot b. Option 2, baba, ends with an aa that is not followed by bb, so it cannot be cut into pieces abab and bb.

Question 2 · multiple choice

How many strings does {a,b}{a,b,λ}\{a, b\}\{a, b, \lambda\} contain?

Show answer

Answer: B. 6

Each of 2 strings is followed by each of 3 strings, giving aa,ab,a,ba,bb,baa, ab, a, ba, bb, b — 6 different strings. Option 1 forgets the strings formed with λ\lambda.

Question 3 · multiple choice

Is λ∈{ab}+\lambda \in \{ab\}^+?

Show answer

Answer: A. No

S+S^+ uses at least one string of SS, and λ∉{ab}\lambda \notin \{ab\}. Option 2 is true only for the Kleene star S∗S^*.

Question 4 · multiple choice

For Σ={0,1}\Sigma = \{0, 1\}, how many strings of length at most 2 are in Σ∗\Sigma^*?

Show answer

Answer: C. 7

1+2+4=71 + 2 + 4 = 7 (one of length 0, two of length 1, four of length 2). Option 2 forgets λ\lambda.

Question 5 · multiple choice

Which statement is always true?

Show answer

Answer: D. S∗=S+∪{λ}S^* = S^+ \cup \{\lambda\}

The star adds the zero-piece case λ\lambda to the positive closure. Option 1 fails when λ∉S\lambda \notin S.

Question 6 · short answer

Describe {cc,d}∗\{cc, d\}^* in words and decide whether ccccdcccccc d cc and dcddcd belong to it.

Show worked answer

{cc,d}∗\{cc, d\}^* is the set of all strings over {c,d}\{c, d\} (including λ\lambda) in which every maximal block of consecutive cc‘s has even length. ccccdcc=cc⋅cc⋅d⋅ccccccdcc = cc \cdot cc \cdot d \cdot cc, so it belongs. dcddcd has a block of one cc (odd length), so it does not belong.

↑ ↓ move↵ openTab switch type