Skip to content

Demo 4.4: Fewer Gates, Same Answer

The previous demonstration gave you the rules and asked you to test them. Every one turned out to be a claim that two circuits behave identically, and you checked each claim against a truth table until you believed it.

This demonstration puts those rules to work. You are handed a circuit that someone else designed, you write down what it does, and you rewrite that expression until it describes something cheaper to build. The rules are the same rules. What is new is that nobody tells you which one to reach for.

That is the actual skill. Knowing that A + A · B = A is worth very little on its own. Recognising that the thing in front of you has that shape, when it is buried in the middle of a four-term sum and the letters are not A and B, is worth a lot.

Pick an example along the top. The circuit as it arrived is drawn on the left and never changes. The circuit as it stands now is drawn on the right, and it redraws whenever the shape of the circuit changes rather than on every line of algebra.

Underneath, the expression is waiting for you. Choose a rule from the palette. If it is the next step, the working grows a line and the expression is rewritten. If it is not, you are told what that rule needs so you can go and look for it.

There is a hint button with two levels. The first tells you where in the expression to look, the second names the rule and still leaves you to apply it. Use it after you have had a proper go, not before.

The gate and input counts under each schematic are the real counts for the expression as it stands, and the truth table at the bottom compares where you started against where you are now on every row. Keep half an eye on both.

Simplifying a Circuit

You choose the rule at every step. The circuit is redrawn from whatever the expression has become.

Example

Prove the absorption rule. Three steps, two gates, and a rule you will use in every derivation after this one. Nothing here is new, it is the identity and null rules doing the work.

As it arrived2 gates|4 inputs

A + A·B

AB0A·B = 0
As it stands2 gates|4 inputs

A + A·B

AB0A·B = 0
  • Cyan carries a value you are holding, emerald a value a gate has produced, and amber a constant, which on a board would be a wire to ground or to the supply.
  • A dot marks a join; wires that cross without one are not connected.
InputsBoth circuits are driven from the same switches. They have agreed on every setting so far, and they will keep agreeing.
Working
0 of 3 steps
A + A·Bthe circuit, written down

What is the next step on A + A·B?

More than one rule may be legal here. This route is the short one, so a legal move that leads nowhere is still counted as wrong.

ABstartednow
0000
0100
1011
1111
The expression you started with and the one you have now agree on all 4 rows.
  • That column pair is the safety net.
  • Simplification is only worth anything if the simplified circuit still does the job, and every legal rule leaves this table untouched.
  • If you ever simplify by hand and the table moves, you have used a rule that does not exist.
Cost as it stands

Still 2 gates and 4 inputs. Nothing has been saved yet.

Click any row of the table to send that combination to both circuits.

Five steps. Do them in order, because each example uses something the one before it proved.

Step 1: Prove a rule you are about to rely on

Section titled “Step 1: Prove a rule you are about to rely on”

Select Warm up. The expression is A + A · B, two gates, and the claim is that all of it reduces to a single wire carrying A.

The first step is the one that catches people. Factoring A out of A + A · B leaves A · (1 + B), and students want to know where the 1 came from. It came from the first term: A on its own is the same as A · 1, so when A is lifted outside the bracket the first term has to leave a 1 behind. After that the null rule flattens the bracket to 1 and the identity rule deletes the AND gate.

Two gates became none. Look at the right-hand schematic when you finish: there is no gate left, just the A bus running across to the output terminal. That is what “the second term never decides anything” looks like when you draw it.

Step 2: Reduce a real circuit, and let it get worse first

Section titled “Step 2: Reduce a real circuit, and let it get worse first”

Select Circuit reduction. Five gates arrive, and reading them off gives A · B + B · C · (B + C).

The only move available is to distribute, and the moment you do the gate count goes from five to seven. Both schematics are on screen and the right one is visibly the messier of the two. Stop there for a second, because this is the step that stops people simplifying by hand: it looks like you have made things worse, and you have, and it is still the right move.

What distributing bought you is visibility. B · B · C and B · C · C have repeated signals in them that were hidden inside the brackets, and once the idempotent rules collapse those repeats you are left with the same term twice in one sum. From there it falls apart quickly.

Five gates and ten inputs down to two gates and four inputs, with an identical output on all eight rows. That reduction is worth roughly half the propagation delay and half the board area, and on a production run of ten thousand boards it is worth real money.

Select Absorption in use. The starting expression is wider, A + B · (A + C) + A · C, and the finish is different: this one does not end in a factoring step, it ends by throwing terms away.

Distribute first, as before, to flatten everything into a plain sum of products. Now look for the shape you proved in Step 1. One term of the sum is A all by itself, and another term has A as a factor. That second term is dead weight, and absorption removes it. Then look again, because the situation repeats.

The rule generalises further than it first appears. A + A · B + A · C + A · D and so on all collapse to A, however many terms there are, because as soon as A is a term in its own right nothing else containing A can change the answer.

Select A step backwards. The expression is A + NOT A · B, three gates, and there is nothing in it that can be made smaller. Every rule that shrinks an expression needs a repeat, a constant or a shared factor, and none of those is present.

So grow it instead. A = A + A · B is the absorption rule read from right to left, which makes it just as legal as any other step, and it puts an A · B term next to the NOT A · B term. Now the two of them share a B, factoring gives B · (A + NOT A), the bracket collapses to 1 by the complement rule, and the identity rule finishes it.

Three gates become one, and the inverter that started the whole thing has vanished. Watch the cost readout while you do it: five gates at the worst point, one at the end.

This is the example students find hardest and it is only four steps long. The difficulty is not in the algebra, it is in being willing to make a move that looks like it is going the wrong way.

Whichever example you are on, the table at the bottom has two output columns: the expression you started with, and the expression as it stands right now. They have agreed on every row, at every step, all the way through.

That is not a coincidence and it is not decoration. Every rule in the palette is a statement that two things are equal, so applying one cannot change what the circuit does. The moment those two columns disagree, a rule has been misapplied.

Get in the habit of it. When you simplify by hand and you are not certain of a step, build the table for the expression before the step and after it. If they differ, the step is wrong, and you have found the error immediately instead of three lines later.

Quiz
Select 0/1

While reducing A · B + B · C · (B + C), the first step takes the circuit from five gates to seven. Why is that the correct move?

Quiz
Select 0/3

Which of these expressions can be reduced by the absorption rule, A + A · B = A? Select all that apply.

Check the reduction for yourself

Column 1 is A · B + B · C · (B + C), the five-gate circuit. Column 2 is B · (A + C), the two-gate circuit. Fill both and compare them row by row.

Concept Match

Match each rule to the job it does in a derivation

Quiz
Select 0/1

A + NOT A · B cannot be reduced by any rule that makes it smaller. What makes the derivation possible?

Quiz
Select 0/1

You reduce a circuit by hand and want to be sure you have not broken it. What is the most reliable check?

Simplification is a procedure with one difficult step in the middle. Write the circuit down, rewrite the expression, build the result. The first and third are mechanical. The second is where the judgement lives.

Three things to carry forward.

  1. Fewer gates is not a matter of taste. It buys propagation delay, power, board area, cost and reliability all at once, which is why it is worth the effort every time.
  2. A derivation is allowed to get worse before it gets better. Distributing and un-simplifying both cost gates in the short term and both open up reductions that were not otherwise available. If every step has to be an improvement, most expressions cannot be reduced at all.
  3. The truth table settles arguments. Every rule is an equality, so a valid derivation leaves the table untouched from start to finish. When you are unsure, build it.

There is one obvious gap left. Every rule you have used so far works on expressions built from AND, OR and single-signal inversions, and none of them can do anything with a bar drawn over a whole group of terms. That is a serious limitation, because inverted-output gates are the ones you actually get in a package, and their expressions are full of exactly those long bars.

The next demonstration deals with it. De Morgan’s theorems say what happens when a group complement is broken, and once you can move inversions around freely, a circuit drawn in AND, OR and NOT can be converted into one built entirely from NAND gates or entirely from NOR gates. That is the point at which the algebra starts describing the parts that are really on the bench.