0% found this document useful (0 votes)
4 views85 pages

Lecture 2

Uploaded by

alihassenttyy3
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)
4 views85 pages

Lecture 2

Uploaded by

alihassenttyy3
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/ 85

Selected Topics

Spring 2025 - Dr. Mohamed Medhat


Dr. Bassant Mostafa
Selected Topics

Lecture 2
Table of Contents

● The Foundations: Logic and Proofs


● Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
● Algorithms
● Number Theory
● Induction and Recursion
● Counting
● Discrete Probability
● Advanced Counting Techniques
● Relations
● Graphs
● Trees
● Boolean Algebra
The Foundations: Logic and Proofs

If it is a dog, then it is a mammal

p q
The Foundations: Logic and Proofs
Conditional statement
Imply
p q

Converse Inverse Contrapositive

p q ≡ ┐q ┐p

q p ≡ ┐p ┐q
The Foundations: Logic and Proofs
Propositional Equivalences:

Compound proposition

Tautology. Contradiction. Contingency.


The Foundations: Logic and Proofs

Compound
proposition

Tautology Contradiction. Contingency.

All the truth All the truth


Neither T nor F
table (T) table (F)
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs



The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs

Example:
The Foundations: Logic and Proofs
Logically
Equivalences
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs

without using a Truth Table


The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs

without using a Truth Table


The Foundations: Logic and Proofs

¬ (p → q) → p

≡ ¬ (¬ p V q) → p

≡ (p ∧ ¬ q) → p

≡ ¬ (p ∧ ¬ q) V p

≡ (¬ p V q) V p

≡ (¬ p V p) V q

≡TVq
≡T
The Foundations: Logic and Proofs
Predicates and Quantifiers
The Foundations: Logic and Proofs
Predicates and Quantifiers

➢ Predicate is a statement has


variables.
➢ Proposition is a statement
does not have variables.

You are good person (Proposition)


Mohamed is married to X (predicate)
X+10=20 (predicate)
2+3=5 (Proposition)
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Example 4:
Let P(x,y) denote the statement “x +y ≤ 4.” and Q(x,y,z) denote the
statement “ x+2y+5z > 20”
What are these truth values?

➢ P(2,3) ^ Q(2,1,5)

➢ P(2,1) Q(3,1,3)
The Foundations: Logic and Proofs

Example:
Let P(x,y) denote the statement “x +y ≤ 4.” and Q(x,y,z) denote the
statement “ x+2y+5z > 20”
What are these truth values?

➢ P(2,3) ^ Q(2,1,5) F^T False

➢ P(2,1) Q(3,1,3) T F False


The Foundations: Logic and Proofs
Quantifiers:

Expresses the extent to which a predicate is true over a range of elements.

Quantifiers

Universal Existential
The Foundations: Logic and Proofs

Quantifiers

Universal Existential
The Foundations: Logic and Proofs

Quantifiers

Universal Existential
The Foundations: Logic and Proofs

Universal
Existential
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Example 5:
The Foundations: Logic and Proofs
Example 5:

T T F
F T F
The Foundations: Logic and Proofs
Translate into English
Example1:
Express the statement “Every student in this class has studied calculus.

Solution x is the domain that consists of all students in the school


𝑃(𝑥): 𝑥 has studied calculus.
𝑆(𝑥): 𝑥 is in this class. x ( S ( x ) → p ( x ))
The statement can be expressed as
The Foundations: Logic and Proofs
Example2:

𝐀𝐧𝐬𝐰𝐞𝐫
The Foundations: Logic and Proofs

𝐀𝐧𝐬𝐰𝐞𝐫
The Foundations: Logic and Proofs

𝐀𝐧𝐬𝐰𝐞𝐫
The Foundations: Logic and Proofs

𝐀𝐧𝐬𝐰𝐞𝐫
The Foundations: Logic and Proofs
Precedence of Quantifiers:
The Foundations: Logic and Proofs
Negating Quantified Expressions
1
The Foundations: Logic and Proofs
∀𝒙𝑷(𝒙) :
1
"Every student in your class has taken a course in calculus"

The negation of this statement is

"There is at least one student in your class who has not taken a course in calculus"
¬∀𝒙𝑷(𝒙) ≡ ∃𝒙¬𝑷(𝒙)
The Foundations: Logic and Proofs
2
The Foundations: Logic and Proofs
2
∃𝒙𝑷(𝒙) :

“At least one student in your class has taken a course in calculus"

The negation of this statement is

"Every student in this class has not taken calculus"


¬∃𝒙𝑷(𝒙) ≡ ∀𝒙¬𝑷(𝒙)
The Foundations: Logic and Proofs
Negating Quantified
Expressions

¬∀𝑥P(𝑥) ≡ ∃𝑥¬P(𝑥) ¬∃𝑥𝑄(𝑥) ≡ ∀𝑥¬𝑄(𝑥)


The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs

1. ¬∀𝑥(𝐴 ∨ 𝐵)

2. ቀ𝐴∧ (𝐵 ∨ 𝐶))

3. ¬∃𝑥 𝐴∧ (𝐵 ∨ 𝐶)

4. 𝐴∧ (𝐴 ∨ 𝐶)

5. 𝐴∧ (𝐴 ∨ 𝐶)

6. ¬∀𝑥 𝐴∧ (𝐴𝑉𝐶)
The Foundations: Logic and Proofs
Answer
1. ¬∀𝑥(𝐴 ∨ 𝐵) 1. ¬∀𝑥(𝐴 ∨ 𝐵) = ∃𝑥(𝐴᪄ ∧ 𝐵)

2. ቀ𝐴∧ (𝐵 ∨ 𝐶)) 2. 𝐴∧ (𝐵 ∨ 𝐶 ቁ = 𝐴᪄ ∨ 𝐵᪄ ∧ 𝐶᪄ = (𝐴᪄ ∨ 𝐵)


᪄ ∧ (𝐴᪄ ∨ 𝐶)

3. ¬∃𝑥 𝐴∧ (𝐵 ∨ 𝐶) 3. ¬∃𝑥 𝐴∧ (𝐵 ∨ 𝐶) = ∀𝑥¬ 𝐴∧ (𝐵 ∨ 𝐶) = ∀𝑥(𝐴᪄ ∨ 𝐵)


᪄ ∧ (𝐴᪄ ∨ 𝐶)

4. 𝐴∧ (𝐴 ∨ 𝐶) 4. 𝐴∧ (𝐴 ∨ 𝐶 ቁ = 𝐴᪄ ∨ (𝐴 ∨ 𝐶) = 𝐴᪄ ∨ (𝐴᪄ ∧ 𝐶)
᪄ = 𝐴᪄
• Another Solution: ൫A∧ (A ∨ C) = A → So: 𝐴∧ (𝐴 ∨ 𝐶 is 𝐴᪄

5. 𝐴∧ (𝐴 ∨ 𝐶) 5. ¬∀𝑥 𝐴∧ (𝐴 ∨ 𝐶)

6. ¬∀𝑥 𝐴∧ (𝐴𝑉𝐶) 6. ¬∀𝑥 𝐴∧ (𝐴 ∨ 𝐶) = ∃𝑥¬(A) = ∃𝑥 𝐴᪄


The Foundations: Logic and Proofs
Arguments in Propositional Logic
Consider the following argument involving propositions
(which, by definition, is a sequence of propositions):
"If you have a current password, then you can log onto the network."
"You have a current password."

Therefore,
"You can log onto the network."
The Foundations: Logic and Proofs
Arguments in Propositional Logic
Consider the following argument involving propositions
(which, by definition, is a sequence of propositions):
"If you have a current password, then you can log onto the network."
"You have a current password." Premises
Therefore,
"You can log onto the network." Conclusion
The Foundations: Logic and Proofs

This argument is valid if 𝑝 → 𝑞 ∧ 𝑝 → 𝑞 is a tautology.

𝑝→ 𝑞
𝑝 Premises

∴𝑞 Conclusion
The Foundations: Logic and Proofs

Valid Arguments
An argument in propositional logic is a sequence of
propositions. All the proposition in the argument are called
premises and the final proposition is called the conclusion.


The argument is valid if ∧ (∀ Premises) → conclusion is a tautology.
The Foundations: Logic and Proofs
Valid Arguments
We can always use a truth table to show that an argument form is valid.
Premise 1 Premise 2 Conclusion

𝒑 𝒒 𝒑→ 𝒒 𝒑 (𝒑 → 𝒒) ∧ 𝒑 𝒒 ((𝒑 → 𝒒) ∧ 𝒑) → 𝒒
𝐓 𝐓 𝐓 𝐓 𝐓 𝐓 𝐓
𝐓 𝐅 𝐅 𝐓 𝐅 𝐅 𝐓
𝐅 𝐓 𝐓 𝐅 𝐅 𝐓 𝐓
𝑝→ 𝑞
𝐅 𝐅 𝐓 𝐅 𝐅 𝐅 𝐓
𝑝
So, this argument is valid
𝑝 → 𝑞 ∧ 𝑝 → 𝑞 is a tautology
∴𝑞
Critical Rows: The critical rows are those rows where the premises have truth value T.
The Foundations: Logic and Proofs
Example1
Using the truth table to show that the hypotheses
𝑝∨𝑞
¬𝑝 ∨ 𝑟
lead to the conclusion
𝑞∨𝑟
The Foundations: Logic and Proofs

Example1
Premise 1 Premise 2 Conclusion
𝑝∨𝑞
𝒑 𝒒 𝒓 𝒑∨𝒒 ¬𝒑 ¬𝒑 ∨ 𝒓 (𝒑 ∨ 𝒒) ∧ (¬𝒑 ∨ 𝒓) 𝒒 ∨ 𝒓
¬𝑝 ∨ 𝑟
𝐓 𝐓 𝐓 𝐓 𝐅 𝐓 𝐓 𝐓
----------- 𝐓 𝐓 𝐅 𝐓 𝐅 𝐅 𝐅 𝐓
𝐓 𝐅 𝐓 𝐓 𝐅 𝐓 𝐓 𝐓
𝑞∨𝑟 𝐓 𝐅 𝐅 𝐓 𝐅 𝐅 𝐅 𝐅
𝐅 𝐓 𝐓 𝐓 𝐓 𝐓 𝐓 𝐓
𝐅 𝐓 𝐅 𝐓 𝐓 𝐓 𝐓 𝐓
𝐅 𝐅 𝐓 𝐅 𝐓 𝐓 𝐅 𝐓
𝐅 𝐅 𝐅 𝐅 𝐓 𝐓 𝐅 𝐅

So, this argument is valid


The Foundations: Logic and Proofs

WORD PROBLEM
Example2

Use truth table to determine the argument form

If Tariq is not on team A, then Hameed is on team B.


If Hameed is not on team B, then Tariq is on team A.
∴ Tariq is not on team A or Hameed is not on team B.

is valid or invalid.
The Foundations: Logic and Proofs

Argument is invalid
The Foundations: Logic and Proofs

WORD PROBLEM
Example3

Use truth table to determine the argument form

If I got an Eid bonus, I’ll buy a stereo.


If I sell my motorcycle, I’ll buy a stereo.
∴ If I get an Eid bonus or I sell my motorcycle, then I’ll buy a stereo.

is valid or invalid.
let
The Foundations: Logic and Proofs

Argument

Argument is valid
The Foundations: Logic and Proofs

Spring 2025 - Dr. Mohamed Medhat


Dr. Bassant Mostafa

You might also like