0

The language is an infinite set of chains that are defined by the next conditions.

Conditions:

1) The language chains may consist of symbols from the set {1,a,b}. 
2) The language chains always start from subchain '1a'.
3) Every languange chain has to include at least one subchain 'aa'.

For example:

1aa, 1abaa, 1aaab, 1aab1a, ... etc.

My current solution is this:

1a ((1+b)* a)* (a (1+b)*)* a (1+b+a)*

My solution seems to pass tests like these:

Allowed chains    : 1aa, 1aaa, 1abaa, 1aaba, 1aabaa, 1aab, 1aaab, 1aaabaaa
Not allowed chains: 1aba, 1abab, 1ababab

But I'm not quite sure if it's still correct. Is it correct?

If not, please offer your solution using only the type of formal language used in my solution.

Happy Torturer
  • 135
  • 1
  • 8

1 Answers1

1

One way to do it by hand, in such a simple case, would be to build a FA for condition 2, i.e. strings that start with $1a$, and another FA for condition 3, i.e. strings that contain $aa$. Both FAs have only 3 states.

Then you use the intersection construction to have an automaton that obeys both conditions. That remains simple enough if you organize your state pairs as a 3 by 3 matrix.

From that you can easily deduce a regular expression: $1(a+a(a+b+1)^*a)a(a+b+1)^*$

Your solution can be proved consistent (compliant with the stated conditions) with a case analysis over the two main star operators (cases depending on whether there is zero occurrence or at least one). One also has to prove it is complete, i.e. that it does cover all compliant strings.

If you have a constraint regarding the use of parentheses, you should state it in your question. Is there a reason for the constraint ?

Find more details in the answer to your other question about this language, and a comment on how to better write the question.

babou
  • 19,645
  • 43
  • 77