简体   繁体   中英

Construct a DFA which accept the language L = {w | w ∈ {a,b}* and Na(w) mod 3 > Nb (w) mod 3}

I cannot solve this problem , if anyone can solve this problem.

Construct a DFA which accept the language L = {w | w ∈ {a,b}* and Na(w) mod 3 > Nb (w) mod 3}

Make a DFA with nine states named q00, q01, q02, q10, q11, q12, q20, q21 and q22. Each state qxy will correspond to a pair (x, y) = (Na(w) mod 3, Nb(w) mod 3). Then, simply make the accepting states the ones where Na(w) mod 3 > Nb(w) mod 3 is true: q10, q20 and q21. You can lay these states out in a 3-by-3 grid and have the Na(w) component move horizontally along rows and the Nb(w) component move vertically down columns. These will need wrap-around in both columns and rows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM