Exam of the 25th Jan 2021, esercise 2

Exam of the 25th Jan 2021, esercise 2

by LEONARDO ONGARO -
Number of replies: 0

Hi everyone

I had a doubt about the 2nd exercise, exam of the 25th January 2021.

For the first language I've applied the pumping lemma to prove the language is a CFL, just like the solution.

For the second language I've taken the intersection of  L2 with the language generate by the regex {a*b*c*} obtaining L2' = {anbpcq | n < p or n < q}. Since CFL are closed under intersection, I have to prove that L2' is a CFL. To do that, I have defined a CFG that generate L2'which should be enough to prove that L2' is a CFL and so that L2 is a CFL.

However the solution is slightly different and I was wondering if the two solutions were equivalent or not.

The exercise:

image%20%281%29.png

My CFG:

image%20%282%29.png