2
$\begingroup$

What is the regular expression for the following language?
$$L = \{acbc: a,b,c \in \{0,1\}^+ \}$$ maybe we can say $$L = ((0 + 1)^+ 0 (0 + 1)^+ 0) + ((0 + 1)^+ 1 (0 + 1)^+ 1)$$ Is it true??

$\endgroup$
  • 4
    $\begingroup$ Hint: it's something of a "trick" question. See if you can work out how to make almost any string be in the language. $\endgroup$ – David Richerby Nov 8 '18 at 13:42
  • 3
    $\begingroup$ Hint: you can assume $|c|=1$ (why?). $\endgroup$ – Yuval Filmus Nov 8 '18 at 17:22
  • 1
    $\begingroup$ Welcome to Computer Science! We discourage posts that simply state a problem out of context, and expect the community to solve it. Assuming you tried to solve it yourself and got stuck, it may be helpful if you wrote your thoughts and what you could not figure out. It will definitely draw more answers to your post. Until then, the question will be voted to be closed / downvoted. You may also want to check out these hints, or use the search engine of this site to find similar questions that were already answered. $\endgroup$ – Raphael Nov 8 '18 at 17:49
  • 1
    $\begingroup$ Try to prove my hint. $\endgroup$ – Yuval Filmus Nov 9 '18 at 4:38
0
$\begingroup$

I claim that $L$ is equal to the set of all strings of the form $a\gamma b\gamma$, where $a,b \in \{0,1\}^+$ and $\gamma \in \{0,1\}$. Indeed, a string of this form clearly belongs to $L$. Conversely, if $acbc \in L$ and $c=d\gamma$, then $acbc = ad\gamma bd\gamma$ belongs to the new set. The new set is clearly described by the regular expression $$ (0+1)^+0(0+1)^+0 + (0+1)^+1(0+1)^+1. $$

$\endgroup$
0
$\begingroup$

The question seems a bit less detailed. Note that, you have defined, a, b and c belong to {0,1}+ . Here, there is no upper bound for the length of c. We know that, regular expressions can only express regular languages, i.e. languages which are recognized by any Finite State Machine, like DFA. Finite State Machines have finite memory. To recognize the above language, machine needs to store the contents of first 'c' to match with the second 'c'. As the length of 'c' can be infinite, a Finite State Machine can not recognize this language.
However, if we introduce an upper bound to the length of 'c', then it will be regular language and can be expressed by a RE. For |c| = 1, your RE is correct.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.