6

The NAND gate. One gate to rule them all.

 2 years ago
source link: https://sebastiancarlos.medium.com/the-nand-gate-one-gate-to-rule-them-all-ee1a5dbc83dd
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

The NAND gate. One gate to rule them all.

Chronicles of my descent into madness.

Level 1: The human world.

A NAND gate (NOT-AND) is a logic gate which produces an output which is false only if all its inputs are true.

0*FZtC4xKCou0z2Mw7.jpg?q=20
the-nand-gate-one-gate-to-rule-them-all-ee1a5dbc83dd
It’s your boy, the NAND gate.

It doesn’t sound too useful from a practical, logical sense. After all, how often are you reasoning about something with two inputs, and you want to figure out what happens exactly when they are both not true at the same time?

Let’s say, for example, that you want to paint a chair red. For that, you need two things: a chair, and a bucket of red paint. We can summarize them as statements “C” and “R”. Let’s say that you have an algorithm CAN_PAINT which takes those statements and returns true if you can paint the chair. Such an algorithm would use an AND operation.

Now, suppose an algorithm NAND_ALGORITHM exists, which takes C and R as inputs. Can you imagine a practical, real-life purpose for such an algorithm? It would returns true only when:

  • There is no chair and no red paint.
  • There is a chair but no red paint.
  • There is red paint but no chair.

For the life of me, I can’t think of anything. I conclude that NAND is rarely a helpful operation on its own, at the human level.

Level 2: The computer world.

So, what’s the big deal about this gate? The NAND gate is significant because we can implement any Boolean function using a combination of NAND gates. This property is called “functional completeness”. It turns out this is important for manufacturing computers, at least in some theoretical sense.

But why isn’t the AND gate “functionally complete” too? It’s just the opposite of NAND, right? So I’m sure you can reverse some things here and there and make it work?

The answer is not so easy because it took until 1913 for us to known. All thanks to Henry M. Sheffer, who published this paper in the “Transactions of the American Mathematical Society”. In fact, the NAND gate is also called “Sheffer stroke” in his honor.

1*MxbqoOL5yHzQN4fAeHRL-A.png?q=20
the-nand-gate-one-gate-to-rule-them-all-ee1a5dbc83dd
Excerpt from Henry M. Sheffer’s paper. Say what?

I tried to read the paper, but I found it pretty dense on the math. Fortunately, it references the original book on Boolean algebra by the Boolean grandaddy himself, Mr. George Boole. The book is called — what a title — “An Investigation of the Laws of Thought.” It’s freely available here, and it was published in the 19th century. We are going way back, baby.

Level 3: Ireland, 1854.

Stately, plump, Mr. George Boole went down the stairs carrying his truth tables.

The book is a bit over 300 pages long. Let’s hope it’s easier to digest. If not, the author suggests I get familiar with the subsequent expert down the timeline, who happens to be no less than an archbishop! Yes, before the 19th century, your best bet to get help with your math homework was to visit a local monastery. Shit just got real.

1*sbmE4fAvjQ2cnWatwHOTCg.png?q=20
the-nand-gate-one-gate-to-rule-them-all-ee1a5dbc83dd
Excerpt from “An Investigation of the Laws of Thought”.

Can we get a picture of Archbishop Whately real quick?

0*zbe7210ST1V18KJU.jpg?q=20
the-nand-gate-one-gate-to-rule-them-all-ee1a5dbc83dd
Archbishop Whately.

I’m sure Mr. Boole’s book is very foundational, but it’s dense and lengthy. Besides, it uses an old notation. If I’m going to commit to 300 pages of math, I should instead choose a text that provides more bang for my buck. But before carrying on, I’ll leave you with this quote by Mr. Boole:

Experience sufficiently instructs us that the proper order of advancement in all inquiries after truth is to proceed from the known to the unknown. There are parts, even of the philosophy and constitution of the human mind, which have been placed fully within the reach of our investigation. To make a due acquaintance with those portions of our nature […], is the course most accordant with the limitations of our present condition.
— George Boole

Gotta love 19th-century folk. They are so clever and self-aware, they almost look like real people.

Side note: Boole was a self-taught mathematician. Now, don’t try this today. I’m sure the chances were pretty slim even back then.

Level 4: The big picture.

So, now I’m looking at the Wikipedia articles “Logic” and “History of Logic”. It seems like an excellent place to start.

Right off the bat, I found out that there are two types of logic, formal and informal.

  • Formal logic abstracts away and looks for patterns. With a bit of algebra, variables, and so on.
  • Informal logic is about particular statements.

Informal logic sounds pretty weak, but it’s useful for argumentation or rhetoric. For example, some of the fallacies you hear about (like straw man or false dilemma) belong to informal logic.

Level 5: On fallacies.

One example of fallacy is “Syntactic ambiguity”, a situation where a sentence may be interpreted in more than one way due to ambiguous sentence structure.

This happens a lot in newspaper headlines because they are written in a telegraphic style. A famous example from World War I is “French push bottles up German rear”.

And who started World War I? None other than Archduke Franz FerdiNAND. We went full circle! Case closed, ladies and gentlemen. Case closed.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK