I am teaching logic gates. I would like to know if anyone knows if there are any conventions for writing combinations of logic gate functions. For example

NOR  gate => NOT (A OR B)
NAND  gate =>  NOT (A AND B)

Would it be acceptable to represent the above functions as

NOR  gate => NOT (A OR B)  as A NOR B
NAND  gate =>  NOT (A AND B) as A NAND B ?
  • 1
    $\begingroup$ Are you teaching from a specific textbook? (If so: look closely and follow that notation. It varies by book.) $\endgroup$ Dec 15 '20 at 6:43
  • $\begingroup$ Yes, our reference textbook writes the logic notation as A NOR B and A NAND B. $\endgroup$ Dec 17 '20 at 5:58
  • $\begingroup$ Then I do think you should follow that same convention. I've seen it other books, too. $\endgroup$ Dec 17 '20 at 6:01

You ask whether your proposed representation would be acceptable. Offhand, I would be cautious about infix notation for these negative operators.

In English, A NOR B would be expressed as "neither A nor B". A NAND B would be expressed as "not A and B". Often, intensifiers will also be prefixed to emphasise a NAND or NOR case and clarify the scope of the negative, such as "not both A and B", or "not any of A or B".

In both cases, the negative is introduced first in English, before the list of items, which accords more closely with the structure of the representations you are trying to replace - NOT(A OR B) etc..

Even on a technical front, I'm not familiar with a programming language that has NOR or NAND infix operators.

If you must contract these expressions or use the name of the operator, I would suggest NOR(A,B) and NAND(A,B).

Another problem is when there are more than two inputs. Unlike AND and OR, NAND and NOR are not associative, whereas "nor" in English has the same meaning and associative property as "or" (it's the introducing word "neither" which applies negation to the whole set, after they have been ORed together).

So NOT(A OR B OR C) corresponds to the English "neither A nor B nor C" (i.e. none of the set is true), but that is not the same as A NOR B NOR C (the meaning of which I can't mentally parse into English, and I'd have to sit down and write out a truth table to be sure).

Nand, of course, does not exist as an English word, but A NAND B NAND C is equally different from "not A and B and C" in English (i.e. not all of the set is true) and from NOT(A AND B AND C) formally.


I'd use pictures. These have formal standards. Then annotate the pictures with notation.enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.