Exercise 2 of the exam held the 21/01/25

Exercise 2 of the exam held the 21/01/25

by CAMILLA BELLANTUONO -
Number of replies: 3

Good morning. I had a doubt on the b) question of this exercise. 

L2 is in REG so exist a regular expression that generates L2. In the solution the regular expression is: 

R = baa∗aa(aa)∗b   but I found another one which is    R = baaaa*b

Is this correct or not? I think it is equivalent because we don't have costraints on the blocks of m and n, apart from the fact that they both have to be greater than 1.

I put here the exercise and the solution:

image.pngimage%20%281%29.png

In reply to CAMILLA BELLANTUONO

Re: Exercise 2 of the exam held the 21/01/25

by NICOLA RANZOLIN -

Your solution works. Since \(m \ge 1\) and \(2n \ge 2\), the middle block simply contains at least 3 \(a\)'s.

Because \(m\) increments by 1, the total count covers every integer \(\ge 3\), so that final \(a^*\) covers this. The official solution just mechanically translates the two parts (\(a^m\) and \(a^{2n}\)) separately.

In reply to CAMILLA BELLANTUONO

Re: Exercise 2 of the exam held the 21/01/25

by Diego Bortolami -

Dear Camilla,

the language is b(a^m)(a^2n)b. So for the regex you have to consider (a^m) = aa* since it must contains al last one "a". for (a^2n) = aa(aa)* since it must contains al last two "a". This in because n,m =>1.