Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 23

Discrete Mathematics

Dr. Ahmed AL-Janad


STM
aaljanad@auaf.edu.af
Assessment

• Advantages
Quizzes 20%

Midterm X 2 40%

Final 30%

Class participation 10%


References

• Advantages
1. Discrete Mathematics and its applications, 8th Edition, Kenneth Rosen, Mc Graw
Hill, 2019, ISBN-13: 9781259676512

2. Discrete Mathematics, 8th Edition, Richard Johnsonbaugh, Pearson DePaul


University, 2017, ISBN-13: 978-0321964687
Lecture 1: Propositional Logic
Learning Outcomes:
At the end of this lecture, YOU will learn:

❑ Propositional Logic –
✔ Overview
✔ Connectives
❑ Compound Propositions
✔ Construct the truth table Local Environment Setup

❑ Applications of Propositional Logic


✔ English Statement to Logical Expression

❑ Basic Logic Gates


Propositional Logic
⮚ What is Propositional Logic?
The rules of logic give precise meaning to mathematical statements.
These rules are used to distinguish between valid and invalid
mathematical arguments
A proposition is a declarative sentence that can be either true or
false; it must be one or the other, and it cannot be both.
 EXAMPLES. The following are propositions:
• AUAF is located at Kabul;
• the reactor is on;
• X is prime minister.

 whereas the following are not:


• are you going out somewhere?
• 2+3
Connectives
⮚ Now, rather than write out propositions in full, we will abbreviate them
by using propositional variables. p; q; r; …..

⮚ If we do this, we must define what we mean by writing something like:

Let q be (denote) Mahathir is prime Minister.

• A number of connectives which will allow us to build up complex


propositions. The connectives we introduce are:
˄ and (& or .)
˅ or (| or +)
not (~)
→ implies ( or ⊃)
↔, iff
AND (conjunction )
Definition: Let p and q be propositions. The conjunction of p and q,
denoted by p ∧ q, is the proposition “p and q.” The conjunction p ∧ q is
true when both p and q are true and is false otherwise .

Find the conjunction of the propositions p and q where p is the


p q p∧q proposition “Rebecca’s PC has more than 16 GB free hard
disk space” and q is the proposition “The processor in
T T T
Rebecca’s PC runs faster than 1 GHz.”
T F F
Solution: This conjunction can be expressed more simply as
F T F “Rebecca’s PC has more than 16 GB free hard disk space, and its
processor runs faster than 1 GHz.” For this conjunction to be true,
F F F both conditions given must be true. It is false when one or both of
these conditions
are false.
OR (Disjunction-inclusive)
Definition: Let p and q be propositions. The disjunction of p and q,
denoted by p ∨ q, is the proposition “p or q.” The disjunction p ∨ q is
false when both p and q are false and is true otherwise.

p q p∨q
Translate the statement “Students who have taken calculus or
T T T introductory computer science can take this class”

T F T Solution: We assume that this statement means that students who


have taken both calculus and introductory computer science can take
F T T the class, as well as the students who have taken only one of the two
subjects. Hence, this statement can be expressed as p ∨ q, the
F F F inclusive or, or disjunction, of p and q.
OR (exclusive)
Definition: Let p and q be propositions. The exclusive or of p and q,
denoted by p ⊕ q (or p XOR q), is the proposition that is true when
exactly one of p and q is true and is false otherwise.

p q p⊕q Express the statement “I will use all my savings to travel to


Europe or to buy an electric car”
T T F

T F T Solution: To translate this statement, we first note that the or in this


statement must be an exclusive or because this student can either
F T T use all his or her savings to travel to Europe or use all these savings
to buy an electric car, but cannot both go to Europe and buy an
F F F electric car. (This is clear because either option requires all his
savings.) Hence, this statement can be expressed as p ⊕ q.
Negation
Definition: Let p be a proposition. The negation of p, denoted by .p
(also denoted by p), is the statement “It is not the case that p.”
The proposition .p is read “not p.” The truth value of the negation of p,
.p, is the opposite of the truth value of p.
Find the negation of the proposition “Michael’s PC runs Linux” and
express this in simple English.

p p Solution: The negation is “It is not the case that Michael’s PC runs Linux.”
This negation can be more simply expressed as
“Michael’s PC does not run Linux.”
T F

F T Find the negation of the proposition “Vandana’s smartphone has at


least 32 GB of memory” and express this in simple English

Solution : The negation is “It is not the case that Vandana’s smartphone has
at least 32 GB of memory.” This negation can also be expressed as Vandana’s
smartphone does not have at least 32 GB of memory”
Conditional Statements (implies)
Definition: Let p and q be propositions. The conditional statement p
→ q is the proposition “if p, then q.” The conditional statement p → q is
false when p is true and q is false, and true otherwise. In the conditional
statement p → q, p is called the hypothesis and q is called the
conclusion (or consequence).
Let p be the statement “Maria learns discrete mathematics”
p q p→q and q the statement “Maria will find a good job.” Express the
statement p → q as a statement in English.
T T T

T F F Solution: represents the statement “If Maria learns discrete


mathematics, then she will find a good job.” There are many other
F T T ways to express this conditional statement in English. Among the
most natural of these are “Maria will find a good job when she learns
F F T discrete mathematics.” “For Maria to get a good job, it is sufficient for
her to learn discrete mathematics.”
Conditional Statements (implies)
Either my conclusion is true, or my assumption is false

p→q= p∨q

p q p→q p p∨q
T T T F T

T F F F F

F T T T T

F F T T T
Bi-conditional (iff)
Definition: Let p and q be propositions. The biconditional statement
p ↔ q is the proposition “p if and only if q.” The biconditional statement
p ↔ q is true when p and q have the same truth values, and is false
otherwise. Biconditional statements are also called bi-implications.
p q p↔q
T T T
Let p be the statement “You can take the flight,” and let q be
T F F the statement “You buy a ticket.”
Then p ↔ q is the statement
F T F
Solution: “You can take the flight if and only if you buy a ticket.”
F F T This statement is true if p and q are either both true or both false
Compound Propositions
Construct the truth table of the compound proposition
(p ∨ q) → (p ∧ q).

p q q p∨ q p∧q (p ∨ q) → (p ∧ q)

T T F T T T

T F T T F F

F T F F F T

F F T T F F
Class Task

Construct a truth table for each of these compound


propositions.33

a) p ∧ p
b) p ∨ p
c) (p ∨ .q) → q
d) (p ∨ q) → (p ∧ q)
e) (p → q) ↔ ( q → p)
f ) (p → q) → (q → p)
Applications of Propositional Logic
 Translation English statement into logical
expressions,
• logic is used in the specification of software and hardware, because these
specifications need to be precise before development begins.

• Furthermore, propositional logic and its rules can be used to design computer
circuits, to construct computer programs, to verify the correctness of programs,
and to build expert systems
How can this English sentence be translated into a logical expression?

Example 1: “You can access the Internet from campus only if you are a computer science major or
you are not a freshman.”? Solution 1: a → (c ∨ ¬f ).

Example 1: “You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16
years old.” Solution 1: (r ∧ ¬s) → ¬q.
Examples
• How can this English sentence be translated into a logical expression?

Example 1: “The automated reply cannot be sent when the file system is full” using logical
connectives..”? Solution 1: q → ¬p.

• Express these system specifications using the propositions p: “The message is


scanned for viruses” and q: “The message was sent from an unknown system”
together with logical connectives (including negations).7

a) “The message is scanned for viruses whenever the message was sent from an
unknown system.”
b) “The message was sent from an unknown system but it was not scanned for
viruses.”
c) “It is necessary to scan the message for viruses whenever it was sent from an
unknown system.”
d) “When a message is not sent from an unknown system it is not scanned for
viruses.”
Basic logic gates

Not x
x
x xy x xyz
And y y
z
x x+y x x+y+z
Or y
y z
x xy
Nand y
x x+y
Nor y
x xÅ y
Xor y
Examples
Find the output of the following circuit

x x+y
y (x+y)y
y

• Answer: (x+y)y
• Or (xy)y
Examples

Find the output of the following circuit

x
x xy xy
y
y
• Answer: xy
• Or (xy) ≡ xy
Examples
• Write the circuits for the following Boolean algebraic
expressions

__
a) x+y
_______
b) (x+y)x
c) p  q  (p  q)  ¬(p  q)
x  y  (x + y)(xy)
Thank you!

Darulaman Road

Kabul, Afghanistan

Main +93(0)729863447

auaf.edu.af

You might also like