Logic Gates and Properties

advertisement
Logic Gates and Properties
We will be using logical operations to build machines that can do arithmetic calculations.
It’s useful to think of these operations as basic components that can be hooked together
into complex networks. To help visualize these networks, we’ll use diagrams to
represent each operation.
For the logical operation AND, we’ll use the following diagram, called an AND gate:
a
ab
b
For the logical operation OR, we use an OR gate:
a
a+b
b
Finally, for the logical operation NOT, we use a NOT gate:
a
a
Now we can diagram complicated logical expressions as logic networks.
For example, the logical expression ab + c can be diagrammed like so:
a
b
c
ab
+c
This logic network indicates that we take a AND b, then NOT the result and combine
with c using an OR.
Here are some more examples…
Logical expression
ab
Logic network
a
b
a
b
c
d
ab + cd
a
ab
b
To build a complicated logic network we hook the outputs of some logic gates to the
inputs of other logic gates.
We can extend this diagrammatic notation by allowing more inputs for AND and OR:
Words
a AND b AND c
AND d AND e
a OR b OR c
OR d OR e
Symbols
Diagram
abcde
a
b
c
d
e
a+b+c+d+e
a
b
c
d
e
We can now examine some basic properties of logical operations and how these
properties appear when diagrammed.
First, recall the table of combinations for AND:
AND
0
1
0
0
0
1
0
1
From this table we see that 0 AND 1 gives the same truth value as 1 AND 0, so the
order in which we write the pieces of the combination doesn’t matter. That is, for
statements a and b the truth value of a AND b will be the same as the truth value for
b AND a. In symbols, this is
Law of Commutativity for AND:
ab = ba
Similarly, the table of combinations for OR:
OR
0
1
0
0
1
1
1
1
Indicates that 0 OR 1 has the same truth value as 1 OR 0, so generally for statements a
and b we have the
Law of Commutativity for OR:
.
a+b=b+a
For logic gates, these Laws of Commutativity say that it doesn’t matter what order we use
to draw the inputs into the AND and OR gates:
a
b
a
b
=
=
b
a
b
a
These properties are similar to what we have seen for numbers. For numbers, we also
had a Law of Identity which said that multiplication by 1 doesn’t change a number. In
logic, there is also an identity for AND:
Law of Identity for AND:
a1 = a
Even though this Law looks familiar from numbers, we have to be careful to check that it
is still true for logic (where a is a statement and a1 means “a AND 1”).
To see that the Law of Identity holds for AND, look at the truth table for a AND 1. Here
1 means a variable that is always true, so to analyze a1 we only need to see what
happens when we change a. With only one variable, the truth table for a1 has 21 = 2
rows:
a
a1
0
0
1
1
Since the two columns are the same, a = a1.
Diagrammatically, we draw a1 = a this way
=
a
1
a
Another way to think of this is that if we have a logic network with a gate that looks like
the one above, we can remove that gate.
We also have the
Law of Identity for OR:
a+0=a
This follows from the truth table for a + 0 (here 0 means a variable that is always false).
Analyzing a OR FALSE, we have
a
a+0
0
0
1
1
And again the two columns are the same, so a = a + 0.
We also have another property that is similar to what we had for numbers:
Distributive Law for AND and OR:
a(b + c) = ab + ac
To see that the Distributive Law holds, we compare the last columns of the following
truth tables; noting that the truth values of the last two columns are the same.
a
0
0
0
0
1
1
1
1
b
0
0
1
1
0
0
1
1
c
0
1
0
1
0
1
0
1
b+c a(b+c)
0
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
a
0
0
0
0
1
1
1
1
b
0
0
1
1
0
0
1
1
c
0
1
0
1
0
1
0
1
ab
0
0
0
0
0
0
1
1
ac
0
0
0
0
0
1
0
1
ab+ac
0
0
0
0
0
1
1
1
Diagrammatically, this looks like
a
b
c
=
a
b
a
c
So far we have seen laws that are similar to what we had for numbers. Even though our
objects are not numbers but rather statements, this similarity is helpful when
manipulating logical expressions; we can use our intuition for the algebra of numbers to
work with the algebra of statements. This is the great power of Boole’s notation.
But there are other properties of logic which not like the properties of numbers. For
example, in logic 1 + 1 = 1 (this says that two true statements ORed together make a true
statement).
We also have the following property:
Law of Double Negation for NOT: a = a
Which says that doing two NOTs in a row is the same as doing nothing. This should be
clear because if the first NOT changes a 0 to a 1 then the second NOT will change that 1
back to 0 (and vice versa).
Diagrammatically, this says
=
a
a
We have a different sort of cancellation for AND.
Cancellation Law for AND:
aa= 0
This says that a AND NOT a is false, which is intuitively clear (you can’t believe a
statement and its negation at the same time!) and which we can also check using the truth
table
a
a
aa
0
1
0
1
0
0
Finally, we have a property which we will soon find to be very useful when simplifying
logic networks:
Cancellation Law for OR:
a+ a = 1
Intuitively, this just says that either a statement is true or its negation is true; that is, either
a or NOT a has to be true, so when we OR these two pieces together to get a + a it has
to be true. We can write this out with a truth table
a
a
a +a
0
1
1
1
0
1
Diagrammatically this says
a
a
=
1
This means that if we have a logic network that has a portion like the little network on the
left, we can remove the little network, replacing the variable a with a constant value of 1.
Download