Let $L_1$ be the language over alphabet $\{0, 1\}$ defined by $L_1 = \{x : \#_{01}(x) \mod 3 = 0\}$.
Using as few states as possible, give a DFSA that accepts $L_1$.
Also give an appropriate state invariant for your DFSA.
I have a regex for it and that is $1^*(00^*11^*00^*11^*00^*11^*)1^*$.
An example of accepted strings are: 100111010001. Example of a rejected string is 01010101, since |01010101| $= 4 \mod 3 = 1 \neq 0$.
How would I draw it? Also do I come up with state invariant first or draw the dfsa first? I drew the dfsa first right now
100111010001 - gets accepted. However 01010101 also gets accepted when it should be rejected. Not sure how to limit it to just mod 3
Edit:
I believe this works. (I cant use regexes in state invariants)
$q_0$: $x$ must contain only $1$'s
$q_1$: $x$ contains 1's before any 0's and ends with a 0
..
not sure how to write the state invariant for this case