Determine how many states the minimal DFA will have - regular-language

This is the pumping lemma to demonstare that a language is not regular:If L is a regular language,there is a const N such that, for each z in L, with |z|>=N, is possibile to divide z in three sub-strings (uvw=z)such that:
1)|uv|<=N;
2)|v|>=1;
3)For each k>=0, uv^kw in L.
N must be less or equal than the minumum number of states of the DFA accepting L.So to apply the pumping lemma I need to know how many states will have the minimal DFA accepting L.Is there a way to know how many states will have backwards?So is possibile to know the minimal number of states without building the minimal DFA?

N must be less or equal than the minumum number of states of the DFA
accepting L
N cannot be less than the number of states in a minimal DFA accepting L; otherwise, the DFA couldn't accept L (if it could, you would have a DFA accepting L smaller than the minimal DFA accepting L, a contradiction). We can safely assume that N is equal to the number of states in the minimal DFA accepting L (such DFAs are unique).
So to apply the pumping lemma I need to know how many states will have
the minimal DFA accepting L
This is not strictly true. In most pumping lemma proofs, it doesn't matter what N actually is; you just have to make sure that the target string satisfies the other properties. It is possible, given a DFA, to determine how many states a minimal DFA will have; however, if you have a DFA, there's no need to bother with the pumping lemma, since you already know L is regular. In fact, determining an N such that there's a minimal DFA with N states accepting L constitutes a valid proof that the language in question is indeed regular.
So is possibile to know the minimal number of states without building
the minimal DFA?
By analyzing the description of the language and using the Myhill-Nerode theorem, it is possible to construct a proof that a language is regular and find the number of states in a minimal DFA, without actually building the minimal DFA (although once you have completed such a proof using Myhill-Nerode, construction of a minimal DFA is a trivial exercise). You can also use Myhill-Nerode as an alternative to the pumping lemma to prove languages aren't regular, by showing a minimal DFA for the language would need to have infinitely many states, a contradiction.
Please let me know whether these observations answer your questions; I will be happy to provide additional clarification.

Related

how to prove an arbitrary language can be accepted by an Infinite state automata

we know that language accepted by a DFA can also be accepted by an ISA for DFA is a special case of ISA, so about an arbitrary language? How to prove it?
Define transitions such that every word in the language has a corresponding accepting state, with whatever supporting states are needed to reach those accepting states (a structure analogous to a trie - https://en.wikipedia.org/wiki/Trie). This automaton is deterministic and will accept any language.

Prove regular language and automata

This is a grammar and I wan to check if this language is regular or not.
L → ε | aLcLc | LL
For example the result of this grammar is:
acc, accacc ..., aacccc, acaccc, accacc, aaacccccc, ...
I know that is not a regular language but how to prove it? Is building an automata the right way to prove it? What is the resulting automata. I don't see pattern to use it for build the automata.
Thank you for any help!
First, let me quickly demonstrate that you cannot deduce the language of a grammar is irregular based solely on the grammar's being irregular. To see this, consider the unrestricted grammar:
S -> SSaSS | aS | e
SaS -> aSa
aaS -> SSa
This is clearly not a regular grammar but you should be able to verify it generates the infinite regular language of all strings of a.
That said, how should we proceed? We will need to figure out what language your grammar generates, and then argue that particular language cannot be regular. We notice that the only rule that introduces terminal symbols always introduces twice as many c as it does a. Furthermore, it's not hard to see the language must be infinite. We can use the Myhill-Nerode theorem to show that these observations imply the language must be irregular.
Consider the prefix a^n of a hypothetical string in the language of this grammar. The shortest string which can be appended to the end of this prefix to give us a string generated by this grammar is c^(2n). No shorter string will work, and that string always works. Imagine now that we were looking at a correct deterministic finite automaton for the language of the grammar. Then, whatever state processing the prefix a^n left us in, we'd need the shortest path from there to an accepting state in the automaton to have length 2n. But a DFA must have finitely many states, and n is an arbitrary natural number. Our DFA cannot work for all possible n (it would need to have arbitrarily many states). This is a contradiction, so there can be no correct DFA for the language of the grammar. Since all regular languages have DFAs, that means the language of this grammar cannot be regular.

Relation of pumping lengths between related regular languages

How does the pumping length of a regular language relate to the pumping length of a related language. For example, if A :< B :< C are all regular languages and k is the pumping length of B, do we know anything about the pumping lengths of A and C?
One might be inclined naively to think that a sublanguage has a smaller (<=) pumping length when we look at finite languages. {a,ab,abc} :< {a,ab,abc,abcd} have respective pumping lengths 4 <= 5. Taking an element out of a set can't make its longest word even longer.
On the other hand if you look at the state machine formed by the synchronized product of two languages, the intersection language and the union language have the same state machine structure, but differ in that the set of final states of the intersection is a subset of the set of final states of the union. Having more final states, could make it more probable to find a shorter path through the state machine. But on the contrary having fewer final states makes it more likely that the state machine has non-co-accessible states, and is thus reducible.
Note first that all languages over an alphabet are related to all other languages over that alphabet by some relation, however contrived. We really do need to limit discussion, as you have suggested, to something like subset in order to meaningfully scope the question.
Now, you've already correctly noted that in the general case, the subset relation doesn't have a clear bearing on the pumping lengths of relative languages. You can easily take a* and compare to {a^n} and show that a minimal DFA for a* is almost always simpler than one for {a^n}.
Let us further restrict ourselves to languages that differ by a finite number of entries; that is, L \ R is finite and R \ L is finite. This is an indicator of similarity different from subset; but if we require that, w.l.o.g., that R \ L be empty, then we recover a restricted version of subset. We might now ask the same question given this modified version: for languages that differ in a finite number of entries, does the subset relation tell us anything?
The answer is still no. Consider L = a* and R = a* \ A, where A is a finite non-empty subset of a*. Even still, L takes one state and R takes potentially many more.
Restricting ourselves to finite sets only, as you suggest, does let us deduce what you propose: that a minimal automaton for R will have no more states than the one for L. Why is this? We must have n+1 states to accept any string of length n, and we must have a dead state to accept strings not in the language (of which there will be infinitely many). A minimal DFA will have no loops at all (except centering on the dead state) if the language is finite, since otherwise you'd be able to get infinitely many strings.
Your observation about taking the Cartesian product is correct, in that the result of applying the construction gives a structurally identical DFA for any set operation (union, difference, intersection, etc.); however, these DFAs are not guaranteed to be minimal and the point for finite languages still holds, namely, the DFA for intersection will have no more states than the one for union, before and after DFA minimization of both machines.
You might be able to take the Myhill-Nerode theorem and define a notion of "close-relatedness" using that which does allow you to compare languages to determine which will have the larger minimal DFA. I am not sure about that, however, since an easy way of doing that would allow you to compare to parameterized reference languages to, for instance, easily prove any non-regular language is non-regular, which might be a big deal in mathematics in its own right (like, either it's impossible in general or it would prove P=NP, etc. to do so).

How many languages does a DFA recognize?

According to Sipser's "Introduction to the Theory of Computation": If A is the set of all strings that machine M accepts, we say that A is the
language of machine M and write L(M) = A. We say that M recognizes A ... A machine may accept several strings, but it always recognizes only one language. and also We say that M recognizes language A if A = {w| M accepts w}.
I guess the question has already been answered, but I would like to know if anyone has any thought about it, if there is anything interesting we can say about the subsets of a regular language, if we can say that the original DFA recognizes them and if there is any interesting relationship between the original DFA and the ones that recognize the smaller languages
If the language recognized by a DFA (of which there is always exactly one) is finite, then there are finitely many sublanguages of that language (indeed, if the language accepted consists of N strings, there are 2^N sublanguages).
There is no useful relationship which can be easily inferred from the sub/super language relationship w.r.t. where in the Chomsky hierarchy the language falls. That is: a sublanguage of a regular language may be undecidable, and a sublanguage of an undecidable language may be regular, with all possible variations in between.
Because of this, there is no particularly neat relationship to be worked out among DFAs of sub/super languages: not all of the sublanguages will even be regular; some sublanguages will have simpler DFAs than the DFA of the super language, and some will have more complicated DFAs than the DFA of the super language. Some will have the same DFA but a different set of accepting states.
Given a DFA, there is only one language corresponding to the machine. A language is a set, that is, a collection of all the strings accepted by the dfa.

If every subset of a language L is regular then L is regular? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I know that converse of above theorem is not true i.e if L is regular then every subset of L need not be regular
Not only
if every subset of a language L is regular then L is regular
but also
if every proper subset of a language L is regular, then L is finite
Proof:
This is equivalent to the statement
if a language L is infinite, then it contains a subset that is not a regular language.
The pumping lemma for regular languages states that "there exists a length l such that if a word w in the language is longer than l, then there exist three words x,y,z such that y is non-empty, xyz == w and every xy^nz is in the language".
If a language is infinite and regular, then it contains a word longer than any given length. Thus, there neccessarily exist three words x,y,z such that every xy^nz is in the language.
Now, every proper subset of {xy^nz; n in N} is a proper subset of L. Now, there definitely exist proper subsets of xy^nz that are not regular*. Thus, every regular infinite language has a proper subset that is not regular.
If a language is infinite and not regular, then consider any of its proper infinite subsets. If the subset is not regular, then the language is not a counter-example. If the subset is regular, then use the previous paragraph to find a proper subset that is not regular. Since being a proper subset is transitive, this subset is a proper subset of the original language, and the language is not a counter-example.
Thus, every infinite language has a proper subset that is not regular.
Thus, if every proper subset of a language is regular, then the language is finite (and thus regular).
QED
*For example, the set {xy^{n^2}z; n in N} is a proper subset of {xy^nz; n in N} and it is not regular, as shown by the Myhill-Nerode theorem.

Resources