Prerequisite: Deterministic Finite Automaton, DFA
A deterministic finite automaton (DFA)
MMM is a 5-tuple
(Q,Σ,δ,q0,F)(Q,\Sigma,\delta,q_0,F)(Q,Σ,δ,q0,F), consisting of:
-
a finite set of states QQQ
-
a finite set of input symbols called the alphabet Σ\SigmaΣ
-
a transition function δ: Q×Σ→Q\delta:\ Q\times \Sigma \rightarrow Qδ: Q×Σ→Q
-
a start state q0∈Qq_{0}\in Qq0∈Q
-
a set of accept states F⊆QF\subseteq QF⊆Q (FFF is not empty)
Let
s=c1c2⋯cns = c_1c_2\cdots c_ns=c1c2⋯cn be a string over the alphabet
Σ\SigmaΣ. The automaton
MMM accepts\textbf{accepts}accepts the string
sss if a sequence of states,
r0, r1, ⋯, rnr_0,\ r_1,\ \cdots,\ r_nr0, r1, ⋯, rn, exists in
QQQ with the following conditions:
-
r0=q0r_0 = q_0r0=q0
-
ri+1=δ(ri,ci+1)r_{i+1} = \delta(r_i, c_{i+1})ri+1=δ(ri,ci+1), for i=0, ⋯, n−1i=0,\ \cdots,\ n-1i=0, ⋯, n−1
-
rn∈Fr_{n}\in Frn∈F.
In words, the first condition says that the machine starts in the start state
q0q_0q0. The second condition says that given each character of string
sss, the machine will transition from state to state according to the transition function
δ\deltaδ. The last condition says that the machine
accepts\textbf{accepts}accepts sss if the last input of
sss causes the machine to halt in one of the accepting states. Otherwise, it is said that the automaton
rejects\textbf{rejects}rejects the string - there is two cases where
MMM rejects the string:
-
At some intermediate state rir_iri, there doesn't exists a transition of state rir_iri and character ci+1c_{i+1}ci+1, that is, (ri,ci+1)∉dom(δ)(r_i,c_{i+1})\notin dom(\delta)(ri,ci+1)∈/dom(δ).
-
The final state is not an accept state, that is, rn∉Fr_n\notin Frn∈/F.
The set of strings that
MMM accepts is called the language recognized by
MMM and this language is denoted by
L(M)L(M)L(M).
Problem\textbf{Problem}Problem
You are given a deterministic finite automaton
MMM. We say a string
s∈L(M)s\in L(M)s∈L(M) can be \textit{pumped} if the string can be divided into three parts
s=xyzs=xyzs=xyz satisfying:
-
∣y∣>0|y|>0∣y∣>0
-
for each i≥0i\ge 0i≥0, xyiz∈L(M)xy^iz\in L(M)xyiz∈L(M). Here yiy^iyi means repeating string yyy for iii times.
Please find a string in
L(M)L(M)L(M) that can be pumped or report it is impossible.