You are on page 1of 38

Boolean Lecture

1
Introduction

• In the latter part of the nineteenth century, George


Boole incensed philosophers and mathematicians
alike when he suggested that logical thought could
be represented through mathematical equations.
– How dare anyone suggest that human thought could be
encapsulated and manipulated like an algebraic formula?
• Computers, as we know them today, are
implementations of Boole’s Laws of Thought.
– John Atanasoff and Claude Shannon were among the first
to see this connection.

2
Introduction

• In the middle of the twentieth century, computers


were commonly known as “thinking machines” and
“electronic brains.”
– Many people were fearful of them.
• Nowadays, we rarely ponder the relationship
between electronic digital computers and human
logic. Computers are accepted as part of our lives.
– Many people, however, are still fearful of them.

3
3.2 Boolean Algebra

• Boolean algebra is a mathematical system for


the manipulation of variables that can have
one of two values.
– In formal logic, these values are “true” and “false.”
– In digital systems, these values are “on” and “off,”
1 and 0, or “high” and “low.”
• Boolean expressions are created by
performing operations on Boolean variables.
– Common Boolean operators include AND, OR, and
NOT.

4
• Help us understand Boolean logic and logic gates
• Shows how the input of a Boolean operation relates to its output
• Input combinations are shown on the left of the truth table
• 1 column for each input variable
• Output is shown on the right of the truth table

A B OUTPUT
0 0 0 Outputs are listed on the RHS
Input names 0 1 0
1 0 0
1 1 1

In a truth table the number of rows =


(number of inputs)2
In Boolean algebra . signifies AND
1.1 means 1 and 1
alternatively
true and true
AND only returns a true value when all inputs are true
0.0 = 0
1.0 = 0
0.1 = 0
1.1 = 1
In the Boolean AND operation the sign . is used

S1 and S2 are switches in an electronic circuit


When open, S1 = 0 and S2 = 0
When closed, S1 = 1 and S2 = 1
Scenario 1
Both switches are open
S1 = 0, S2 = 0
No current flows
No signal received in the output
Scenario 2
First switch is closed, second switch is open
S1 = 1, S2 = 0
No current flows
No signal received in the output
Scenario 3
First switch is open, second switch is closed
S1 = 0, S2 = 1
No current flows
No signal received in the output
Scenario 4
First switch is closed, second switch is closed
S1 = 1, S2 = 1
Current flows
Output signal is received
In the Boolean AND operation the sign . is used
Note: 1.1 is not the same as 1+1
1.1 = 1
1+1 = 10
Let S1 = A, S2 = B

Input Output
A B Y=A.B (A and B)
0 0 0
1 0 0
0 1 0
1 1 1
AND
moths AND butterflies
In Boolean algebra + signifies OR
1+1 means 1 or 1
alternatively
true or true
OR returns a true value when at least one input is true
0+0 = 0
1+0 = 1
0+1 = 1
1+1 = 1
In the Boolean OR operation the sign + is used

S1 and S2 are switches connected in parallel in an electronic circuit


When open, S1 = 0 and S2 = 0
When closed, S1 = 1 and S2 = 1
Scenario 1
Both switches are open
S1 = 0, S2 = 0
No current flows
No signal received in the output
Scenario 2
First switch is closed, second switch is open
S1 = 1, S2 = 0
Current flows through the S1 circuit
Output signal is received
Scenario 3
First switch is open, second switch is closed
S1 = 0, S2 = 1
Current flows through the S2 circuit
Output signal is received
Scenario 4
First switch is closed, second switch is closed
S1 = 1, S2 = 1
Current flows
Output signal is received
In the Boolean OR operation the sign + is used
Let S1 = A, S2 = B

Input Output
A B Y=A+B (A or B)
0 0 0
1 0 1
0 1 1
1 1 1
OR
moths OR butterflies
In Boolean algebra an over line symbol signifies NOT
Not reverses the input signal
The output signal will be the opposite of the input

A means Not A or the opposite of A

When A = 0, A =1

When A = 1, A =0
Often called the inverter as it inverts (reverses) the incoming signal
If the incoming digital signal to the gate is 1
output from the gate will be 0
If the incoming digital signal to the gate is 0
output from the gate will be 1

In the Boolean NOT operation the sign ¬ or ~ or an overline, e.g A is used


Often called the inverter as

Input Output
A B
1 0
0 1
NOT
moths NOT butterflies
A combination of a NOT gate and an AND gate
AND gate
Output is 1 when all inputs are 1
NOT gate
Invert incoming data
NAND gate
Output of the AND gate is inverted
Output is 0 when all inputs are 1
Output is 1 for all other input combinations
In the Boolean NAND operation the signs ¬ and . are used
Input Output
A B Y= ¬A.B (Not A and B)
0 0 1
1 0 1
0 1 1
1 1 0
A combination of a NOT gate and an OR gate
OR gate
Output is 0 when all inputs are 0
NOT gate
Invert incoming data
NOR gate
Output of the OR gate is inverted
Output is 1 when all inputs are 0
Output is 0 for all other input combinations
In the Boolean NOR operation the signs ¬ and + are used
Input Output
A B Y= ¬A+B (Not A or B)
0 0 1
1 0 0
0 1 0
1 1 0
In Boolean algebra

OR returns a true value when at least one input is true


0.0 = 0
1.0 = 1
0.1 = 1
1.1 = 1

XOR returns a true value when either input is true but both differ
0.0 = 0
1.0 = 1
0.1 = 1
1.1 = 0
Exclusive OR
a logical operation that outputs true only when both inputs differ
(one is true, the other is false)
A or B but not both
It gains the name "exclusive or" because the meaning of "or" is
ambiguous when both operands are true
the exclusive or operator excludes that case.
This is sometimes thought of as "one or the other but not both".
This could be written as "A or B but not A and B".
Exclusive OR
A modified version of the OR gate
Represented by the ⊕ symbol
2 inputs, 1 output
OR gate
Output is 1 for the following inputs
01
10
11
XOR gate
Output is 1 for the following inputs
01
10
A

Input Output
A B Y= ¬A+B (Not A or B)
0 0 0
1 0 1
0 1 1
1 1 0
AND

OR

NOT

NAND
NOR

XOR
+ OR

. AND
Classroom Example
Represent the diagram displayed below, using a truth table

AND gates
NOT gates
OR gates
AND gates
NOT gates
OR gates

Building a Truth Table A B


Step 1 0 0
Number of rows = (number of inputs)2 0 1
2 inputs (A and B)
1 0
Number of rows = 22
=4 1 1
NOT gates

Building a Truth Table A B A B


Step 2 0 0 1 1
Determine output from NOT gates 0 1 0
1
NOT reverses the signal
1 0 0 1
Symbols used are
A B 1 1 0 0
AND gates

Building a Truth Table


Step 3
Determine output from AND gates
Symbol for AND is . E.g. A.B
Value of 1 returned only when both
inputs are 1

A B A B A .B A. B
0 0 1 1 0 0
0 1 1 0 1 0
1 0 0 1 0 1
1 1 0 0 0 0
AND gates

Building a Truth Table


Step 4
Determine output from OR gate
Symbol for OR is +, e.g. A + B
Value of 1 returned only when either or
both inputs are 1

A B A B A .B A. B A .B + A. B
0 0 1 1 0 0 0
0 1 1 0 1 0 1
1 0 0 1 0 1 1
1 1 0 0 0 0 0
(A ∪ B)’ = A’ ∩ B’
(A ∩ B)’ = A’ ∪ B’

These laws are true for any sets A and B

In binary
The complement of 1 is 0
The complement of 0 is 1
If A = 0
Then A’ = 1

(A + B)’ = A’.B’
A’ + B’ = (A.B)’
(A.B)’ = A’ + B’
Binary AND Binary OR
0.0 = 0 0+0 = 0
1.0 = 0 1+0 = 1
0.1 = 0 0+1 = 1
1.1 = 1 1+1 = 1

A B A.B (A.B)’ A’ B’ A’ + B’
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0
A’.B’ = (A + B)’
Binary AND Binary OR
0.0 = 0 0+0 = 0
1.0 = 0 1+0 = 1
0.1 = 0 0+1 = 1
1.1 = 1 1+1 = 1

A B A’ B’ A’.B’ A+B (A + B)’


0 0 1 1 1 0 1
0 1 1 0 0 1 0
1 0 0 1 0 1 0
1 1 0 0 0 1 0

carry 1 to the next significant bit

You might also like