ds lecture 1
DESCRIPTION
DSTRANSCRIPT
![Page 1: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/1.jpg)
(CSC 102)
Dr. Amer Rasheed COMSATS Institute of Information Technology
Discrete Structures
![Page 2: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/2.jpg)
Discrete vs Continuous
• Examples of discrete Data
– Number of boys in the class.– Number of candies in a packet.– Number of suitcases lost by an airline.
• Examples of continuous Data
– Height of a person.– Time in a race.– Distance traveled by a car.
![Page 3: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/3.jpg)
What is discrete Structures?
• Discrete mathematics is the part of mathematics devoted to the study of discrete objects (Kenneth H. Rosen, 6th edition).
• Discrete mathematics is the study of mathematical structures that are fundamentally discrete rather than continuous (wikipedia).
![Page 4: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/4.jpg)
Applications of discrete mathematics
• How can a circuit that adds two integers be designed?
• How many ways are there to choose a valid password on a computer?
• What is the shortest path between two cities using transportation system?
• How can I encrypt a message so that no unintended recipient can read it?
• How many valid internet addresses are there?
• How can a list of integers be sorted so that the integers are in increasing order?
![Page 5: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/5.jpg)
Syllabus (Topics to be covered in this course)
• Logic Logic • Elementary Number Theory and Methods of ProofElementary Number Theory and Methods of Proof• Set TheorySet Theory• RelationsRelations• Sequences and RecursionSequences and Recursion• Mathematical InductionMathematical Induction• CountingCounting• Relations and Equivalence RelationsRelations and Equivalence Relations• GraphsGraphs• TreesTrees
![Page 6: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/6.jpg)
Reference Books
• Discrete Mathematics and its Applications (with Combinatorics and Graph Theory) 6th Edition, The McGraw-Hill Companies, 2007, Kenneth H. Rosen.
• Discrete Mathematics with Applications 2nd Edition, Thomson Learning, 1995, Susanna S. Epp.
• Discrete Mathematics for Computer Scientists 2nd Edition, Addison-Wesley, 1999, John Truss.
![Page 7: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/7.jpg)
Logic
• Propositional Logic
• Logic of Compound Statements
• Propositional Equivalences
• Conditional Statements
• Logical Equivalences
• Valid and Invalid Arguments
• Applications: Digital Logic Circuits
• Predicates and Quantifiers
• Logic of Quantified Statements
![Page 8: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/8.jpg)
Propositional LogicPropositional Logic
Proposition: 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.
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).
![Page 9: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/9.jpg)
![Page 10: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/10.jpg)
2. Is the following sentence a proposition? If it is a proposition, determine whether it is true or false.
Can Ali come with you?.
This is a question not the declarative sentence and hence
not a proposition.
Examples (Propositions Cont.)
![Page 11: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/11.jpg)
3. Is the following sentence a proposition? If it is a proposition, determine whether it is true or false.
Take two aspirins.
This is an imperative sentence not the declarative sentence and therefore not a proposition.
Examples (Propositions Cont.)
![Page 12: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/12.jpg)
4. Is the following sentence a proposition? If it is a proposition, determine whether it is true or false.
x+ 4 > 9.
Because this is true for certain values of x (such as x = 6) and false for other values of x (such as x = 5), it is not a proposition.
Examples (Propositions Cont.)
![Page 13: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/13.jpg)
5. Is the following sentence a proposition? If it is a proposition, determine whether it is true or false.
He is a college student.
Because truth or falsity of this proposition depend on the reference for the pronoun he. it is not a proposition.
Examples (Propositions Cont.)
![Page 14: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/14.jpg)
Notations
• The small letters are commonly used to denote the propositional variables, that is, variables that represent propositions, such as, p, q, r, s, ….
• The truth value of a proposition is true, denoted by T or 1, if it is a true proposition and false, denoted by F or 0, if it is a false proposition.
![Page 15: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/15.jpg)
Compound PropositionsCompound Propositions
Producing new propositions from existing propositions.
Logical Operators or Connectives
1. Not
2. And ˄
3. Or ˅
4. Exclusive or
5. Implication
6. Biconditional
![Page 16: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/16.jpg)
Compound PropositionsCompound Propositions
Negation of a propositionNegation of a proposition
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 as “not p”. The truth values of the negation of p, p, is the opposite of the truth value of p.
![Page 17: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/17.jpg)
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.
This negation can be more simply expressed by
p : Today is not Friday.
![Page 18: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/18.jpg)
Examples
2. Write the negation of
“6 is negative”.The negation is
“It is not the case that 6 is negative”.
or “6 is nonnegative”.
![Page 19: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/19.jpg)
Truth Table (NOT)Truth Table (NOT)
• Unary Operator, Symbol: Unary Operator, Symbol:
p pp
true false
false true
![Page 20: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/20.jpg)
Conjunction (AND)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.
![Page 21: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/21.jpg)
Examples
1. Find the conjunction of the propositions p and q, where
p : Today is Friday.
q : It is raining today.The conjunction is
p˄q : Today is Friday and it is raining today.
![Page 22: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/22.jpg)
![Page 23: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/23.jpg)
Truth Table (AND)Truth Table (AND)
• Binary Operator, Symbol: Binary Operator, Symbol:
pp qq ppqq
truetrue truetrue truetrue
truetrue falsefalse falsefalse
falsefalse truetrue falsefalse
falsefalse falsefalse falsefalse
![Page 24: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/24.jpg)
Disjunction (OR)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.
![Page 25: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/25.jpg)
Examples
1. Find the disjunction of the propositions p and q, where
p : Today is Friday.
q : It is raining today.The disjunction is
p˅q : Today is Friday or it is raining today.
![Page 26: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/26.jpg)
![Page 27: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/27.jpg)
Truth Table (OR)Truth Table (OR)
• Binary Operator, Symbol: Binary Operator, Symbol:
pp qq pp qq
truetrue truetrue truetrue
truetrue falsefalse truetrue
falsefalse truetrue truetrue
falsefalse falsefalse falsefalse
![Page 28: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/28.jpg)
Exclusive OR (XOR)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.
![Page 29: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/29.jpg)
Examples
1. Find the exclusive or of the propositions p and q, where
p : Atif will pass the course CSC102.
q : Atif will fail the course CSC102.The exclusive or is
pq : Atif will pass or fail the course CSC102.
![Page 30: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/30.jpg)
Truth Table (XOR)Truth Table (XOR)
• Binary Operator, Symbol: Binary Operator, Symbol:
pp qq ppqq
truetrue truetrue falsefalse
truetrue falsefalse truetrue
falsefalse truetrue truetrue
falsefalse falsefalse falsefalse
![Page 31: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/31.jpg)
Examples (OR vs XOR)
The following proposition uses the (English) connective “or”. Determine from the context whether “or” is intended to be used in the inclusive or exclusive sense.
1. “Nabeel has one or two brothers”.A person cannot have both one and two brothers. Therefore, “or” is used in the exclusive sense.
![Page 32: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/32.jpg)
Examples (OR vs XOR)
2. To register for BSC you must have passed the qualifying exam or be listed as an Math major.
Presumably, if you have passed the qualifying exam and are also listed as an Math major, you can still register for BCS. Therefore, “or” is inclusive.
![Page 33: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/33.jpg)
![Page 34: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/34.jpg)
Composite StatementsComposite Statements
Statements and operators can be combined in any Statements and operators can be combined in any way to form new statements.way to form new statements.
pp qq pp qq ((p)p)((q)q)
truetrue truetrue falsefalse falsefalse falsefalse
truetrue falsefalse falsefalse truetrue truetrue
falsefalse truetrue truetrue falsefalse truetrue
falsefalse falsefalse truetrue truetrue truetrue
![Page 35: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/35.jpg)
![Page 36: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/36.jpg)
Translating English to LogicTranslating English to Logic
I did not buy a lottery ticket this week or I bought a lottery ticket and won the million dollar on Friday.
Let p and q be two propositions
p: I bought a lottery ticket this week.
q: I won the million dollar on Friday.
In logic form
pp(p(pq))
![Page 37: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/37.jpg)
![Page 38: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/38.jpg)
Lecture Summery Lecture Summery
• Introduction to the Course
• Propositions
• Logical Connectives
• Truth Tables
• Compound propositions
• Translating English to logic and logic to English.
![Page 39: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/39.jpg)
![Page 40: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/40.jpg)
![Page 41: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/41.jpg)
Conditional StatementsConditional Statements
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 is true otherwise.
where p is called hypothesis, antecedent or premise.
q is called conclusion or consequence
Implication
![Page 42: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/42.jpg)
Implication (if - then)Implication (if - then)
• Binary Operator, Symbol: Binary Operator, Symbol:
PP QQ P P QQ
truetrue truetrue truetrue
truetrue falsefalse falsefalse
falsefalse truetrue truetrue
falsefalse falsefalse truetrue
![Page 43: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/43.jpg)
Conditional StatementsConditional Statements
Definition: Let p and q be propositions. The biconditional statement pq, is the proposition “p if and only if q”.
The biconditional (bi-implication) statement p q is true when p and q have same truth values and is false otherwise.
Biconditional Statements
![Page 44: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/44.jpg)
Biconditional (if and only if)Biconditional (if and only if)
• Binary Operator, Symbol: Binary Operator, Symbol:
PP QQ P P QQ
truetrue truetrue truetrue
truetrue falsefalse falsefalse
falsefalse truetrue falsefalse
falsefalse falsefalse truetrue
![Page 45: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/45.jpg)
Composite StatementsComposite Statements• Statements and operators can be combined in any way to Statements and operators can be combined in any way to
form new statements.form new statements.
PP QQ PP QQ ((P)P)((Q)Q)
truetrue truetrue falsefalse falsefalse falsefalse
truetrue falsefalse falsefalse truetrue truetrue
falsefalse truetrue truetrue falsefalse truetrue
falsefalse falsefalse truetrue truetrue truetrue
![Page 46: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/46.jpg)
Equivalent StatementsEquivalent StatementsPP QQ (P(PQ)Q) ((P)P)((Q)Q) (P(PQ)Q)((P)P)((Q)Q)
truetrue truetrue falsefalse falsefalse truetrue
truetrue falsefalse truetrue truetrue truetrue
falsefalse truetrue truetrue truetrue truetrue
falsefalse falsefalse truetrue truetrue truetrue•Two statements are called logically equivalent if and only if (iff) they
have identical truth tables
•The statements The statements (P(PQ) and (Q) and (P)P)((Q) are Q) are logically equivalentlogically equivalent, because , because (P(PQ)Q)((P)P)((Q) is always true.Q) is always true.
![Page 47: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/47.jpg)
Tautologies and ContradictionsTautologies and Contradictions• Tautology is a statement that is always true regardless of the truth
values of the individual logical variables
• Examples: Examples: • RR((R)R) (P(PQ) Q) ((P)P)((Q)Q)
• If S If S T is a tautology, we write S T is a tautology, we write S T. T.• If S If S T is a tautology, we write S T is a tautology, we write S T. T.
![Page 48: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/48.jpg)
Tautologies and ContradictionsTautologies and Contradictions
• A A Contradiction is a statement that is always false regardless of the truth values of the individual logical variables
ExamplesExamples• RR((R)R) (((P(PQ)Q)((P)P)((Q))Q))
• The negation of any tautology is a contradiction, and The negation of any tautology is a contradiction, and the negation of any contradiction is a tautology.the negation of any contradiction is a tautology.
![Page 49: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/49.jpg)
January 24, 2012 Applied Discrete Mathematics Week 1: Logic and Sets
49
ExercisesExercises•We already know the following tautology: We already know the following tautology:
(P(PQ) Q) ((P)P)((Q)Q)
•Nice home exercise: Nice home exercise:
•Show that Show that (P(PQ) Q) ((P)P)((Q).Q).
•These two tautologies are known as De Morgan’s laws.These two tautologies are known as De Morgan’s laws.
![Page 50: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/50.jpg)
January 31, 2012 Applied Discrete Mathematics Week 2: Functions and Sequences
50
ExercisesExercises
Question 1Question 1Given a set A = {x, y, z} and a set B = {1, 2, 3, 4}, what is the Given a set A = {x, y, z} and a set B = {1, 2, 3, 4}, what is the value of | 2value of | 2AA 2 2BB | ? | ?
AnswerAnswer| 2| 2AA 2 2BB | = | 2 | = | 2AA | | | 2 | 2BB | = 2 | = 2|A||A| 2 2|B||B| = 8 = 816 = 128 16 = 128
![Page 51: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/51.jpg)
![Page 52: DS Lecture 1](https://reader036.vdocument.in/reader036/viewer/2022062502/577cc7bd1a28aba711a1b3f9/html5/thumbnails/52.jpg)
Graph TheoryEuler Paths and Circuits
I n order to minimize cost to the city, how should weekly garbage collection routes be designed f or Detroit’s 350,000 households?