0
$\begingroup$

I'm currently doing work on discrete mathematics in my free time and am having some difficulties with understanding some questions pertaining to Languages defined by regular expressions. To be specific, I'm stuck on the following practice question:

For $\Sigma=\{0,1\}$, determine whether the word $00010$ in $\Sigma^*$ is in each of the languages below. Explain.

  • $\{00\}\{0\}^*\{10\}$
  • $\{000\}^*\{1\}^*\{0\}$
  • $\{00\}^*\{10\}^*$

I'm a bit stuck on understanding how to calculate these three languages. Do I just multiply/concatenate them together step by step? How would I go about doing that? Any help is appreciated. Thanks!

$\endgroup$
6
  • $\begingroup$ Does {00}{0}*{10} mean all words that are formed by starting with '00' followed by any number of '0' and ending with '10'? $\endgroup$
    – user137481
    Oct 26, 2015 at 16:59
  • $\begingroup$ Yes, most likely. At this point anything to help me figure out the question is very welcome :) $\endgroup$ Oct 26, 2015 at 17:01
  • $\begingroup$ You don’t really need to calculate the entire language. You just have to match the given word against the pattern given by the REs. Go symbol by symbol through the word and the RE in parallel. Another approach is to translate the REs into a sentence that describes the RE. E.g., the first one is “a string of at least two 0s followed by a 1 and a 0.” $\endgroup$
    – amd
    Oct 26, 2015 at 17:20
  • $\begingroup$ @amd So would I say that for A 00010 is NOT in the language? Since two 0s followed by a 1 and a 0 is 0010? $\endgroup$ Oct 26, 2015 at 17:40
  • $\begingroup$ No, for A) the 00010 can be formed from one {00} followed by one {0} and finally by one {10}. For B), you choose one {000} followed by one {1} followed by one {0}. There is no way to form the word in C since C can form only words that begin with either 10 or with an even number of 0's while '00010' begins with an odd number of 0's $\endgroup$
    – user137481
    Oct 26, 2015 at 18:10

1 Answer 1

2
$\begingroup$

The first language, $\{00\}\{0\}^*\{10\}$, consists of all words in $\Sigma^*$ that begin with $00$, end with $10$, and have any number of zeroes (including none at all) between those two segments. You could describe them as the words of the form $000^n10$, where $n\ge 0$, and $x^n$ means a string of $n$ $x$s. Alternatively, you could combine the two required zeroes with the optional ones and describe the language as the words of the form $0^n10$, where $n\ge 2$. Is $00010$ of this form? Yes, with $n=3$.

Now let’s look at the second language, $\{000\}^*\{1\}^*\{0\}$. The expression $\{000\}^*$ corresponds to taking any finite number of copies of $000$, including none at all, and concatenating them: $\lambda$, $000$, $000000$, $000000000$, and so on (where $\lambda$ stands for the empty word). Using the same kind of notation as in the first paragraph, we can say that it corresponds to the words of the form $(000)^{3n}$ for $n\ge 0$. The $\{1\}^*$ gives any non-negative number of ones, so it gives us all words of the form $1^m$ for $m\ge 0$. Thus, the language consists of all words of the form $(000)^{3n}1^m0$ with $n,m\ge 0$. Is it possible to choose $n$ and $m$ so that $00010$ has this form? Sure: take $n=m=1$.

I’ll leave the last one for you to try, now that you’ve seen a way of attacking the problem.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .