0% found this document useful (0 votes)
51 views31 pages

2 Chapter 1 - Lecture 2

This document summarizes part of a lecture on discrete mathematics. It discusses: 1. Bit operations including bit strings, bitwise logic operations like AND, OR and XOR on bit strings. 2. Logic circuits and gates including AND, OR and NOT gates. It provides examples of determining the output of logic circuits composed of these gates. 3. Propositional logic including tautologies, contradictions and contingencies. It discusses logical equivalences between compound propositions and provides examples of showing logical equivalence using truth tables.

Uploaded by

Shehab magdy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views31 pages

2 Chapter 1 - Lecture 2

This document summarizes part of a lecture on discrete mathematics. It discusses: 1. Bit operations including bit strings, bitwise logic operations like AND, OR and XOR on bit strings. 2. Logic circuits and gates including AND, OR and NOT gates. It provides examples of determining the output of logic circuits composed of these gates. 3. Propositional logic including tautologies, contradictions and contingencies. It discusses logical equivalences between compound propositions and provides examples of showing logical equivalence using truth tables.

Uploaded by

Shehab magdy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Chapter 1

Lecture 2
26/2/2022
Book: Sections 1.1.6 to 1.3.2

Discrete Mathematics
Bit Operations

Lecture Logic circuits (digital circuit)

Contents Propositional equivalences




Tautology
Contradiction
• Contingency

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)

▪ A variable is called a Boolean variable if its


value is either true or false.

▪ A Boolean variable can be represented using


a bit.

Discrete Mathematics
1.1.6. Bit Operations
Bit string

▪ A bit string is a sequence of zero or one bits.


▪ The length of bit string is the number of bits in the string.

▪ Example

101010011 is a bit string of length nine.

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

▪ If A is “001100” and B is “010101” then what is the value of A (Ex-or) B?


a) 000000 b) 111111 c) 001101 d) 011001

▪ Which of the following option is suitable, if A is “10110110”, B is”11100000” and C is”10100000”?


a) C=A or B b) C=A c) C=B d) C=A and B

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)

AND gates can be extended to arbitrary n inputs.


p
p q p1
q p1  p2  pn
…. 
p2

pn

Discrete Mathematics
1.2.6. Logic circuits (digital circuit)
OR gate (Boolean Sum)

OR gates can be extended to arbitrary n inputs.

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:

(𝑝 ∨ ¬𝑟) ∧ (¬𝑝 ∨ (𝑞 ∨ ¬𝑟))


when given input bits 𝑝, 𝑞, and 𝑟.

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

Tautology A compound proposition that is always true.

Propositional Contradiction A compound proposition that is always false.


Equivalences

Contingency A compound proposition that is neither a tautology nor a contradiction.

Discrete Mathematics
1.3. Propositional equivalences
Example (1)

Show that following conditional statement is a tautology by using truth table:


▪ p  ¬p ▪ p∧q→p

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 pq ¬(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

So, ¬(p  q)  (¬p  ¬q) is logically equivalent

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

So, ¬p  q and p → q is logically equivalent

Discrete Mathematics
1.3. Propositional equivalences
Example (3)
Show that p  (q  r) and (p  q)  (p  r) are logically equivalent.
p q r qr p  (q  r) pq pr (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

So, p  (q  r) and (p  q)  (p  r) is logically equivalent


Discrete Mathematics
1.3. Laws of Propositional Logic

T compound proposition is always true


F compound proposition is always false

Discrete Mathematics
1.3. Propositional equivalences

Discrete Mathematics
Thank you

Discrete Mathematics

You might also like