Академический Документы
Профессиональный Документы
Культура Документы
We will be using logical operations to build machines that can do arithmetic calculations.
Its useful to think of these operations as basic components that can be hooked together
into complex networks. To help visualize these networks, well use diagrams to
represent each operation.
For the logical operation AND, well use the following diagram, called an AND gate:
a ab
b
a
a+b
b
a a
a
b ab +c
c
This logic network indicates that we take a AND b, then NOT the result and combine
with c using an OR.
a
ab
b
a
b
ab + cd
c
d
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:
a
b
a OR b OR c c
a+b+c+d+e
OR d OR e d
e
We can now examine some basic properties of logical operations and how these
properties appear when diagrammed.
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 doesnt 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
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
For logic gates, these Laws of Commutativity say that it doesnt matter what order we use
to draw the inputs into the AND and OR gates:
a
b = b
a
a
b = 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 doesnt change a number. In
logic, there is also an identity for AND:
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
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.
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
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 a
b
b
c = 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 Booles 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).
a
= a
This says that a AND NOT a is false, which is intuitively clear (you cant 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:
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 = 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.