Note 5 PDF
Note 5 PDF
Later when we discuss the resolution inference we have to convert logic expressions into the
Conjunctive Normal Forms.
P → Q ≡ ¬P ⋁ Q
e.g., ¬¬P=P
¬(P ⋁ Q) = ¬P ⋀ ¬Q
¬(P ⋀Q) = ¬P ⋁ ¬Q
For example:
Both of Conjunctive Normal Forms and Disjunctive Normal Forms are used for design of
computer components.
COMP 1002 Class Notes #5, Edited by John Shieh, Fall of 2018 Page 1
Apply Propositional Calculus for Design of Computer Components.
A gate is an electronic device with one or more inputs, each of which can assumeeitherthe value
0 or 1. A gate usually has one output, which is a function of its inputs, and which is also either 0
or 1.Logic and bit operations
Computers represent information by bits.
A bit has two possible values, namely zero and one. This meaning of the word comes from
binary digit, since zeroes and ones are the digits used in binary representations of numbers
We can extend bit operations to bit strings. We define bitwise OR, bitwise AND and bitwise
XOR of two strings of the same length to be the strings that have as theirbits the OR, AND and
XOR of the corresponding bits in the two strings.
Example:Find the bitwise OR, bitwise AND and bitwise XOR of the
bit strings
01101 10110
11000 11101
Logic
The operation of a circuit is defined by a Booleanfunction that specifies the value of an output
for eachset of inputs.
The first step in constructing a circuit is to represent itsBoolean function by an expression built
up using thebasic operations of Boolean algebra.
The expression that we obtain may contain many moreoperations than are necessary to represent
the function.
We will describe later methods for finding an expressionwith the minimum number of sums and
products thatrepresents a Boolean function.
The procedures that we will develop are important in thedesign of efficient circuits.
Logic in Computer Science: Logic Gates CS2209, App
Boolean algebra provides the operations and the rulesfor working with the set {0, 1}.
The three most used operations in Boolean algebra arecomplementation, the Boolean sum and
the Booleanproduct. They correspond to the logical connectives ¬,⋁and ⋀.
The complement of an element, denoted by bar, isdefined by 0̅ = 1 and 1̅ = 0.
The Boolean sum, denoted by + or OR has thefollowing values
1 + 1 = 1; 1 + 0 = 1; 0 + 1 = 1; 0 + 0 = 0:
The Boolean product, denoted by ·or by AND, has thefollowing values:
1 ·1 = 1; 1 · 0 = 0; 0 · 1 = 0; 0 · 0 = 0: lied
COMP 1002 Class Notes #5, Edited by John Shieh, Fall of 2018 Page 2
Let B = {0, 1}. The variable x is called a Booleanvariable if it assumes only values from B.
A function from
Bn= {(x1; x2; ..;xi, ..;xn)| xi ϵ B; 1 <= i <= n}
to B is called a Boolean function of degree n. L
We will define several types of gates. Using these gateswe will apply the rules of Boolean
algebra to designcircuits that perform a variety of tasks.
The inverter accepts a Boolean value as input andproduces the complement of this value as its
output.
The second type gate is the OR gate.The inputs to this gate are the values of two or more
Boolean variables.
The third type of gate is the AND gate.The inputs to this gate are the values of two or more
Boolean variables.
COMP 1002 Class Notes #5, Edited by John Shieh, Fall of 2018 Page 3
We will permit multiple inputs to AND and OR gates, as below.
The circuits that we study give output that depends onlyon the inputs, and not the current state of
the circuit.
In other words, these circuits have no memory abilities.Such circuits are called combinatorial
circuits.
Combinatorial circuits can be constructed using acombination of inverters, OR gates and AND
gates.
When combinations of circuits are formed, some gatesmay share inputs. This is shown in one of
two ways indepictions of circuits.Both drawings below depict the circuit with output xy + x̅y.
Logic
COMP 1002 Class Notes #5, Edited by John Shieh, Fall of 2018 Page 4
Example 1: Construct the circuits that produce thefollowing outputs:
(a) (x + y)x̅
(b) x̅ (y+z̅)̅
(c) (x + y + z)(x̅ y̅ z̅ )
Example 2.A committee of three individuals decides issues for anorganization. Each individual
votes either yes or no for each proposalthat arises. A proposal is passed if it receives at least two
yes votes.Design a circuit that determines whether a proposal passes.
Solution:Let x = 1 if the first individual says yes and x = 0 ifthis individual says no. Similarly
for y and z.Then a circuit must be designed that produces output 1 from theinputs x; y; z when
two or more of x; y; z are 1.One representation of the Boolean function that has these output
values is xy + xz + yz.
COMP 1002 Class Notes #5, Edited by John Shieh, Fall of 2018 Page 5
Logic
Example 3.Sometimes light fixtures are controlled by more than oneswitch. Circuits need to be
designed so that flipping any one of theswitches for the fixture turns the light on when it is off
and turns thelight off when it is on. Design circuits that accomplish this whenthere are two
switches and when there are three switches.
Solution:
The two-switch case.
Let x = 1 when the first switch is closed and 0 when it is open, and
let y = 1 when the second switch is closed and 0 when it is open.
Let F(x, y) = 1 when the light is on and F(x, y) = 0 when the lightis off.
We can arbitrarily decide that the light will be on when both switchesare closed, so that F(1, 1) =
1.
This determines all the other values of F(x, y).
When one of the two switches is opened, the light goes off, so F(0, 1) = F(1, 0) = 0. When the
other switch is opened the lightgoes on, so that F(0, 0) = 1.
We see that F(x, y) = xy + x̅ y̅.
COMP 1002 Class Notes #5, Edited by John Shieh, Fall of 2018 Page 6
COMP 1002 Class Notes #5, Edited by John Shieh, Fall of 2018 Page 7