Discrete Structures
Discrete Structures
Lecture 4
Previous Lecture Summary
• Conditional Propositions.
• Negation, Inverse and Converse of the
conditional statements.
• Contraposition
• Bi-conditional statements.
• Necessary and Sufficient Conditions.
• Conditional statements and their Logical
equivalences.
Applications of Logic
3
Lectures outline
• Boolean Algebra
• Adders
• Reductions of circuits
Basic Logic Gates
x
• Not x where x = ¬x
x xy
• And y where xy = x y
x x+y
• Or y where x+y = x y
x xy
• Nand y where ¬(xy)= xy
x x+y
• Nor y
xÅy
• Xor x
y
Constructing Circuits
Here is the circuit of the statement
(p q) (~p q) (p ~q)
Cont...
Following is the circuit output of the following
statement
(x + y) ¬ y
x
y
Designing a circuitt for a given input/output
• Carry is x AND y
• Sum is x XOR y
• The circuit to compute this is called a half-adder.
Circuit of Half Adder
• Sum = x XOR y
• Carry = x AND y
x
y Sum
Carry
Using Half adders
1 0 0
1 1 0 0
+1 1 1 0
? 0 1 0
How to fix that
• We need to create an adder that can take a carry bit as an
additional input
Inputs: x, y, carry in
Outputs: sum, carry out
• This is called a full adder
Will add x and y with a half-adder
Will add the sum of that to the
carry in
• What about the carry out?
It’s 1 if either (or both):
x+y = 10
x+y = 01 and carry in = 1
The Full adder
The “HA” boxes are
half-adders
c X HA S
s
Y C
x X HA S
c
y
Y C
The Full adder
The full circuitry of the full adder
c
s
x
y
c
Logical Expression
Following is the circuit representations of the statement
Cont…….
The above statement is the logical equivalent to the
statement
Statement Reasons
( P Q) (~ P Q) ( P ~ Q)
( P ~ P) Q ( P ~ Q) : Distributive Law
t Q ( P ~ Q) : Negation Law
Q ( P ~ Q) : Identity law
(Q P) (Q ~ Q) : Distributive Law
(Q P ) t : Negation Law
QP : Identity Law
PQ : Commutative Law
Thus
Accordingly the two circuits are equivalent
Lecture summary
Expressions
• Reductions of circuits