Pigeon Hole
Pigeon Hole
Pigeonhole Principle:
Pigeonhole Principle:
A function from a finite set to a smaller set cannot be one-
to-one. There must be at least two elements in the domain
that have the same image.
Because a finite state automaton can assume only a finite
number of states and because there are infinitely many
input sequences, by the pigeonhole principle, there must
be at least one state to which the automaton returns over
and over again. This is an essential feature of the
automaton.
Consider a language that consists of 1 followed by an
arbitrary number of 0 and then a 1. Example of inputs
strings are 11,101,1001.
Now there are infinitely many such strings and only
finitely many states.
Thus, by the pigeonhole principle, there must be a state sm
and two input strings ap and aq with p≠q such that when
either ap or aq are input to A, A goes to state sm. (the
pigeons are the strings of a’s, the pigeonholes are the
states and the correspondences associate each string with
the state to which A goes when the string is input).
Example:
L= {s ∑* | s= anbn | n≥ 0}
If we attempt to find a DFA that recognizes B, we
discover that the machine needs to remember how many
a’s have been seen so far as it reads the input. So the
machine has to keep track of unlimited number of
possibilities, this cannot be done with a finite number of
states. In this case, we say that the language B is
nonregular.
We use the pigeonhole principle to show that B is not
regular. We use a proof by contradiction.
Suppose L is regular.
Then some DFA M= (Q, {a,b}, δ, q0, F) exists for it.
Now look at δ*(q0, ai) for i= 1, 2, .. Since there are an
unlimited number of i’s, but only a finite number of states
in M, the pigeonhole principle tells us that there must be
some state, q, such that:
δ*(q0, an)= q and δ*(q0, am)= q with m≠n.
But since M accepts anbn, we must have δ*(q, bn)=qf ∈F.
Proof:
If L is regular, there exists a dfa that recognizes it. Let
such a dfa have the states labeled q0, q1, …qn. Now take a
string w in L such that |w|≥ m= n+1.
Consider the set of states the automaton goes through as it
processes w, say q0, qi, qj,…qf
Since this sequence is exactly |w| +1 entries, at least one
state must be repeated and such a repetition must start
before the nth move. Thus the sequence must look like:
q0, qi, qj,…,qr,…qr,…qf
indicating there must be substrings x, y, z of w such that
δ*(q0,x) = qr
δ*( qr, y)= qr
δ*(qr,z)= qf
with |xy| ≤ n+1=m and |y| ≥ 1.
From this, it follows that:
δ*(q0,xz) = qf
δ*( q0, xy2z)= qf
δ*(q0,xy3z)= qf
This means that after p a’s have been input, at which point
A is in state sm, inputting q additional b’s sends A into an
accept state, sq.