Re: DFA recognizing the language {w | top(w) mod 3 = bottom(w) mod 3}
- From: Barb Knox <see@xxxxxxxxx>
- Date: Tue, 23 Jan 2007 16:54:29 +1300
In article <12ratat6dstkc03@xxxxxxxxxxxxxxxxxx>,
"meyousikmann" <meyousikmann@xxxxxxxxx> wrote:
I am stumped on constructing this DFA. Can anyone offer any pointers?
For the alphabet:
| 0 | | 0 | | 1 | | 1 |
| 0 | | 1 | | 0 | | 1 |
where the strings over this alphabet represent a "top row" and a "bottom
row" and each row represents a number in binary starting with the least
significant bit.
Design a DFA to recognize the language {w | top(w) mod 3 = bottom(w) mod 3}.
This can be solved with 18 = 3 x 3 x 2 states or 6 = 3 x 2 states but I
can't seem to figure it out.
Any help?
Hint:
In base ten the remainder of a number mod 11 is ((sum of even-power
digits) - (sum of odd-power digits)) mod 11. E.g 123 mod 11 = ((1+3) -
(2)) mod 11 = 2 mod 11 = 2.
Similarly, in base 2 the remainder of a number mod 11_2 is ((sum of
even-power digits) - (sum of odd-power digits)) mod 11_2.
So, 0/0 and 1/1 don't affect the mod-3 difference of top - bottom in any
bit position, 1/0 adds 1 to the difference (mod 3) if it's in an even
bit position and subtracts 1 in an odd bit position, and 0/1 does the
reverse.
So at minimum you need to simultaneously keep track of whether it's
currently an even or odd bit position (2 possibilities), and the current
mod-3 difference (3 possibilities), which requires 2*3 states.
(And I expect that the alluded-to 2*3*3-state solution keeps track of
the top mod 3 and bottom mod 3 separately, with the accepting states
being those where the two are equal.)
--
---------------------------
| BBB b \ Barbara at LivingHistory stop co stop uk
| B B aa rrr b |
| BBB a a r bbb | Quidquid latine dictum sit,
| B B a a r b b | altum viditur.
| BBB aa a r bbb |
-----------------------------
.
- Follow-Ups:
- Re: DFA recognizing the language {w | top(w) mod 3 = bottom(w) mod 3}
- From: meyousikmann
- Re: DFA recognizing the language {w | top(w) mod 3 = bottom(w) mod 3}
- References:
- DFA recognizing the language {w | top(w) mod 3 = bottom(w) mod 3}
- From: meyousikmann
- DFA recognizing the language {w | top(w) mod 3 = bottom(w) mod 3}
- Prev by Date: DFA recognizing the language {w | top(w) mod 3 = bottom(w) mod 3}
- Next by Date: Re: The Perfect Machine
- Previous by thread: DFA recognizing the language {w | top(w) mod 3 = bottom(w) mod 3}
- Next by thread: Re: DFA recognizing the language {w | top(w) mod 3 = bottom(w) mod 3}
- Index(es):
Relevant Pages
|