Let A = {<D> | D is a DFA that doesn\'t accept any string containing an odd number of 1s}. Show that A is decidable.
Solution
To show that A is decidable, we have to construct a turing machine D A that decides A. This means that for all DFAs D we have to prove
1) If D doesn\'t accept any string containing an odd number of 1s then D A (<D>) accepts.
2) If D accepts some string containing an odd number of 1s then D A (<D>) rejects.
Consider a language
Odd = { w E {0,1} * : w contains an odd number of 1s } which is regular.
This means we can let M Odd be a DFA that recognizes Odd. Using various facts from the Computability Crib Sheet we define TM D A as follows: D A = On input <D> where D is a
DFA
Let <N> <- T DFA (<D, MOdd >)
Run D dfa (<A>)
If it accepts then accept else reject
Here, we note that <D> E A iff and only if L(D) Odd = .
Our TM MA above accepts input <D> if and only if L(D) Odd = .
.