The series of events that made it possible to develop hardware capable of performing computation extend a very long way back through time. As long ago as the fourth century BC, Aristotle, the ancient Greek philosopher, formalised some of the basic rules of logic.
Aristotle also introduced the concept of using variables to represent terms in statements, for example, the statement “if every dog is an animal and a labrador is a dog then a labrador is an animal” can be represented as “if every y is a z and and a x is a y then a x is a z“. Using variables like this made it possible to extend these logical statements by substituting other terms in place of the variables, this meant that it was possible to generalise logic statements that are true for many subjects.
In 1854, the mathematician George Boole sought to extend Aristotle’s laws. In his book “The Laws of Thought”, he provided equations, added to them and gave them a mathematical foundation.
Boolean Values
In Boolean algebra, every expression can either be True or False:
- The light is on.
- It is raining.
- There are some people inside the building.
Boolean logic can also be applied to mathematical expressions, for example the expression “five is less than two” evaluates to False.
Logical Operations
The basic Boolean operators are called conjunction, disjunction and negation. From this point onwards we will refer to these operators as AND, OR and NOT respectively.
AND
If A is True, B is True then A AND B is True
- The qualification will be awarded if the required marks have been reached AND the student attended all of the sessions.
- The burglar alarm will sound if the system is active AND a sensor is triggered
If either (or both) of the terms are false then the result of a Boolean AND will be false. The burglar alarm will not sound if the system is active but a sensor is not triggered.
OR
If either A OR B is True then A OR B is True.
- If it is cold OR raining then a coat should be worn.
- If the traffic light is red OR the traffic light is amber then the brakes should be applied.
If both of the terms are False then the result of a Boolean OR will be False, if either (or both) of the terms are True then the result will be True.
NOT
This will take a single value and return it’s opposite value. In other words, NOT True is False. NOT False is True.
Combining Logic
It’s possible to combine logic statements to create more complex (and useful) statements.
- If it is the weekend AND (it is raining OR it is cold) then go to the cinema.
- If it is the weekend AND it is NOT raining AND it is NOT cold then go to the park.
Truth tables
Truth tables provide a way of showing all of the possible inputs and what the outputs will be for a logic statement.
Input 1 – Weekend | Input 2 – Raining | Input 3 – Cold | Output – Go to the cinema |
---|---|---|---|
False | False | False | False |
False | False | True | False |
False | True | False | False |
False | True | True | False |
True | False | False | False |
True | False | True | True |
True | True | False | True |
True | True | True | True |
Logic and numbers
Boole had already postulated that True and False were equivalent to 1 and 0. In 1938 Claude Shannon published his thesis “A Symbolic Analysis of Relay and Switching Circuits”. In this, he proved that the logical values True and False are the same as the two states of a switch, On and Off..
This was an extremely important development as it meant that it was possible to create electronic switching devices that were capable of evaluating Boolean logic expressions. Without this it would not have been possible to create the CPUs that are inside all modern computers!