Logic Blog

Mini-Blog: Logical Notation

Rate this Entry
Logical Notation:

From next week, I will be using some semi-formal notation in my blogs, for describing the function of logic systems. It's a little confusing at first, but will save me a lot of hassle later.

This only really covers basic boolean logic, which is your ANDs and ORs etc. More complex and LBPised functions won't really fit into this but seeing as AND and OR behaviour is seen all over the place in LBP it's still pretty useful

We describe logical systems in terms of their signals - inputs, outputs and the signals linking switches together. Generally I will refer to these as single letters. So, for example a, b, etc. Sometimes, if it's for a practical application, I'll use things like g=grab.

Generally, it won't actually matter what each of the signals are doing, I'm largely using arbitrary examples.

AND Function
The and function is equivalent to multiplication, so in terms of alebra we dont actually need a symbol for it. Sometimes its a little easier to have one, so Im gonna go for a little dot (). So, for three signals (a, b, c) ANDed together would be

a AND b AND c

Using Shorthand:
a b c

a b c

OR Function
The OR function is equivalent to summation, so will use the standard + sign. So the same three signals ORed together would be:

a OR b OR c

Using Shorthand:
a + b + c

Inversion (NOT) Function
We dont really deal with NOT gates directly in LBP very often, as we can invert magnetic switches and set connectors to backwards, but we do deal with the functionality of NOT quite often. Its not the notation I prefer, but Im limited by the nature of the blog, so Im going to go for an exclamation mark before the signal. So, NOT (a) would be:


and a NAND gate ( an AND gate with the output inverted) would be described as :


i.e this would be the same as inverting the magnetic switch on the AND gate. Conversely, the following would indicate that the two signals were inverted before the AND gate:

(!a !b)

XOR Function
These are a bit funny as they dont have any counterpart in normal algebra. They also have a symbol I cant directly type in ( ). Luckily I dont use them very often. So, XOR on three signals is :

a b c

A Quick Example
Just a quick example of why this is useful. In the first blog I talked about converting ANDs to ORs and I came out with something like:

a AND b = NOT( NOT(a) OR NOT(b) )

Now I can simply say:

ab = !( !a + !b )

Which I think is nicer and easy to read. Especially so when you have multiple outputs from your system and need to describe them all.

It does take a bit of getting used to, so to begin with I'll post with a plain text description to help y'all out.


Updated 12-18-2009 at 11:47 AM by rtm223

Mini Logic Blog


  1. LittleBigDave's Avatar
    Excellent! So how do you key the XOR symbol?
  2. rtm223's Avatar
    That XOR symbol is a png file It's not part of the standard character set, but I didn't want to invent a non-standard symbol for it and I don't know a different one
  3. Incinerator22's Avatar
    I had an incorrect sticker switch consequence thingy. If one output was activated, you suffer a consequence. If both of the two outputs are activated simultaneously, it activates the correct result. Is their a name for something like that?
  4. rtm223's Avatar
    As in, you have to activate both at exactly the same time? Like two people with stickers pressing x in coordination?

    Not that I can think of... However, I can write the solution in the notation above

    c = a b

    r = a b


    a and b are the inputs
    c is the consequence
    r is the reward.
    Updated 12-13-2009 at 08:49 PM by rtm223
  5. Incinerator22's Avatar
    One sticker switch is activated by any sticker(A). The other is activated by the correct sticker(B).

    Putting in a wrong sticker only activate "A", and therfore activates the consequence.

    Putting in the correct sticker activates A and B, since more than one sticker switch can be activated with one sticker, and therfore activates the "correct" output.
  6. rtm223's Avatar
    Ohhh, well in that case don't you just want the consequence if

    a !b

    correct response if


    You can ignore A in the correct response signal as it doesn't really make any difference - if b is triggered a will always be triggered too. You only care about a if b is not triggered.
  7. Luos_83's Avatar
    I think visual images with for instance switches and the right symbols drawn into the picture might be helpfull to not scare off the people who go all WHAT!?! brainhurtingz!.

    we are living in a wysiwyg world,
    only text is hard to understand these days.

    ow, and isnt this a typo?
    So, for three signals (a, b, b) ANDed together would be

    a AND b AND c
  8. rtm223's Avatar
    Yes, I agree that diagrams can be more useful and I will be using them as well, however the shorthand is far quicker for me to write simple functions with, and you can't do maths on diagrams (google boolean algebra for extra reading) There are only 4 symbols here too, surely 4 symbols is not too much brain hurting?

    And yeah, that was a typo - I actually thought I'd fixed that... unless I did ti twice