DS-Lecture 01
DS-Lecture 01
(CS-104)
Lecture 01
WELCOME TO CS-104
• Dr. Gul, doing research in Information Security, Deep Learning and VANETs……… Mostly all
kinds of algorithms.
• What you can expect from me:
Email: [email protected]
• Logic
• Elementary Number Theory and Methods of Proof
• Set Theory
• Relations
• Sequences and Recursion
• Mathematical Induction
• Counting
• Relations and Equivalence Relations
• Graphs
• Trees
Reference Books
Kenneth H. Rosen.
Examples
1. Is the following sentence a proposition? If it is a proposition,
determine whether it is true or false.
Paris is the capital of France.
This makes a declarative statement, and hence is a
proposition. The proposition is TRUE (T).
Examples (Propositions Cont.)
He is a college student.
1. Not
2. And ˄
3. Or ˅
4. Exclusive or
5. Implication
6. Biconditional
Examples
1. Find the negation of the following proposition
p : Today is Friday.
The negation is
p : It is not the case that today is Friday.
1. Not
2. And ˄
3. Or ˅
4. Exclusive or
5. Implication
6. Biconditional
Examples
p : Today is Friday.
q : It is raining today.
The conjunction is
“6 is negative”.
The negation is
p p
true false
false true
Conjunction (AND)
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 p and q are
both true and is false otherwise.
Examples
p : Today is Friday.
q : It is raining today.
The conjunction is
p q pq
true true true
true false false
false true false
false false false
Disjunction (OR)
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.
Examples
p : Today is Friday.
q : It is raining today.
The disjunction is
p q pq
true true true
true false true
false true true
false false false
Exclusive OR (XOR)
Definition
Let p and q be propositions. The exclusive or
of p and q, denoted by pq, is the proposition
“pq”.
The exclusive or, p q, is true when exactly
one of p and q is true and is false otherwise.
Examples
p q p q (p)(q)
true true false false false
true false false true true
false true true false true
false false true true true
Translating English to Logic
In logic form
p(pq)
Lecture Summery
Answer
| 2A 2B | = | 2A | | 2B | = 2|A| 2|B| = 816 = 128
52
Graph Theory
Euler Paths and Circuits
In order to minimize
cost to the city, how
should weekly garbage
collection routes be
designed for Detroit’s
350,000 households?
Tautologies and Contradictions
• Tautology is a statement that is always true regardless of the truth
values of the individual logical variables
• Examples:
• R(R)
• (PQ) (P)(Q)
• If S T is a tautology, we write S T.
• If S T is a tautology, we write S T.
Tautologies and Contradictions
• A Contradiction is a statement that is always false regardless of
the truth values of the individual logical variables
Examples
• R(R)
• ((PQ)(P)(Q))
• The negation of any tautology is a contradiction, and
the negation of any contradiction is a tautology.
Exercises
•We already know the following tautology:
•(PQ) (P)(Q)
•Nice home exercise:
•Show that (PQ) (P)(Q).
•These two tautologies are known as De Morgan’s laws.
51
Exercises
Question 1
Given a set A = {x, y, z} and a set B = {1, 2, 3, 4}, what is the
value of | 2A 2B | ?
Answer
| 2A 2B | = | 2A | | 2B | = 2|A| 2|B| = 816 = 128
52
Graph Theory
Euler Paths and Circuits
In order to minimize
cost to the city, how
should weekly garbage
collection routes be
designed for Detroit’s
350,000 households?