Proving nonregularity - regular-language

Suppose I have a language L = {wxwR} where wR is the reverse of w, w and x has minimum length of 1, w can consist of either 0's or 1's, while x can only consist of 1's.
How do I prove that this language is not regular? Is there any other way than using the pumping lemma? If using the pumping lemma, I'm still figuring out what x,y, and z I should pick for the string s=xyz, I would appreciate if you give me any hint.
Thanks!

You should take another look into how to use the pumping lemma. You have to pick a string s, such that for each partition x,y,z, one of the pumping lemma conditions is violated.
So, let n be the "pumping-lemma-number". Pick s= 0^n 1 0^n.
From 1) you know that |xy| <= n. From 2) you know that |y|>=1. Thus y only contains 0s.
Following 3) uv^2w has also to be in L, but the first block of 0s is longer than the second one. This means 3) is violated and thus L is not regular.

Related

If the string of L consists of 0's only prove that L* is regular

A question 4.2.10 from Introduction to Automata Theory by Hopcroft and Ullman. The original language L can also be non-regular.
Let's say we got a function of 0^(2^n+5), n>=0, how would you prove that (0^(2^n+5))* is regular? And also for the more general case, when f(0) can be any function?
Suppose that L contains two strings 0^n and 0^m and that n and m share no common factors: they are relatively prime. Then, by concatenating some number of instances of 0^n with some number of instances of 0^m, any string of length (n - 1)(m - 1) can be formed. Since L* must therefore exclude only a finite number of words, the complement (L*)' must be finite, hence regular; because regular languages are closed under complement, L* must be regular too.
Where did (n - 1)(m - 1) come from? Well, it's a special case (n = 2) of the coin problem for which we have a closed-form solution. You should be able to research this and find some proofs.
What about the case where all strings in L have lengths divisible by some GCD, say g? Well, the proof of regularity is quite similar; consider a modified alphabet where 0 is replaced by the symbol (0^g) and then prove the analogous language over this alphabet is regular as above. In other words, you can show that L* contains only strings divisible by g and all strings divisible by g of length at least (n/g - 1)(m/g - 1) where n and m have GCD g. The language is regular because it excludes only finitely many words whose lengths are divisible by g.

L = { 1 ^ n (n+1) / 2 } is context free ?

I noticed the the language L generates words with a length that represents trianglar numbers: 1,3,6,10,15 etc..
I'm trying to use the pempingt lemma for w=1^(p(p+1) but I didnt reach anywhere..
Can someone help or give me an idea how to solve it ?
Thanks ! :)
All context-free languages over one-letter alphabet are regular. So if L was context-free it would also be regular. All regular languages over one-letter alphabet are ultimately periodic, which your L is not, because the gaps get all the time bigger.
Or with the pumping lemma: any pumping results in a language uv^i w x^i y. Because all letters are the same we can exchange factors, and this is equal to uyw v^i x^i = uyw(vx)^i. In L the distance between one word and the next will get bigger than any |vx|^i as n grows.

Proof of reverse binary strings?

If w : {1...L} → {0,1} is a binary string, the complement of w, denoted wC, is a string of length L defined by: wc(i) = 1 - w(i). The reverse of w, denoted wR, is the string of the length L defined by wR(i) = w(L + 1 - i). Use these definitions to give careful proof that, for every binary string x, (xC)R = (xR)C.
I have no idea how to start this question. I don't really want a direct answer I'd like to learn how to do this question by induction for future questions
If the solution I see is the simplest one, then it's a quite comprehensive exercise.
I suggest you start by proving a the following lemmas:
Lemma 1: (w0)C=(wC)1
Lemma 2: (w0)R=0(wR)
Both Lemma 1 and 2 can be proven by induction on the length of w. Doing it strictly by the given rules is tedious, but not very hard.
Argue that the following lemmas hold as well by the same argument
Lemma 1b: (w1)C=wC0
Lemma 2b: (w1)R=1(wR)
With those lemmas in place, you should be able to tackle the original problem of showing (xC)R=(xR)C.
Do an induction over L (i.e. the length of the word). The base case should be trivial. In the inductive step you'll end up with something like
Induction hypothesis
(uC)R=(uR)C.
Left to show:
((u0)C)R=((u0)R)C
and (by analogy)
((u1)C)R=((u1)R)C
Solving this step will involve the lemmas above.

Can someone help me with this proof using the pumping lemma?

I just started reading about the pumping lemma and know how to perform a few proofs, mostly by contradiction. It is only this particular question which I don't seem to find an answer for. I have no idea on how to begin. I can assume that there has to be a pumping length P and that for all w element of L that the LENGTH(w) >= P. And of course that we can write w as xyz with the three normal conditions of the pumping lemma.
I have to proof that the following language is non regular:
L = {x + y = z | x,y,z element of {0,1}* and #(x) + #(y) = #(z) }
Can someone help me on this, I really want to master the process in proofing these kind of questions?
Edit:
Sorry, forgot to say that the alphabet is {0,1,+,=} and # means the binary value of the string. Like #(00101) = 5 and #(110) = 6.
Since you want to master the process, I'll point out a few things before showing a proof.
The first thing to notice is that the + and the = may only appear once each. So when you write your string w as w = abc, the pumped portion, b, cannot contain + or = otherwise you'd reach a trivial contradiction (I'm not using the more standard w = xyz notation to avoid confusion with L's definition).
Another thing to notice is that normally, you'd pick a specific string w to pump. In this case, it could be easier to pick a class of strings that share a certain property. The pumping lemma only requires you to reach a contratiction using one string, but there's no reason you can't reach a contradiction with multiple strings.
Proof (in a spoiler):
So let w be any string in L such that |w| ≥ P and x, y, z do not contain leading 0's. By the pumping lemma we can write w as w = abc By pumping lemma, we know b is not empty. Since b cannot contain + or =, it is fully contained in either x, y, or z. Pumping w with any i ≠ 1 results in the binary equation no longer holding since exactly one of x, y, z would be a different number (this is why we needed the no leading 0's bit).
Choose as the string 1(0^n+1) + 1(0^n) = 11(0^n).
In other words, your string will read "the sum of two to the power n+2 plus two to the power n+1 is equal to 11 followed by n zeroes".
Since the string to be pumped will consist entirely of symbols from the first addend, pumping must change the number represented (adding or removing digits to a number will change the number; this is true because our string doesn't contain leading zeroes) and if x + y = z holds, then x' + y = z does not hold if x' != x (over integers, at least).
Since the pumping lemma requires pumped strings to be in the language, and pumping this string fails, we have that the language is not regular.

Pumping lemma for regular language

I have a little confusion in checking whether the given language is regular or not using pumping lemma.
Suppose we have to check whether:
L. The language accepting even number of 0's in regular or not?
We know that it is regular because we can construct a DFA for L. But I want to prove this with pumping lemma.
Now suppose, I take a String w= "0000":
Now will divide the string as x = 0, y = 0, and z = 00. Now on applying pumping lemma for i = 2, I will get the string "00000", which is not present in my language so by pumping lemma its prove that the language is not regular. But it is accepted by DFA ?
Any help will be greatly appreciated
Thank you
You are not completely clear about pumping lemma.
What pumping lemma say:
Formal definition: Pumping lemma for regular languages
Let L be a regular language. Then there exists an integer p ≥ 1 depending only on L such that every string w in L of length at least p (p is called the "pumping length") can be written as w = xyz (i.e., w can be divided into three substrings), satisfying the following conditions:
|y| ≥ 1
|xy| ≤ p
for all i ≥ 0, xyiz ∈ L
But what this statement says is that:
If a language is really a regular language then there must be some way to generate(pump) new strings from all sufficiently large strings.
Sufficiently large string means, a string in language that is of the length ≥ P.
So it may not be possible to generate new string from small strings even if language is Regular Language
Some way means, if language is really a regular and our choice of w is correct. Then there should be at lest one way to break w in three parts xyz such that by repeating(pumping) y for any number of times we can generate new strings in the language.
correct choice of w means: w in language and sufficiently large ≥ P
note: in second point, there may be a chance that even if you breaks w correctly into xyz according to formal definition still some new generated strings are not in language. As you did.
And in this situation you are to retry with some other possible choice of y.
In you chosen string w = "0000" you can break w such that y = 00. And with this choice of y you would always find a new generated string in in Language that is "even number of zeros"
One mistake you are doing in your proof that you are doing for a specific string 0000. You should proof for all w ≥ P. So still your proof is incomplete
Read my this answer IN CONTEXT OF PUMPING LEMMA FOR REGULAR LANGUAGES
In that answer, I have explained that breaking w into xyz and pumping y means finding looping part and repeating looping part to generate new strings in language.
When we proof that some language is regular; then actually we don't know where is the looping part so we try with all possible choices that satisfies pumping lemma's rule 1,2 & 3.
And Pumping lemma says that if language is regular and infinite them there must be a loop in the DFA and every sufficiently large string in language passes through looping part (according to pigeonhole principle) of DFA (and hence y can't be null. That's rule-1 in above formal definition).
Think, loop can be at initial position or at end and so x and z can be null strings.
But actually we don't know where loop falls in DFA so we try with all possible ways.
To proof a language is regular: You are to proof that for all sufficiently long strings(w) in language there is at-least one way(y) to generate new strings in the language by repeating looping part any number (i) of times.
To proof a language is not regular:You are to find at least one sufficiently long strings (w) in language such that there no choice for any way 'y' so that its possible to generate new strings with all possible repetition (i).
To proof using Pumping Lemma:
+-------------------------+--------------------------+----------------+--------------+
| | Sufficient large W in L | y | i >=0 |
+-------------------------+--------------------------+----------------+--------------+
| language is regular | For all W (all W can use | At-least one | For all i>=0 |
| | to generate new W' in L) | | |
+-------------------------+--------------------------+----------------+--------------+
| language is NOT regular | Find Any W (at-least 1 | With all (Show | At-least one |
| | W that can't generates | no possible Y | i |
| | new W' in L | exists) | |
+-------------------------+--------------------------+----------------+--------------+
CAUTION:: The Rule always not works to proof 'Weather a Language is Regular?'
Pumping Lemma necessary but not sufficient condition for a language to be regular. A language possible that satisfies these conditions may still be non-regular.
Reference
To proof a language is regular you have some necessary and sufficient conditions for a language to be regular.
Although the accepted answer is complete in its own way, I had to add a few things. I have a very playful way to exploit the pumping lemma to be able to prove that a given language is not a Regular language.
Just to have a context to talk about, let me state the lemma:
Pumping Lemma for Regular Languages:
For any regular language L, there exists an integer k.
Such that for all x ∈ L with |x| ≥ k, there exists u, v, w ∈ Σ∗, such
that x = uvw, and
(1) |uv| ≤ k
(2) |v| ≥ 1
(3) for all i ≥ 0: u(v^i)w ∈ L
The k is called the Pumping lemma constant. Let me come straight to the point and show you how to go about proving a language L is not regular.
Now to start the game you need two players here. One is the Reader(R) and the other is the Adversary(A).
Input: A language L
The Goal of R: Somehow prove the language L is not regular by some contradiction.
The Goal of A: Somehow be prepared enough to face the arguments of R and do not let him/her create a contradiction.
Now let us start the argument.
A: The language L is not Irregular because none could show the contradiction using pumping lemma with a certain pumping constant k. (Each language is mapped to only one integer k)
R: Let me assume what you say. If language L is regular then it must satisfy the conditions of the pumping lemma. So, let me choose a suitable string x ∈ L (|x| >= k), such that it helps me create a contradiction later.
A: Challenged by the R, A tries its best to find at least one suitable partitioning u, v and w of the string x, such that
x = uvw and |uv| <= k and |v| > 0
R: With any possible partition given by A, wins the the argument if able to show an integer i >= 0 such that
u(v^i)w ∉ L
Because now the R has shown that the Language L has at least one string x which doesn't have any partition(u, v, w) such that it satisfies the pumping lemma. The contradiction happened because our assumption that L is regular is FALSE. Therefore the language L is proven to be not regular.
If the R is not able to show the above, this is not a Proof of the language being Regular. It just means that L can be a Regular or Irregular language which just happens to satisfy the pumping lemma conditions.
Always remember, the pumping lemma is if(L is regular), then Statements. The vice-versa is not necessarily TRUE. Although it might be TRUE in some cases.
Therefore the pumping lemma is useful only if you want to prove that a language is not regular.
(Source: Theory of Computation(NPTEL): Prof. Somenath Biswas(IIT Kanpur)

Resources