MHB Regular and Context-free languages

  • Thread starter Thread starter evinda
  • Start date Start date
  • Tags Tags
    Regular
AI Thread Summary
The discussion focuses on demonstrating the regularity of language L1 and the context-freeness of language L2 using closure properties. L1, defined as strings that contain "000" and also "111," is shown to be regular through closure under complement and union. L2, concerning sequences of balanced parentheses with a restriction on the number of pairs, is established as context-free by intersecting a context-free language with a regular one. Participants clarify the correct alphabet and conditions for the languages, ensuring accurate definitions. Overall, the analysis confirms the properties of both languages as intended.
evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! (Wave)

Show,using the closure properties,that from the following languages over $\Sigma= \{ 0,1,2\}$,the first one is regular and the second one is context-free.

  • $ \displaystyle{ L_1=\text{ the strings,that,when they contain at least one "000", } \\ \text{they contain also at least one "bbb" }}$
  • $\displaystyle{ L_2=\text{ the sequences of balanced parenthesis, } \\ \text{ at which in one parenthesis,there can't be more than two pairs of parenthesis} \\ \text{(for example the language does not contain this string: "()(()()())()") }}$

That's what I have tried:

  • $$M_1=(\Sigma^* \{ 000 \} \Sigma^*), M_2=(\Sigma^* \{ 111\} \Sigma^*) \\ L_1=(\Sigma^*-M_1) \cup M_2$$
    We conclude that $L_1$ is regular,from the closure under the complement and the union.
    $$$$
  • We know that the language $P$ of balanced parenthesis is context-free and the language $B=\Sigma^* - (\Sigma^* ()()() \Sigma^*)$ is regular,as a complement of a regular language.

    Since $L_2=P \cap B$ is the intersection of a context-free language with a regular one, $L_2$ is context-free.
Could you tell me if it is right or if I have done something wrong? (Thinking)
 
Technology news on Phys.org
Hint: In typed text, every comma and period must be followed by a space.

evinda said:
Show,using the closure properties,that from the following languages over $\Sigma= \{ 0,1,2\}$,the first one is regular and the second one is context-free.

  • $ \displaystyle{ L_1=\text{ the strings,that,when they contain at least one "000", } \\ \text{they contain also at least one "bbb" }}$
Since you are talking about "bbb", the language does not seem to be over $\Sigma= \{ 0,1,2\}$.

evinda said:
  • $\displaystyle{ L_2=\text{ the sequences of balanced parenthesis, } \\ \text{ at which in one parenthesis,there can't be more than two pairs of parenthesis} \\ \text{(for example the language does not contain this string: "()(()()())()") }}$
This language is not over $\Sigma$ either. More importantly, I am not sure I understand the condition "inside every pair of parentheses, there can't be more than two pairs of parentheses". Are the following strings allowed: "( ((())) )", "( (()) () )"?

evinda said:
  • $$M_1=(\Sigma^* \{ 000 \} \Sigma^*), M_2=(\Sigma^* \{ 111\} \Sigma^*) \\ L_1=(\Sigma^*-M_1) \cup M_2$$
    We conclude that $L_1$ is regular,from the closure under the complement and the union.
This is correct. Well done!
 
Evgeny.Makarov said:
Hint: In typed text, every comma and period must be followed by a space.
I will take it into consideration..

Evgeny.Makarov said:
Since you are talking about "bbb", the language does not seem to be over $\Sigma= \{ 0,1,2\}$.

Oh,sorry! I meant "111", instead of "bbb" .. (Tmi)

Evgeny.Makarov said:
This language is not over $\Sigma$ either. More importantly, I am not sure I understand the condition "inside every pair of parentheses, there can't be more than two pairs of parentheses". Are the following strings allowed: "( ((())) )", "( (()) () )"?

I don't know.. (Sweating) It is only given that the substrings of the form $() \dots ()$ consist always of at most two pairs of parentheses.

Evgeny.Makarov said:
This is correct. Well done!

(Happy)
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
hi; i purchased 3 of these, AZDelivery 3 x AZ-MEGA2560-Board Bundle with Prototype Shield and each is reporting the error message below. I have triple checked every aspect of the set up and all seems in order, cable devices port, board reburn bootloader et al . I have substituted an arduino uno and it works fine; could you help please Thanks Martyn 'avrdude: ser_open(): can't set com-state for "\\.\COM3"avrdude: ser_drain(): read error: The handle is invalid.avrdude: ser_send(): write...

Similar threads

Back
Top