Introduction to Boolean Logic |

Written by Harry Fairhead | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Friday, 28 September 2018 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Page 1 of 4 It may sound like a daunting topic, but Boolean logic is very easy to explain and to understand. It represents the simplest of all the logics and the very basis of computing.
First Draft |

P |
Q |
P AND Q |

F | F | F |

F | T | F |

T | F | F |

T | T | T |

P |
Q |
P OR Q |

F | F | F |

F | T | T |

T | F | T |

T | T | T |

P |
NOT P |

F | T |

T | F |

Notice that while the Boolean And is the same as the English use of the term, the Boolean Or is a little different.

When you are asked would you like "coffee OR tea" you are not expected to say yes to both!

In the Boolean case however “Or” most certainly includes both. When P is true and Q is true the combined expression (P Or Q) is also true.

There is a Boolean operator that corresponds to the English use of the term “or” and it is called the “Exclusive or” written as EOR or XOR. Its truth table is:

P |
Q |
P XOR Q |

F | F | F |

F | T | T |

T | F | T |

T | T | F |

and this one really would stop you having both the tea and the coffee at the same time (notice the last line is True XOR True = False).

## Practical truth tables

All this seems very easy but what value has it?

It most certainly isn’t a model for everyday reasoning except at the most trivial “coffee or tea” level.

We do use Boolean logic in our thinking, well politicians probably don’t but that’s another story, but only at the most trivially obvious level.

However, if you start to design machines that have to respond to the outside world in even a reasonably complex way then you quickly discover that Boolean logic is a great help.

For example, suppose you want to build a security system which only works at night and responds to a door being opened. If you have a light sensor you can treat this as giving off a signal that indicates the truth of the statement:

P = It is daytime.

Clearly Not(P) is true when it is night-time and we have our first practical use for Boolean logic!

What we really want is something that works out the truth of the statement:

R= Burglary in progress

from P and

Q = Window open

A little raw thought soon gives the solution that

R = Not(P) And Q

That is the truth of “Burglary in progress” is given by the following truth table:

P |
Q |
NOT(P) |
NOT(P)AND Q |

F | F | T | F |

F | T | T | T |

T | F | F | F |

T | T | F | F |

From this you should be able to see that the alarm only goes off when it is night-time and a window opens.

<ASIN:1782050043>

<ASIN:1603861254>

<ASIN:1855065835>

<ASIN:0780334264>

<ASIN:0486427854>

<ASIN:1593271042>

<ASIN:0486483851>