Logic Blog
Mini-Blog: Logical Notation
by
, 12-13-2009 at 05:52 PM (5124 Views)
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
Signals
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 don’t actually need a symbol for it. Sometimes it’s a little easier to have one, so I’m 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 don’t 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. It’s not the notation I prefer, but I’m limited by the nature of the blog, so I’m going to go for an exclamation mark before the signal. So, NOT (a) would be:
!a
and a NAND gate ( an AND gate with the output inverted) would be described as :
!(a•b)
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 don’t have any counterpart in normal algebra. They also have a symbol I can’t directly type in (). Luckily I don’t use them very often. So, XOR on three signals is :
ab
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.
.