Question

Theoretical Foundation of Computer Science. Is this a regular language: a set consisting of strings x...

Theoretical Foundation of Computer Science.

Is this a regular language: a set consisting of strings x such that x is of prime length or x is of odd length. Prove your answer.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

This is a language L consists of 2 other languages L1 : A set of strings X such that is X is of Prime length or L2 : Set of strings X such that X is of odd length.

L = L1 ? L2

For L to be regular both L1 and L2 should be regular.

A language is regualr if we can define a FINITE AUTOMATA for it.

L1 is not regular as we can't define a FINTITE AUTOMATA for it.

we can prove this by using PUMPING LEMMA.

The pumping lemma says that for any regular language L there exists a constant p such that any word w in L with length at least p can be split into three substrings,
w = xyz, where the middle portion y must not be empty, such that the words xz, xyz, xyyz, xyyyz, … constructed by repeating y zero or more times are still in L.

L1 = { X | K is length of X and K is a prime number}

RULE :
i.e w = word or input belongs to L1 / |w| >=n
   w=xyz is in L1
   For all i ? 0, the string xyiz is also in L1

STEP 1 : Assume the given language is regular.

STEP2: As per pumping lemma , if the given language is regular, we can split the input w into 3 letters as xyz.

             w = xyz

             Length of xyz = K

             |xyz| = K and |y|>=1 {As middle portion y must not be empty}

            Now we will loop the middle portion y and check if it is belongs to the language of not.

           |xyiz| = K , here i should >=0 as mentioned earlier.

          So i value can also be K+1

        i.e |xyK+1z| = |xyz|+|yK|

                         = K+ K(|y|) { As we already know length of xyz is K and y is repeating K times}

             |xyiz| = K(1+|y|) {here lenght of y is not zero as per pumping lemma}

          we are represening the value in mulples of some numbers , that means it is not a prime number.

    As our state is not true, it is not REGULAR.

Even L2 is REGULAR as we can define a Finite automata but L1 is NOT REGULAR, L is NOT REGULAR.

Add a comment
Know the answer?
Add Answer to:
Theoretical Foundation of Computer Science. Is this a regular language: a set consisting of strings x...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT