Lecture 1
Lecture 1
• Topics in discrete mathematics will be important and basics in many courses that you will
take in the future:
• Other Disciplines: You may find concepts learned here useful in courses in philosophy,
economics, linguistics, and other departments.
References
• Kenneth Rosen, (2019) Discrete Mathematics and Its Applications, McGraw-Hill Higher.
• Susanna S. Epp, (2019) Discrete Mathematics with Applications, Cengage Learning.
• https://www.youtube.com/watch?v=eFDzhn1Inc4&list=PLxIvc-
MGOs6gZlMVYOOEtUHJmfUquCjwz
• https://www.youtube.com/watch?v=Ho7BD7Yqqtk&list=PLZyQU-
WOzZF1rmALoJZthmDKPsqxCV4mW
Table of Contents
• On an elementary level, logic provides rules and techniques for determining whether a
given argument is valid.
A proposition (or statement) is a declarative sentence (that is, a sentence that declares a fact)
that is either true or false, but not both.
• The area of logic that deals with propositions is called propositional logics.
The Foundations: Logic and Proofs
Propositional Logic
Proposition:
Not [Questions - Command - Opinion - probabilities – variables]
EXAMPLE 1
➢ Sentences 1 and 2 are not propositions because they are not declarative sentences.
➢ Sentences 3 and 4 are not propositions because they are neither true nor false.
➢ Note that each of sentences 3 and 4 can be turned into a proposition if we assign values to the variables.
The Foundations: Logic and Proofs
Examples: Propositions Truth value
2+3= 5 True
5−2= 1 False
Today is Friday False
𝑥+3= 7, for 𝑥 = 4 True
Cairo is the capital of Egypt True
Sentences Is a Proposition
What time is it? Not propositions
Read this carefully. Not propositions
𝑥+3= 7 Not propositions
The Foundations: Logic and Proofs
The conventional letters used for propositional variables are p, q, r, s, The truth
value of a proposition is true, denoted by T, if it is a true proposition, and the
truth value of a proposition is false, denoted by F, if it is a false proposition.
The Foundations: Logic and Proofs
Simple (Primitive) propositions contain one sentence true or false.
Compound propositions combines between more than one propositions and need to
connect between them.
It is raining today, and I am happy.
The Foundations: Logic and Proofs
Negation:
Example:
¬𝑝: “It is not the case that Cairo is the capital of Egypt”
P ¬p
T F
F T
This table has a row for each of the two possible truth values of a proposition p. Each row
shows the truth value of ¬p corresponding to the truth value of p for this row.
No. of (Propositions) inputs
No. of rows appear in a truth table: 2
The Foundations: Logic and Proofs
𝑝: Today is Friday.
𝑞: It is raining today.
𝑝 ∧ 𝑞: Today is Friday and
it is raining today.
The Foundations: Logic and Proofs
𝑝: Today is Friday.
𝑞: It is raining today.
𝑝 ∨ 𝑞: Today is Friday or
it is raining today.
The Foundations: Logic and Proofs
Example
p q (p ∧ ¬ q) ∨ (¬ p ∧ q)
The Foundations: Logic and Proofs
Implication
CONDITIONAL
(¬ p ∨ q)
The Foundations: Logic and Proofs
Example 1:
Or
Example 2:
The Foundations: Logic and Proofs
BICONDITIONAL
The Foundations: Logic and Proofs
Precedence of logical operators.
Brackets first ()
𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 → 𝒓
𝐓 𝐓 𝐓
𝐓 𝐓 𝐅
𝐓 𝐅 𝐓
𝐓 𝐅 𝐅
𝐅 𝐓 𝐓
𝐅 𝐓 𝐅
𝐅 𝐅 𝐓
𝐅 𝐅 𝐅
The Foundations: Logic and Proofs
Truth Tables of Compound Propositions
Example
𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 → 𝒓
𝐓 𝐓 𝐓 𝐅
𝐓 𝐓 𝐅 𝐅
𝐓 𝐅 𝐓 𝐓
𝐓 𝐅 𝐅 𝐓
𝐅 𝐓 𝐓 𝐅
𝐅 𝐓 𝐅 𝐅
𝐅 𝐅 𝐓 𝐓
𝐅 𝐅 𝐅 𝐓
The Foundations: Logic and Proofs
Truth Tables of Compound Propositions
Example
𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 → 𝒓
𝐓 𝐓 𝐓 𝐅 𝐅
𝐓 𝐓 𝐅 𝐅 𝐅
𝐓 𝐅 𝐓 𝐓 𝐓
𝐓 𝐅 𝐅 𝐓 𝐓
𝐅 𝐓 𝐓 𝐅 𝐅
𝐅 𝐓 𝐅 𝐅 𝐅
𝐅 𝐅 𝐓 𝐓 𝐅
𝐅 𝐅 𝐅 𝐓 𝐅
The Foundations: Logic and Proofs
Truth Tables of Compound Propositions
Example
𝒑 𝒒 𝒓 ¬𝒒 𝒑 ∧ ¬𝒒 𝒑 ∧ ¬𝒒 → 𝒓
𝐓 𝐓 𝐓 𝐅 𝐅 𝐓
𝐓 𝐓 𝐅 𝐅 𝐅 𝐓
𝐓 𝐅 𝐓 𝐓 𝐓 𝐓
𝐓 𝐅 𝐅 𝐓 𝐓 𝐅
𝐅 𝐓 𝐓 𝐅 𝐅 𝐓
𝐅 𝐓 𝐅 𝐅 𝐅 𝐓
𝐅 𝐅 𝐓 𝐓 𝐅 𝐓
𝐅 𝐅 𝐅 𝐓 𝐅 𝐓
The Foundations: Logic and Proofs
Computers represent information using bits. A bit is a symbol with two possible
values, namely, 0 (zero) and 1 (one). This meaning of the word bit comes from binary
digit, because zeros and ones are the digits used in binary representations of numbers
A bit can be used to represent a truth value, because there are two truth values, namely,
true and false. As is customarily done, we will use a 1 bit to represent true and a 0 bit to
represent false. That is, 1 represents T (true), 0 represents F (false). A variable is called a
Boolean variable if its value is either true or false. Consequently, a Boolean variable
can be represented using a bit.
The Foundations: Logic and Proofs
• We will also use the notation OR, AND, and XOR for
the operators ∨, ∧, and ⊕, as is done in various
programming languages.
The Foundations: Logic and Proofs
Bit Strings
• Information is often represented using bit strings, which are lists of zeros and ones.
When this is done, operations on the bit strings can be used to manipulate this
information.
No of propositions =3
p, q, and r
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Applications of Propositional Logic:
Logic Circuits
• 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.
The Foundations: Logic and Proofs
Applications of Propositional Logic:
Logic Circuits:
The Foundations: Logic and Proofs
Applications of Propositional Logic:
Example
• Build a digital circuit that produces the output
(𝑝 ∨ ¬𝑟) ∧ (¬𝑝 ∨ (𝑞 ∨ ¬𝑟))
when given input bits 𝑝, 𝑞, and 𝑟.
The Foundations: Logic and Proofs
Applications of Propositional Logic: