0
\$\begingroup\$

Pretty much only AND makes sense. I can see how it would be more concise to represent AND as "multiplication" when you can potentially have a bunch of variables compared to having to place an && between each variable.

But then onto NOT. While in a vacuum placing a bar over a variable is just as intuitive and valid as placing an exclamation mark ahead of the variable like !A, other factors make me question why it is used. Even pre-internet, for the purposes of printing textbooks and such, would it not be easier to print !A than have to have a custom block for the printing press that contains a letter with a bar over it? And in the present day, it's so much easier to type !A than to finagle a bar over A somehow.

Finally onto OR. Oh boy. Using "+" to represent OR seems incredibly counterintuitive. Both because it's half of the compsci ++, and also just because the basic math drilled into our heads as young children goes 1 + 2 = 3, one and two make 3. It intuitively brings the idea of "and" to the mind, though not necessarily the boolean AND. The || notation from compsci seems to, even if not intuitive, at least not be unintuitive like +.

So are there some advantages to this notation that I haven't noticed? Is there a historical reason as to why this notation is used? If there are no advantages, why has the convention not borrowed elements that seem to be much superior?

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Electronics were used before the C (and BSPL) family of languages. \$\endgroup\$
    – Lior Bilia
    Commented Sep 8, 2021 at 0:11
  • 1
    \$\begingroup\$ Does this answer your question? Why is the + sign commonly used as logic OR operator? \$\endgroup\$
    – user57037
    Commented Sep 8, 2021 at 0:34
  • 1
    \$\begingroup\$ It makes perfect sense in C, where zero=false and nonzero=true. Then you have 1+anything=true (or) and 0*anything=false (and). But in any case, the choice of characters is completely arbitrary -- and we're all used to it -- so just deal with it! \$\endgroup\$
    – Dave Tweed
    Commented Sep 8, 2021 at 0:34
  • \$\begingroup\$ The C programming language is not the whole of computer science. Other languages (and traditional typesetting in mathematics) use, for example, ¬ to represent NOT, or to represent AND. \$\endgroup\$
    – The Photon
    Commented Sep 8, 2021 at 0:45

1 Answer 1

1
\$\begingroup\$

You appear to be complaining that boolean logic, which pre-existed modern programming languages, doesn't use modern programming syntax

And thank goodness that it doesn't, because boolean logic can express ideas that do not exist in modern programming languages (e.g., phase transitions). In fact, modern programming languages can express only a small percentage of boolean logic constructs and ideas.

To be honest, it's like complaining that mathematics texts still use the integral symbol $$\int x^2 \, dx = \frac{x^3}3 +C$$ rather than whatever syntax would be used to express this same idea in (e.g.) C++. (Edit my post and look at the MathJax expression... not as easy to read in my opinion, but that's just my opinion.)

And then there's the entire printing industry, which pre-exists modern programming languages by centuries. Printers have been using diacritics forever and it's not really that hard to get A̅.

So, I hope you can understand that while I can appreciate the challenge of learning programming syntax first and boolean logic second (which appears to be what you're doing), there's plenty of reasons why all that cool syntax exists.

Most of us, by the end of our careers, will have learned dozens of "languages." Symbolic, syntactic, and iconographic ways of expressing complex ideas. Let me give you an example: I speak two human languages, nine programming languages, at least six netlisting languages (for simulators), and who knows how many scripting languages for operating systems, tools and applications.... Your journey into the world of multiple ways of expressing things is just beginning. Most people simply haven't through through how many such things they've learned!

What can I say but, "embrace the chaos!"

\$\endgroup\$

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