I am attempting to Build a DFA that accepts over $\{0,1,2\}$ that are divided by $3$ and doesn't include the substring $012$.
What I tried doing is taking the original 3 states of a DFA that accepts everything that is divided by 3, remove all the self loops with 0 and add states, but it became so messy and incorrect...
My question is if that's even possible and if so can someone please show me how to do so?
P.S - this is not homework.
Start with the basic diagram (which avoids the 012 problem for the moment)
The nodes labeled "Sum n" are the nodes that track the sum of the sequence so far, so "Sum 0" is both the start state and the accept state. Now, if you are in any of the sum states and get a 0, you enter a two-node subgraph that looks like this:
Here $k \equiv n+2\pmod{3}$ and $l\equiv n+1\pmod{3}$.