2 Chapter 1 - Lecture 2
2 Chapter 1 - Lecture 2
Lecture 2
26/2/2022
Book: Sections 1.1.6 to 1.3.2
Discrete Mathematics
Bit Operations
1. Identity laws
Laws of Propositional Logic 2. Domination laws
3. Idempotent laws
4. Double negation law
5. Commutative laws
6. Associative laws
7. Distributive law
8. De Morgan’s laws
9. Absorption laws
10. Negation laws
1.1.6. Bit Operations
▪ Computers represent information using bits. A bit is a symbol with two possible
values: 0 (zero) and 1 (one).
▪ 1 represents T (true)
▪ 0 represents F (false)
Discrete Mathematics
1.1.6. Bit Operations
Bit string
▪ Example
Discrete Mathematics
1.1.6. Bit Operations
Discrete Mathematics
1.1.6. Bit Operations
Example
▪ Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings:
01 1011 0110 - 11 0001 1101
0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
AND 0 1 0 0 0 1 0 1 0 0
OR 1 1 1 0 1 1 1 1 1 1
XOR 1 0 1 0 1 0 1 0 1 1
Discrete Mathematics
1.1.6. Bit Operations
▪ Which of the following bits is the negation of the bits “010110”?
a) 111001 b) 001001 c) 101001 d) 111111
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
▪ A logic circuit (or digital circuit) receives input signals 𝑝1, 𝑝2, … , 𝑝𝑛, each a bit
[either 0 (off) or 1 (on)], and produces output signals 𝑠1, 𝑠2, … , 𝑠𝑛, each a bit.
▪ In this course, we will restrict our attention to logic circuits with a single output
signal; in general, digital circuits may have multiple outputs.
▪ Complicated digital circuits can be constructed from three basic circuits, called
gates.
NOT gate
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
AND gate (Boolean Product)
pn
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
OR gate (Boolean Sum)
p p1
p q
q p1 p2 …. pn
p2
pn
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
NOT gate (Boolean Complement)
p p
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Combination of Gates
p p
p (p q)
p
q p q
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Example (1)
▪ Determine the output for the combinatorial circuit in the following figure.
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Solution
p p q
q q
(p q) r
r
r
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Example (2)
▪ Determine the output for the combinatorial circuit in the following figure.
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Example (2)
▪ Determine the output for the combinatorial circuit in the following figure.
p p q
q
q (p q) (p (q r))
p
p
q p (q r)
r q r
r
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Example (3)
▪ Determine the output for the combinatorial circuit in the following figure.
p p q
(p q)
q
r q r
Discrete Mathematics
Homework (2)
يسلم في السيكشن القادم
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Problem (1)
▪ Build a digital circuit that produces the output:
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Problem (2)
▪ Find the output of the given circuit.
Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
Problem (3)
▪ Find the output of the given circuit.
Discrete Mathematics
1.3. Propositional equivalences
The compound propositions can be classified according to their possible truth values
into three types:
Compound Propositions
Tautology
Contradiction
Contingency
Discrete Mathematics
1.3. Propositional equivalences
Discrete Mathematics
1.3. Propositional equivalences
Example (1)
p ¬p p ¬p p q p∧q p∧q→p
T F T T T T T
F T T F T F T
T F T T F F T
F T T F F F T
▪ p ¬p is a tautology ▪ p ∧ q → p is a tautology
Discrete Mathematics
1.3. Propositional equivalences
Logical Equivalences
▪ Compound propositions that have the same truth values in all possible
cases are called logically equivalent.
▪ The compound propositions p and q are called logically equivalent if p q
is a tautology.
▪ The notation p q denotes that p and q are logically equivalent.
Discrete Mathematics
1.3. Propositional equivalences
Example (1)
Show that ¬(p q) and ¬p ¬q are logically equivalent.
p q pq ¬(p q) ¬p ¬q ¬p ¬q
T T T F F F F
F T T F T F F
T F T F F T F
F F F T T T T
Discrete Mathematics
1.3. Propositional equivalences
Example (2)
Show that ¬p q and p → q are logically equivalent.
p q ¬p ¬p q p→q
T T F T T
F T T T T
T F F F F
F F T T T
Discrete Mathematics
1.3. Propositional equivalences
Example (3)
Show that p (q r) and (p q) (p r) are logically equivalent.
p q r qr p (q r) pq pr (p q) (p r)
T T T T T T T T
F T T T T T T T
T F T F T T T T
F F T F F F T F
T T F F T T T T
F T F F F T F F
T F F F T T T T
F F F F F F F F
Discrete Mathematics
1.3. Propositional equivalences
Discrete Mathematics
Thank you
Discrete Mathematics