My question is related to the problem below, basically it's a decidability problem and the algorithm prooves it's decidable.
My question :
After reading the step 2 of the algorithm below, why is it enough to only test the words up to n (number of states) in the given algorithm.
It seems to have a link with the DFA being minimal but i can't put my hand on the reason why.
I drew the automaton, since there's two states, why would we only need to test the word 01 and not 000001111 ? What is the reason behind this.
Thanks a lot for your help.
The context of the problem
Given the language $K$ = $\{<M>: M$ is a finite automaton on the alphabet {0,1}) and $L(M)$ contains at least one word of the form $0^k1^l$ with $k,l\geq 0$}. In other words, describe an algorithm with the entry $M$ ( a finite automaton) and that decide after a finite number of steps if $M$ accept at least one word of the form described above.
The algorithm for the question
Input : < M >
- Convert the given FA to a minimal DFA
- If minimal DFA contains n states, then generate all strings of language from 01 of length up to n.
3.Run the strings on a simulated DFA, if any one of the string is accepted then FA ∈ L. Stop and accept.
- Else, stop and reject.

If a finite-state automaton accepts some input, then it accepts some input without entering the same state twice. (Because you can just delete the part of the string between two entries to the same state and the FA will still accept what's left.)
Consequently, a FA which accepts some string also accepts some string whose length is at most the number of states in the FA.