← Course overview and all lessons

Lesson 7 of 23 · 3:30

Build and check a four-variable rule

Construct the paper example and verify a cell directly from its Boolean rule.

Keyboard: focus the player, then Space or K to play/pause and arrow keys to seek. Tab moves through the controls. Selectable captions replace the video's caption strip with the same timed text below.

In this lesson

  1. 0:00 · How can we store every answer to an if-then rule?
  2. 0:25 · Make the implication test explicit
  3. 0:40 · Build each condition first
  4. 0:56 · Accept the first case
  5. 1:10 · Accept the second case
  6. 1:28 · Accept the third case
  7. 1:40 · Combine the accepted cases
  8. 2:01 · Your turn: evaluate this assignment
  9. 2:29 · Check the logic first
  10. 2:40 · Check the address second
  11. 2:58 · A note on the paper’s bra notation
  12. 3:15 · Two checks are better than one

Complete transcript

This transcript includes the answers to prediction prompts.

Show transcript

How can we store every answer to an if-then rule? · 0:00

How can we store every answer to an if-then rule? Our rule says: if W and X differ, then Y must be false and Z must be true. The left condition is exclusive-or; the right is NOT Y AND Z. We will combine their matrices to construct all sixteen answers, then check one cell against the original rule.

Make the implication test explicit · 0:25

Call the two conditions P and Q for a moment. P implies Q fails only when P is one and Q is zero. If the requirement is triggered and not met, the whole rule is false. Every other pair is accepted.

Build each condition first · 0:40

After positive valuation, the first condition has the exclusive-or matrix, which we call A. The second has matrix B, with its one at Y false and Z true. These are separate two-by-two matrices for the two parts of the rule.

Accept the first case · 0:56

The first accepted case has both conditions true. The tensor A with B marks exactly those four-variable assignments. Each one indicates a place where the left condition and the right condition both return one.

Accept the second case · 1:10

The second case has the left condition false and the right condition true. Flip every bit of A, then tensor that complement with B. Complement here means entrywise Boolean NOT: every zero becomes one, and every one becomes zero.

Accept the third case · 1:28

The third accepted case has both conditions false. Tensor the complement of A with the complement of B. The three accepted cases cannot overlap, because each assignment gives only one pair of values for P and Q.

Combine the accepted cases · 1:40

Combine the three tensors entry by entry using exclusive-or. Since they do not overlap, each accepted assignment keeps one one. This produces the four-by-four matrix from the paper. Its displayed row components are W, Y, and its column components are X, Z.

Your turn: evaluate this assignment · 2:01

For W, X, Y, Z equal to zero, one, one, one, evaluate P and Q from their definitions. Then decide the implication and locate the matching row and column in the matrix. Explain why the direct rule calculation and the addressed entry agree.

Prediction pause: 10 seconds.

Check the logic first · 2:29

W and X differ, so P is one. But Y is true, so not Y and Z is zero. A true condition implies a false requirement, which fails. The expected output is zero.

Check the address second · 2:40

The row uses W and Y, giving zero, one. The column uses X and Z, giving one, one. In our descending order this selects the third physical row and the first column. Their intersection is zero, agreeing with the direct calculation.

A note on the paper’s bra notation · 2:58

The paper writes its row selector with the bra factors in reversed written order, Y then W. That notation needs its component expansion. Our explicit row labels keep W and Y visible in the physical order used by the displayed matrix.

Two checks are better than one · 3:15

You have now constructed the matrix and checked an entry without trusting the picture alone. Next we will use the repository layout convention, where zero comes first and binary input groups become ordinary numeric addresses.