I'm fairly new to Formal Languages and I am still learning the pumping lemma.
Is it possible to know if a language is regular without knowing it's grammar?
Consider the language L over alphabet Σ={3,5} of all words for which the arithmetic sum of the constituent symbols is divisible by 5.
Now I don't know if this language is regular or not.
I assumed it to be not regular and tried to prove that it is not regular using Pumping lemma for regular languages.
I took n=6 and 'w' as 335333 here 3+3+5+3+3+3=20 which is divisible by 5, so this word belongs to L.
Sub-strings : x=33, y=53, z=33 So conditions |y|>=1 is true and |xy|<=n i.e. 6 is also true.
(w)^i=x(y)^iz
w^i=33(53)^i33
now for i=2 we get string as 33535333 where sum is 3+3+5+3+5+3+3+3=28, not divisble by 5. Hence, this language is not a regular language.
But then after some thought I was able to make a DFA, which means that this Language L should be regular.By making a pentagon with edges having 3 and self loops of 5 on each corner.(Can't post the image). Start state as it's final state.
Now I don't know what's wrong in my Pumping lemma proof.
I'd appreciate any hints or comments that may help me.
Many thanks in advance.
Your pumping lemma proof goes wrong right away; you say “I took $n=6$”. But you don't get to pick $n$. The pumping lemma only tells you that if $L$ is irregular then there exists some such $n$, not what it will be.
And then you make a similar mistake later, when you pick $u,v,$ and $w$. You don't get to choose these; your proof must go through for any choice of $u,v,$ and $w$.
Think of the pumping lemma as a game:
You don't get to make Mr. Pumping Lemma's moves; he makes them, and your proof must present a strategy that wins even though Mr. Pumping Lemma is trying to beat you.