discrete structures – cs2300 1 text discrete mathematics and its applications kenneth h. rosen (7...
TRANSCRIPT
![Page 1: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/1.jpg)
Discrete Structures – CS2300
1
Text
Discrete Mathematics and Its Applications
Kenneth H. Rosen (7th Edition)
Chapter 1
The Foundations: Logic and Proofs
![Page 2: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/2.jpg)
About This Course
• The Conceptual Foundation of Computer Science
• Prerequisite for CS 3240 (Theory of Computation)
• Applied Mathematics Course
![Page 3: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/3.jpg)
Continuous vs. Discrete Math
3
Continuous Discrete
Sliding down a slidePouring water
Length of ropeCrawling slug
Adding milkGrade point average
Climbing up stairsStacking ice cubesNumber of knotsHopping rabbitAdding eggsCalculus grade
![Page 4: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/4.jpg)
Discrete Solutions
• How many ways are there to choose a valid password?
• What is the probability of winning the lottery?• Is there a path linking two particular computers
in a network?• What is the shortest path between two
destinations using a transportation system?• How many valid Internet addresses are there?
4
![Page 5: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/5.jpg)
Chapter 1 Objective
“In this chapter we will explain what makes up a correct mathematical [logical] argument and introduce tools to construct these arguments.”
5
![Page 6: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/6.jpg)
Sections 1.1, 1.2
6
Logic
Propositional Logic
![Page 7: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/7.jpg)
Propositions
7
A proposition is a statement that is either true or false, but not both.Today is Tuesday.
Six is a prime number.
Count is less than ten.
7<5
Consider this statement.
![Page 8: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/8.jpg)
Compound Propositions
8
Compound propositions are formed from existing propositions using logical operatorsToday is Wednesday and it is snowing outside.
12 is not a prime number.
![Page 9: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/9.jpg)
Negation of a Proposition
9
T
F
F
T
NOT !P P
![Page 10: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/10.jpg)
Negation of a Proposition
10
repeat{…}until(feof(my_file));
while (!feof(my_file)){…}
![Page 11: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/11.jpg)
Disjunction of Two Propositions
11
T T
T F
F T
F F
T
T
T
F
OR ||qp p q
![Page 12: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/12.jpg)
Disjunction of Two Propositions
12
repeat{ …}until(count>10 || feof(myfile));
if(choice==PAUSE || choice ==STOP) ...
![Page 13: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/13.jpg)
Conjunction of Two Propositions
13
T T
T F
F T
F F
T
F
F
F
AND &&p q qp
![Page 14: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/14.jpg)
Conjunction of Two Propositions
14
while(!feof(a_file) && index<SIZE){ …}
if(!done && time_left) ...
![Page 15: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/15.jpg)
Exclusive-OR of Two Propositions
15
T T
T F
F T
F F
F
T
T
F
Exactlyone ofthem istrue.
p q qp ^
“but not both”
![Page 16: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/16.jpg)
Implication
16
T T
T F
F T
F F
T
F
T
T
p is called thehypothesis and q is theconclusion
p q qp
![Page 17: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/17.jpg)
Implication (“Conditional”)
• “if p, then q”
• “p implies q”
• “if p,q”
• “p only if q”
• “p is sufficient for q”
• “q if p”
• “q whenever p”
• “q is necessary for p”
17
T T
T F
F T
F F
T
F
T
T
p q qp
17
![Page 18: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/18.jpg)
q whenever p
18
T T
T F
F T
F F
T
F
T
T
Suppose that the proposition is true. Then, q is true whenever p is true.
p q qp
18
![Page 19: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/19.jpg)
p is sufficient for q
19
T T
T F
F T
F F
T
F
T
T
Suppose that the proposition is true. Then, to guarantee that q is true it is sufficient to say that p is true.
p q qp
19
![Page 20: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/20.jpg)
Converse of an Implication
20
T T
T F
F T
F F
T
F
T
T
T
T
F
T
p q qp AndConversely
qp
20
![Page 21: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/21.jpg)
Example of Converse
21
If it stays warm for a week, the apple trees will bloom.If the apple trees bloom, it will be warm for a week.
If x is even then x2 is even.
If x2 is even then x is even.
![Page 22: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/22.jpg)
Contrapositive of an Implication
22
T T
T F
F T
F F
T
F
T
T
T
F
T
F F
F T
T F
T T T
p qqp pq pq
22
![Page 23: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/23.jpg)
Examples of Contrapositive
23
If it snows tonight, then I will stay at home.
If I do not stay at home, then it didn’t snow tonight.
If x is odd then x2 is odd.
If x2 is not odd then x is not odd.
If x2 is even then x is even.
![Page 24: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/24.jpg)
Biconditional
T T
T F
F T
F F
T
F
T
T
T
T
F
T
T
F
F
T
p qpq qp )()( qpqp
qp
24
![Page 25: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/25.jpg)
Biconditional
25
pif and only if q p iff q
qp )()( qpqp
![Page 26: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/26.jpg)
![Page 27: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/27.jpg)
Bitwise operators
1101 10011110 01001100 0000
AND1101 10011110 01001111 1101
OR
1101 10011110 01000011 1101
XOR
a&b a|b
a^b
27
![Page 28: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/28.jpg)
t01_1_009.jpg
![Page 29: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/29.jpg)
Tautology
29
Tautology - a compound proposition that is always true.
T T T TT F F TF T T TF F T T
p qpqpqp )(
pqp )(
![Page 30: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/30.jpg)
Contradiction
30
Contradiction - a compound proposition that is always false.
T F F
F T F
p pp p
![Page 31: Discrete Structures – CS2300 1 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (7 th Edition) Chapter 1 The Foundations: Logic and Proofs](https://reader035.vdocuments.mx/reader035/viewer/2022062422/56649f1b5503460f94c30e12/html5/thumbnails/31.jpg)
Contingency
31
A contingency is neither a tautology nor a contradiction.
T T T TT F F FF T F TF F F T
p qp q )( qpp )( qpp