Search HoldMyTwist

Browse all posts

Episode 29

Three Copies of a Quack

Duck wants to transmit 0/1 values. But there is a chance that a lamp might flip the value to the opposite one. If Duck transmits three of each, the receiver can use majority voting, assuming at most one value per group will change.

Episodes

Computing Basics

    Duck has a card with one bit of source. There are three empty seats. Robot presents a channel which can flip one bit.
    Robot sends three gold lamps - labelled one.
    Duck makes an additional row for the three zeros for a zero source bit. Robot maintains a difference between the two valid codewords.
    Robot compares with ones sent (against a group received with middle copy zero). Duck waits before making the choice of the decoded bit.
    Duck sees two ones and a zero in the group one-zero-one. Robot takes the majority (one).
    Robot compares one of the decodings with the original source bit one. Duck points at the single changed copy.
    Duck has three sets of other cases: 011, 101, 110. For each set, you get 2 fixed ones. All sets decode to 1.
    Duck identifies majority of 2 zeros in a group.
    Robot keeps decoded result secret until after the prediction.
    Duck sets first and second as 0. Third is unchanged. Sent group: 1-1-1 Recv group: 0-0-1
    Duck picks zero. Robot checks the zero he got with the original one.
    Robot brackets off 3 bit set. Duck splits the one flip correct from the two flip wrong.
    Duck shows zero-one-zero and one-zero-one (distinct groups).
    Robot counts individual triples. In both message slots, duck puts 0 from first majority and 1 from second.
    Duck indicates 1 flip position in each triple. Robot indicates 2 flips over entire message versus 1 flip in each group.
    Two message bits for six passed-on bit lamps. Robot indicates the distinct groups of three copies. RECEIVED: 010 | 101; DECODED: 0 | 1; 2 MESSAGE BITS; 6 TRANSMITTED BITS.

    Episode transcript

    A bit gets three seats

    Duck has a card with one bit of source. There are three empty seats. Robot presents a channel which can flip one bit.

    Diagram values: MESSAGE 1

    Duck: I want my one bit message to survive one lamp change.

    Robot sends three gold lamps - labelled one.

    Diagram values: BIT: 0 / 1; AQUA: 0; GOLD: 1; 1 → 111

    Robot: Code for 1 is 111.

    Duck makes an additional row for the three zeros for a zero source bit. Robot maintains a difference between the two valid codewords.

    Diagram values: 0 → 000

    Duck: Code for 0 is 000.

    Robot compares with ones sent (against a group received with middle copy zero). Duck waits before making the choice of the decoded bit.

    Diagram values: 111 → 101

    Robot: So if we say that, one of our sent ones goes to zero. What does the receiver do?

    Let the copies vote

    Duck sees two ones and a zero in the group one-zero-one. Robot takes the majority (one).

    Diagram values: 101; ONES 2; ZEROS 1; DECODE 1

    Duck: Two ones out-vote a zero. Decode one.

    Robot compares one of the decodings with the original source bit one. Duck points at the single changed copy.

    Diagram values: SENT 1; DECODED 1

    Robot: One copy flipped in the arriving triple. The receiver still gets the original single bit.

    Duck has three sets of other cases: 011, 101, 110. For each set, you get 2 fixed ones. All sets decode to 1.

    Diagram values: 011 → 1; 101 → 1; 110 → 1

    Duck: It could be the other seat, too.

    Duck identifies majority of 2 zeros in a group.

    Diagram values: 001 → 0; 010 → 0; 100 → 0

    Robot: If 1 bit is flipped in the 3 bits you have 2 copies unchanged, so you can recover your original bit.

    Two changes win wrongly

    Robot keeps decoded result secret until after the prediction.

    Diagram values: START 111; FLIP FIRST TWO

    Duck: What if 2 of them change?

    Duck sets first and second as 0. Third is unchanged. Sent group: 1-1-1 Recv group: 0-0-1

    Diagram values: SENT 111; RECEIVED 001

    Robot: Two flips convert 1 1 1 to 0 0 1.

    Duck picks zero. Robot checks the zero he got with the original one.

    Diagram values: 001 → 0; SOURCE 1; WRONG

    Duck: Vote is 0. Message not good.

    Robot brackets off 3 bit set. Duck splits the one flip correct from the two flip wrong.

    Diagram values: SENT 111; 1 FLIP: 011 → 1; 2 FLIPS: 001 → 0 WRONG; AT MOST 1 FLIP / TRIPLE

    Robot: You can correct a single flip in a triple. Two flips can cause this decoder to get it wrong.

    Decode a new message

    Duck shows zero-one-zero and one-zero-one (distinct groups).

    Diagram values: 010 | 101

    Duck: The triples received are 0-1-0 and 1-0-1. Which message do you get back after majority decoding?

    Robot counts individual triples. In both message slots, duck puts 0 from first majority and 1 from second.

    Diagram values: 010 → 0; 101 → 1; MESSAGE 01

    Robot: Majority decode each set of 3 bits.

    Duck indicates 1 flip position in each triple. Robot indicates 2 flips over entire message versus 1 flip in each group.

    Diagram values: 1 FLIP IN EACH TRIPLE

    Duck: There are 2 flips on the message, but only 1 flip per triple.

    Two message bits for six passed-on bit lamps. Robot indicates the distinct groups of three copies. RECEIVED: 010 | 101; DECODED: 0 | 1; 2 MESSAGE BITS; 6 TRANSMITTED BITS.

    Diagram values: RECEIVED: 010 | 101; DECODED: 0 | 1; 2 MESSAGE BITS; 6 TRANSMITTED BITS

    Robot: Three bits are sent for each bit in your source.

    The lesson

    3-fold binary repeat. Code for 0 is 000. Code for 1 is 111. Majority decode each set of 3 bits. If 1 bit is flipped in the 3 bits you have 2 copies unchanged, so you can recover your original bit. If 2 bits are flipped in the 3 you may get the wrong majority decode. For example, if it was 3 1's and it flips to 001, you decode to 0. Note the limit of 1 bit flip is per set of 3. So you can flip 2 total bits if it's across two different sets of 3. Three bits are sent for each bit in your source.

    Try it

    Diagram values: SOURCE MESSAGE 10; SENT 111 | 000; RECEIVED 001 | 010

    What does the receiver do?

    Answer

    Diagram values: 111 → 001: 2 CHANGED POSITIONS; 000 → 010: 1 CHANGED POSITION; MAJORITY 001 → 0; 010 → 0

    The first bit is wrong.

    Sources

    MIT 6.02 chapter5: replication codes and majority decoding (opens in a new tab)