Boolean Algebra and De Morgan`s Theorem

advertisement
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Boolean Algebra & De Morgan's Theorems
Topics covered in this presentation:
 Boolean Operations
 Simplification of Boolean Expressions
 De Morgan's Theorems
1 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Boolean Algebra
Boolean Algebra is a form of mathematics that can be used
to help simplify a logic system.
The inputs and outputs are variables and are represented by
capital letters. For example, A and B may be used to represent
inputs and Q to represent the output.
In a digital system, each variable can have one of two states, either
logic 1 or logic 0.
As with ordinary algebra, the value of a variable can be defined.
For example, A=1 would mean that variable A was at logic 1.
All the basic logic functions can be represented in Boolean
algebra, and a number of these can be grouped together to show
the relationship between the inputs and the output.
2 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Boolean Operations - AND
The AND logic function will output a logic 1 when all inputs
are at logic 1.
In Boolean algebra, the AND function is indicated by a dot
between the variables being ANDed together.
A 2-input AND gate will be
expressed as: Q = A.B
Note that it does not matter in which order variables
are ANDed together, A.B = B.A
3 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Boolean Operations - AND
The following are a set of rules for the
AND logic function. All of these can be
determined by examining the truth table
for the AND function.
A.1 = A If input A is ANDed with a logic 1 input, the output
will always be equal to the value on input A.
A.0 = 0 If input A is ANDed with a logic 0 input, the
output will always be equal to 0.
A.A = A If two identical inputs are ANDed together, the
output will always be equal to the input value.
A.A = 0 If an input is ANDed with an inverted version of
itself, the output will always be equal to 0.
4 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Boolean Operations - OR
The OR logic function will output a logic 1 when at least one
input is at logic 1.
In Boolean algebra, the OR function is indicated by a plus
sign between the variables being ORed together.
A 2-input OR gate will be
expressed as: Q = A+B
Note that it does not matter in which order variables
are ORed together. A+B = B+A
5 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Boolean Operations - OR
The following are a set of rules for the
OR logic function. All of these can be
determined by examining the truth table
for the OR function.
A+1 = 1 If input A is ORed with a logic 1 input, the
output will always be equal to 1.
A+0 = A If input A is ORed with a logic 0 input, the output
will always be equal to the value on input A.
A+A = A If two identical inputs are ORed together, the output
will always be equal to the input value.
A.A = 1 If an input is ORed with an inverted version of
itself, the output will always be equal to 1.
6 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Boolean Operations - NOT (Inversion)
The NOT logic function has the effect of inverting the input
and is therefore known as an inverter.
In Boolean algebra, the function of inversion is indicated
by a bar above the variable.
In the case of the inverter, Q = A.
A double bar above a variable indicates that the variable is
inverted twice, therefore returning the variable to the original
input value, A = A.
7 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Inversion of AND and OR
The function of inversion can be applied to operations as well as
single variables. A bar above an AND or OR operation, indicates
that the output is inverted.
When an AND operation is
inverted it becomes NAND:
Q = A.B
When an OR operation is
inverted it becomes NOR:
Q = A+B
8 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Combinations of Logic Functions
When more than one logic function is used, the order in which the
logic functions are to be performed must be defined.
As with ordinary algebra, Boolean equations can include brackets
to define the order in which the operations are performed.
The logic circuit opposite
contains an OR and AND logic
function connected together.
This could be written as Q = A+B.C, but this doesn't indicate the
order that the AND and the OR operation should be performed.
Inputs A and B are first ORed together, and the output of the OR
function is then ANDed with input C.
The Boolean equation for this circuit is therefore: Q = (A+B).C
9 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Simplifying Circuits with Boolean Algebra
One of the reasons for using Boolean algebra is that it can be
used to simplify a logic circuit by removing redundant terms to
produce a circuit that requires fewer logic functions.
When manipulating a Boolean expression the AND logic
function can be treated in the same way as the mathematical
operation of multiplication. The OR logic function can be treated
in the same way as the mathematical operation of addition
Sometimes it is necessary to expand equations in order to
simplify them further.
10 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Manipulation with Boolean Algebra
In the same way as it is possible to take out a common
multiplication factor in ordinary mathematics, the same can
be carried out in Boolean algebra.
In the example here, A is a common factor that can be taken out.
A.B + A.C = A.(B + C)
It is also possible to expand functions, such as the example below, using
standard mathematical rules:
A.(A + B) = A.A + A.B
Note that since A.A = 0, this equation can be further simplified to get:
A.A + A.B = 0 + A.B = A.B
11 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Manipulation with Boolean Algebra
Electronics - Digital Electronics
Two logic identities used in simplification involve multiple variables:
A + (A.B) = A
A.(A + B) = A
Both of these identities can be proven using Boolean algebra and
the basic single-variable identities that have already been covered:
A+(A.B) = (A.1) + (A.B)
since A = A.1
= A. (1 + B)
since A is a common factor
=A
since (1 + B) = 1
A.(A + B) = (A.A) + (A.B)
expand terms
= A + (A.B)
since A.A = A
=A
since A + (A.B) = A
12 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
Manipulation with Boolean Algebra
Example
Use Boolean algebra to simplify
the logic circuit opposite.
By inspecting the circuit it can be
found that its logic function is:
Q = A.(A +B).(A + B)
Since A.(A + B) = A this can be simplified to: Q = A.(A + B)
The terms can then be expanded to give: Q = (A.A) + (A.B)
Since A.A = 0 this can be simplified to: Q = 0 + (A.B) = A.B
The simplified version of the
above circuit is therefore:
13 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
De Morgan’s Theorems
De Morgan's Theorems are used to help simplify a Boolean expression
and can be used to eliminate ‘long bars’ that cover several variables.
De Morgan's first theorem can be stated as:
A+B=A.B
De Morgan's second theorem can be stated as:
A.B=A+B
These theorems can be remembered by the phrase
'break the bar, and change the sign'.
14 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
De Morgan’s Theorem
One use for De Morgan’s Theorems is to simplify Boolean equations
that contain inversion bars across several variables, so that only single
variable inversions remain.
Example
Simplify the Boolean equation so that only single variables remain.
Q = (A + B + C) . (A + B + C)
Break the long bar, and change the sign linking the two parts.
Q = (A + B + C) + (A + B + C)
Break the bars and change the signs between the variables.
Q = (A . B . C) + (A . B . C)
Finally, since A = A, any double bars can be removed.
Q = (A . B . C) + (A . B . C)
15 of 16
5. Boolean Algebra and De Morgan's Theorems
Theory Support
Electronics - Digital Electronics
De Morgan’s Theorem
The other use for De Morgan’s theorem is to convert an expression so
that it only contains a single type of logic function.
Example
Simplify the Boolean equation to use only NAND gates.
Q = (A + B + C) . (A + B + C)
Add a double bar above each half of the equation. This has no effect
on the meaning of the equation but will help us to simplify it.
Q = (A + B + C) . (A + B + C)
Break a bar and change the sign between the variables.
Q = (A . B . C) . (A . B . C)
Finally, since A = A, any double bars can be removed.
Q = (A . B . C) . (A . B . C)
16 of 16
Download