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)
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Back
Top