A general theme of science that manifests itself in many different ways is the concept of abstraction. What this means is that one can understand something at a higher level without having to understand a buried lower level. For instance, one can understand the theory of evolution based on natural selection (higher level) without having to first comprehend quantum mechanics (lower level), even though the higher level must be consistent with the lower one.
To my mind, this idea is most aptly demonstrated with transistors, circuits and logic. Let’s start at the level of transistors and build a NAND gate in the following way:
The NAND gate has the following truth table:
If you can’t immediately see why the transistor circuit above yields the corresponding truth table, it helps to appeal to the “water analogy”, where one imagines the current flow as water. Imagine that water is flowing from Vcc. If A and B are high, the “dams” (transistors) are open, the current will flow to ground and X will be low. If either A or B is low (closed), the water will flow to X, and X will be high.
Why did I choose the NAND circuit instead of other logic gates? It turns out that all other logic gates can be built from the NAND alone, so it makes sense to choose it as a fundamental unit.
Let’s now abstract away the circuit and draw the NAND gate like so:
Having abstracted away the transistor circuit, we can now play with this NAND gate and build other logic gates out of it. For instance, let’s think about how to build an OR gate. Well, an OR gate is just a NOT gate applied to the two inputs of a NAND gate. Therefore, we just need to build a NOT gate. One way to do this would be:
Notice that whenever A is high, X is low and vice versa. Let us now abstract this circuit away and draw the NOT gate as:
And now the OR gate can be made in the following way:
and abstracted away to look like:
Now, although building an OR gate from NAND gates is totally unnecessary, and it actually would just be easier to do this by working with the transistors directly, one can already start to see the power of abstracting away the underlying circuit. We can just work at higher levels, build the component we want and put the transistors back in at the end. Our understanding of what is going on is not compromised in any way and is in fact probably enhanced since we don’t have to think about the water analogy any more!
Let’s work now with an example that actually is much easier at the level of NANDs and NOTs to really demonstrate the power of this technique. Let’s make what is called a multiplexer. A multiplexer is a three input-one output circuit with the following truth table:
Notice that in this truth table, the X serves as a selector. When X is 0, it selects B as the output (Y), whereas when X is 1, it selects A as the output. The multiplexer can be built in the following way:
and is usually abstracted in the following way:
At this level, it is no longer a simple task to come up with a transistor circuit that will operate as a multiplexer, but it is relatively straightforward at the level of NANDs and NOTs. Now, armed with the multiplexer, NAND, NOT and OR gates, we can build even more complex circuit components. In fact, doing this, one will eventually arrive at the hardware for a basic computer. Therefore, next time you’re looking at complex circuitry, know that the builders used abstraction to think about the meaning of the circuit and then put all the transistors back in later.
I’ll stop building circuits here; I think the idea I’m trying to communicate is becoming increasingly clear. We can work at a certain level, abstract it away and then work at a higher level. This is an important concept in every field of science. Abstraction occurs in every realm. This is even true in particle physics. In condensed matter physics, we use this concept everyday to think about what happens in materials, abstracting away complex electron-electron interactions into a quasi-particle using Fermi liquid theory or abstracting away the interactions between the underlying electrons in a superconductor to understand vortex lattices (pdf!).