SlideShare a Scribd company logo
1 of 41
1
Math/CSE 1019C:
Discrete Mathematics for Computer Science
Fall 2011
Suprakash Datta
datta@cse.yorku.ca
Office: CSEB 3043
Phone: 416-736-2100 ext 77875
Course page: http://www.cse.yorku.ca/course/1019
2
Administrivia
Kenneth H. Rosen.
Discrete Mathematics
and Its Applications,
7th Edition. McGraw
Hill, 2012.
Lectures: Tu-Th 10:00-11:30 am (CLH E)
Exams: 3 tests (45%), final (40%)
Homework (15%): equally divided
between several assignments.
Slides: should be available after the class
Office hours: Wed 3-5 pm or by
appointment at CSEB 3043.
Textbook:
3
Administrivia – contd.
• Cheating will not be tolerated. Visit the
class webpage for more details on
policies.
• TA: Tutorials/office hours TBA.
• HW submitted late will not be graded.
4
Course objectives
We will focus on two major goals:
• Basic tools and techniques in discrete
mathematics
– Propositional logic
– Set Theory
– Simple algorithms
– Induction, recursion
– Counting techniques (Combinatorics)
• Precise and rigorous mathematical reasoning
– Writing proofs
5
To do well you should:
• Study with pen and paper
• Ask for help immediately
• Practice, practice, practice…
• Follow along in class rather than take notes
• Ask questions in class
• Keep up with the class
• Read the book, not just the slides
6
Reasoning about problems
• 0.999999999999999….=1?
• There exists integers a,b,c that satisfy
the equation a2+b2 = c2
• The program below that I wrote works
correctly for all possible inputs…..
• The program that I wrote never hangs
(i.e. always terminates)…
7
Tools for reasoning: Logic
Ch. 1: Introduction to Propositional Logic
• Truth values, truth tables
• Boolean logic:   
• Implications:  
8
Why study propositional logic?
• A formal mathematical “language” for
precise reasoning.
• Start with propositions.
• Add other constructs like negation,
conjunction, disjunction, implication etc.
• All of these are based on ideas we use
daily to reason about things.
9
Propositions
• Declarative sentence
• Must be either True or False.
Propositions:
• York University is in Toronto
• York University is in downtown Toronto
• All students at York are Computer Sc. majors.
Not propositions:
• Do you like this class?
• There are x students in this class.
10
Propositions - 2
• Truth value: True or False
• Variables: p,q,r,s,…
• Negation:
• p (“not p”)
• Truth tables
p p
T F
F T
11
Caveat: negating propositions
p: “it is not the case that p is true”
p: “it rained more than 20 inches in TO”
p: “John has many iPads”
Practice: Questions 1-7 page 12.
Q10 (a) p: “the election is decided”
12
Conjunction, Disjunction
• Conjunction: p  q [“and”]
• Disjunction: p  q [“or”]
p q p  q p  q
T T T T
T F F T
F T F T
F F F F
13
Examples
• Q11, page 13
p: It is below freezing
q: It is snowing
(a) It is below freezing and snowing
(b) It is below freezing but now snowing
(d) It is either snowing or below freezing
(or both)
14
Exclusive OR (XOR)
• p  q – T if p and q have different truth
values, F otherwise
• Colloquially, we often use OR
ambiguously – “an entrée comes with
soup or salad” implies XOR, but
“students can take MATH XXXX if they
have taken MATH 2320 or MATH 1019”
usually means the normal OR (so a
student who has taken both is still
eligible for MATH XXXX).
15
Conditional
• p  q [“if p then q”]
• p: hypothesis, q: conclusion
• E.g.: “If you turn in a homework late, it will not
be graded”; “If you get 100% in this course,
you will get an A+”.
• TRICKY: Is p  q TRUE if p is FALSE?
YES!!
• Think of “If you get 100% in this course, you
will get an A+” as a promise – is the promise
violated if someone gets 50% and does not
receive an A+?
16
Conditional - 2
• p  q [“if p then q”]
• Truth table:
p q p  q  p  q
T T T T
T F F F
F T T T
F F T T
Note the truth table of  p  q
17
Logical Equivalence
• p  q and  p  q are logically equivalent
• Truth tables are the simplest way to
prove such facts.
• We will learn other ways later.
18
Contrapositive
• Contrapositive of p  q is q  p
• Any conditional and its contrapositive
are logically equivalent (have the same
truth table) – Check by writing down the
truth table.
• E.g. The contrapositive of “If you get
100% in this course, you will get an A+”
is “If you do not get an A+ in this course,
you did not get 100%”.
19
E.g.: Proof using contrapositive
Prove: If x2 is even, x is even
• Proof 1: x2 = 2a for some integer a.
Since 2 is prime, 2 must divide x.
• Proof 2: if x is not even, x is odd.
Therefore x2 is odd. This is the
contrapositive of the original assertion.
20
Converse
• Converse of p  q is q  p
• Not logically equivalent to conditional
• Ex 1: “If you get 100% in this course,
you will get an A+” and “If you get an A+
in this course, you scored 100%” are
not equivalent.
• Ex 2: If you won the lottery, you are rich.
21
Other conditionals
Inverse:
• inverse of p  q is p  q
• How is this related to the converse?
Biconditional:
• “If and only if”
• True if p,q have same truth values, false
otherwise. Q: How is this related to XOR?
• Can also be defined as (p  q)  (q  p)
22
Example
• Q16(c) 1+1=3 if and only if monkeys
can fly.
23
Readings and notes
• Read pages 1-12.
• Think about the notion of truth
tables.
• Master the rationale behind the
definition of conditionals.
• Practice translating English
sentences to propositional logic
statements.
24
Next
Ch. 1.2, 1.3: Propositional Logic - contd
– Compound propositions, precedence rules
– Tautologies and logical equivalences
– Read only the first section called
“Translating English Sentences” in 1.2.
25
Compound Propositions
• Example: p  q  r : Could be
interpreted as (p  q)  r or p  (q  r)
• precedence order:      (IMP!)
(Overruled by brackets)
• We use this order to compute truth
values of compound propositions.
26
Tautology
• A compound proposition that is always
TRUE, e.g. q  q
• Logical equivalence redefined: p,q are
logical equivalences if p  q is a
tautology. Symbolically p  q.
• Intuition: p  q is true precisely when
p,q have the same truth values.
27
Manipulating Propositions
• Compound propositions can be
simplified by using simple rules.
• Read page 25 - 28.
• Some are obvious, e.g. Identity,
Domination, Idempotence, double
negation, commutativity, associativity
• Less obvious: Distributive, De Morgan’s
laws, Absorption
28
Distributive Laws
p  (q  r)  (p  q)  (p  r)
Intuition (not a proof!) – For the LHS to be true: p must
be true and q or r must be true. This is the same as
saying p and q must be true or p and r must be true.
p  (q  r)  (p  q)  (p  r)
Intuition (less obvious) – For the LHS to be true: p must
be true or both q and r must be true. This is the same
as saying p or q must be true and p or r must be true.
Proof: use truth tables.
29
De Morgan’s Laws
(q  r)  q  r
Intuition – For the LHS to be true: neither q nor r can be
true. This is the same as saying q and r must be false.
(q  r)  q  r
Intuition – For the LHS to be true: q  r must be false.
This is the same as saying q or r must be false.
Proof: use truth tables.
30
Using the laws
• Q: Is p  (p  q) a tautology?
• Can use truth tables
• Can write a compound proposition and
simplify
31
Limitations of Propositional Logic
• What can we NOT express using
predicates?
Ex: How do you make a statement
about all even integers?
If x >2 then x2 >4
• A more general language: Predicate
logic (Sec 1.4)
32
Next: Predicate Logic
Ch 1.4
–Predicates and quantifiers
–Rules of Inference
33
Predicate Logic
• A predicate is a proposition that is a
function of one or more variables.
E.g.: P(x): x is an even number. So P(1)
is false, P(2) is true,….
• Examples of predicates:
– Domain ASCII characters - IsAlpha(x) :
TRUE iff x is an alphabetical character.
– Domain floating point numbers - IsInt(x):
TRUE iff x is an integer.
– Domain integers: Prime(x) - TRUE if x is
prime, FALSE otherwise.
34
Quantifiers
• describes the values of a variable that
make the predicate true. E.g. x P(x)
• Domain or universe: range of values of
a variable (sometimes implicit)
35
Two Popular Quantifiers
• Universal: x P(x) – “P(x) for all x in the
domain”
• Existential: x P(x) – “P(x) for some x in
the domain” or “there exists x such that P(x) is
TRUE”.
• Either is meaningless if the domain is not
known/specified.
• Examples (domain real numbers)
– x (x2 >= 0)
– x (x >1)
– (x>1) (x2 > x) – quantifier with restricted domain
36
Using Quantifiers
Domain integers:
• Using implications: The cube of all
negative integers is negative.
x (x < 0) (x3 < 0)
• Expressing sums :
n
n ( i = n(n+1)/2)
i=1
Aside: summation notation
37
Scope of Quantifiers
•   have higher precedence than
operators from Propositional Logic; so x
P(x)  Q(x) is not logically equivalent to
x (P(x)  Q(x))
•  x (P(x)  Q(x))  x R(x)
Say P(x): x is odd, Q(x): x is divisible by 3, R(x): (x=0) (2x >x)
• Logical Equivalence: P  Q iff they have
same truth value no matter which domain
is used and no matter which predicates
are assigned to predicate variables.
38
Negation of Quantifiers
• “There is no student who can …”
• “Not all professors are bad….”
• “There is no Toronto Raptor that can
dunk like Vince …”
•  x P(x)   x P(x) why?
•   x P(x)   x P(x)
• Careful: The negation of “Every Canadian
loves Hockey” is NOT “No Canadian loves
Hockey”! Many, many students make this mistake!
39
Nested Quantifiers
• Allows simultaneous quantification of
many variables.
• E.g. – domain integers,
 x  y  z x2 + y2 = z2
• n  x  y  z xn + yn = zn (Fermat’s
Last Theorem)
• Domain real numbers:
x  y  z (x < z < y)  (y < z < x)
Is this true?
40
Nested Quantifiers - 2
x y (x + y = 0) is true over the integers
• Assume an arbitrary integer x.
• To show that there exists a y that satisfies
the requirement of the predicate, choose y
= -x. Clearly y is an integer, and thus is in
the domain.
• So x + y = x + (-x) = x – x = 0.
• Since we assumed nothing about x (other
than it is an integer), the argument holds
for any integer x.
• Therefore, the predicate is TRUE.
41
Nested Quantifiers - 3
• Caveat: In general, order matters!
Consider the following propositions over
the integer domain:
x y (x < y) and y x (x < y)
• x y (x < y) : “there is no maximum
integer”
• y x (x < y) : “there is a maximum
integer”
• Not the same meaning at all!!!

More Related Content

Similar to 1019Lec1.ppt

MFCS PPT.pdf
MFCS PPT.pdfMFCS PPT.pdf
MFCS PPT.pdfjayarao21
 
Predicates and Quantifiers
Predicates and QuantifiersPredicates and Quantifiers
Predicates and Quantifiersblaircomp2003
 
Predicates and Quantifiers
Predicates and Quantifiers Predicates and Quantifiers
Predicates and Quantifiers Istiak Ahmed
 
Predicates and quantifiers
Predicates and quantifiersPredicates and quantifiers
Predicates and quantifiersIstiak Ahmed
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logicAmey Kerkar
 
The Automated-Reasoning Revolution: from Theory to Practice and Back
The Automated-Reasoning Revolution: from Theory to Practice and BackThe Automated-Reasoning Revolution: from Theory to Practice and Back
The Automated-Reasoning Revolution: from Theory to Practice and BackMoshe Vardi
 
Introduction to Logic Spring 2007 Introduction to Discrete Structures.ppt
Introduction to Logic Spring 2007 Introduction to Discrete Structures.pptIntroduction to Logic Spring 2007 Introduction to Discrete Structures.ppt
Introduction to Logic Spring 2007 Introduction to Discrete Structures.pptyaniarianneyani
 
DisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptx
DisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptxDisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptx
DisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptxAdeel Saifee
 
Discrete mathematics by sadat sumon
Discrete mathematics by sadat sumonDiscrete mathematics by sadat sumon
Discrete mathematics by sadat sumonsadatsumon
 
Discrete Structure Lecture #5 & 6.pdf
Discrete Structure Lecture #5 & 6.pdfDiscrete Structure Lecture #5 & 6.pdf
Discrete Structure Lecture #5 & 6.pdfMuhammadUmerIhtisham
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topicsR.h. Himel
 

Similar to 1019Lec1.ppt (20)

02-boolean.ppt
02-boolean.ppt02-boolean.ppt
02-boolean.ppt
 
MFCS PPT.pdf
MFCS PPT.pdfMFCS PPT.pdf
MFCS PPT.pdf
 
Predicates and Quantifiers
Predicates and QuantifiersPredicates and Quantifiers
Predicates and Quantifiers
 
CS202Ch1.ppt
CS202Ch1.pptCS202Ch1.ppt
CS202Ch1.ppt
 
DM 1.pptx
DM 1.pptxDM 1.pptx
DM 1.pptx
 
Predicates and Quantifiers
Predicates and Quantifiers Predicates and Quantifiers
Predicates and Quantifiers
 
Predicates and quantifiers
Predicates and quantifiersPredicates and quantifiers
Predicates and quantifiers
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
 
logic_lec4.ppt
logic_lec4.pptlogic_lec4.ppt
logic_lec4.ppt
 
L01.ppt
L01.pptL01.ppt
L01.ppt
 
The Automated-Reasoning Revolution: from Theory to Practice and Back
The Automated-Reasoning Revolution: from Theory to Practice and BackThe Automated-Reasoning Revolution: from Theory to Practice and Back
The Automated-Reasoning Revolution: from Theory to Practice and Back
 
Introduction to Logic Spring 2007 Introduction to Discrete Structures.ppt
Introduction to Logic Spring 2007 Introduction to Discrete Structures.pptIntroduction to Logic Spring 2007 Introduction to Discrete Structures.ppt
Introduction to Logic Spring 2007 Introduction to Discrete Structures.ppt
 
DisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptx
DisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptxDisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptx
DisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptx
 
Discrete mathematics by sadat sumon
Discrete mathematics by sadat sumonDiscrete mathematics by sadat sumon
Discrete mathematics by sadat sumon
 
Machine learning mathematicals.pdf
Machine learning mathematicals.pdfMachine learning mathematicals.pdf
Machine learning mathematicals.pdf
 
Stochastic Processes Homework Help
Stochastic Processes Homework Help Stochastic Processes Homework Help
Stochastic Processes Homework Help
 
Discrete Structure Lecture #5 & 6.pdf
Discrete Structure Lecture #5 & 6.pdfDiscrete Structure Lecture #5 & 6.pdf
Discrete Structure Lecture #5 & 6.pdf
 
DISMATH_Part1
DISMATH_Part1DISMATH_Part1
DISMATH_Part1
 
1. Logic and Proofs.ppt
1. Logic and Proofs.ppt1. Logic and Proofs.ppt
1. Logic and Proofs.ppt
 
Predicates and quantifiers presentation topics
Predicates  and quantifiers  presentation topicsPredicates  and quantifiers  presentation topics
Predicates and quantifiers presentation topics
 

Recently uploaded

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

1019Lec1.ppt

  • 1. 1 Math/CSE 1019C: Discrete Mathematics for Computer Science Fall 2011 Suprakash Datta datta@cse.yorku.ca Office: CSEB 3043 Phone: 416-736-2100 ext 77875 Course page: http://www.cse.yorku.ca/course/1019
  • 2. 2 Administrivia Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition. McGraw Hill, 2012. Lectures: Tu-Th 10:00-11:30 am (CLH E) Exams: 3 tests (45%), final (40%) Homework (15%): equally divided between several assignments. Slides: should be available after the class Office hours: Wed 3-5 pm or by appointment at CSEB 3043. Textbook:
  • 3. 3 Administrivia – contd. • Cheating will not be tolerated. Visit the class webpage for more details on policies. • TA: Tutorials/office hours TBA. • HW submitted late will not be graded.
  • 4. 4 Course objectives We will focus on two major goals: • Basic tools and techniques in discrete mathematics – Propositional logic – Set Theory – Simple algorithms – Induction, recursion – Counting techniques (Combinatorics) • Precise and rigorous mathematical reasoning – Writing proofs
  • 5. 5 To do well you should: • Study with pen and paper • Ask for help immediately • Practice, practice, practice… • Follow along in class rather than take notes • Ask questions in class • Keep up with the class • Read the book, not just the slides
  • 6. 6 Reasoning about problems • 0.999999999999999….=1? • There exists integers a,b,c that satisfy the equation a2+b2 = c2 • The program below that I wrote works correctly for all possible inputs….. • The program that I wrote never hangs (i.e. always terminates)…
  • 7. 7 Tools for reasoning: Logic Ch. 1: Introduction to Propositional Logic • Truth values, truth tables • Boolean logic:    • Implications:  
  • 8. 8 Why study propositional logic? • A formal mathematical “language” for precise reasoning. • Start with propositions. • Add other constructs like negation, conjunction, disjunction, implication etc. • All of these are based on ideas we use daily to reason about things.
  • 9. 9 Propositions • Declarative sentence • Must be either True or False. Propositions: • York University is in Toronto • York University is in downtown Toronto • All students at York are Computer Sc. majors. Not propositions: • Do you like this class? • There are x students in this class.
  • 10. 10 Propositions - 2 • Truth value: True or False • Variables: p,q,r,s,… • Negation: • p (“not p”) • Truth tables p p T F F T
  • 11. 11 Caveat: negating propositions p: “it is not the case that p is true” p: “it rained more than 20 inches in TO” p: “John has many iPads” Practice: Questions 1-7 page 12. Q10 (a) p: “the election is decided”
  • 12. 12 Conjunction, Disjunction • Conjunction: p  q [“and”] • Disjunction: p  q [“or”] p q p  q p  q T T T T T F F T F T F T F F F F
  • 13. 13 Examples • Q11, page 13 p: It is below freezing q: It is snowing (a) It is below freezing and snowing (b) It is below freezing but now snowing (d) It is either snowing or below freezing (or both)
  • 14. 14 Exclusive OR (XOR) • p  q – T if p and q have different truth values, F otherwise • Colloquially, we often use OR ambiguously – “an entrée comes with soup or salad” implies XOR, but “students can take MATH XXXX if they have taken MATH 2320 or MATH 1019” usually means the normal OR (so a student who has taken both is still eligible for MATH XXXX).
  • 15. 15 Conditional • p  q [“if p then q”] • p: hypothesis, q: conclusion • E.g.: “If you turn in a homework late, it will not be graded”; “If you get 100% in this course, you will get an A+”. • TRICKY: Is p  q TRUE if p is FALSE? YES!! • Think of “If you get 100% in this course, you will get an A+” as a promise – is the promise violated if someone gets 50% and does not receive an A+?
  • 16. 16 Conditional - 2 • p  q [“if p then q”] • Truth table: p q p  q  p  q T T T T T F F F F T T T F F T T Note the truth table of  p  q
  • 17. 17 Logical Equivalence • p  q and  p  q are logically equivalent • Truth tables are the simplest way to prove such facts. • We will learn other ways later.
  • 18. 18 Contrapositive • Contrapositive of p  q is q  p • Any conditional and its contrapositive are logically equivalent (have the same truth table) – Check by writing down the truth table. • E.g. The contrapositive of “If you get 100% in this course, you will get an A+” is “If you do not get an A+ in this course, you did not get 100%”.
  • 19. 19 E.g.: Proof using contrapositive Prove: If x2 is even, x is even • Proof 1: x2 = 2a for some integer a. Since 2 is prime, 2 must divide x. • Proof 2: if x is not even, x is odd. Therefore x2 is odd. This is the contrapositive of the original assertion.
  • 20. 20 Converse • Converse of p  q is q  p • Not logically equivalent to conditional • Ex 1: “If you get 100% in this course, you will get an A+” and “If you get an A+ in this course, you scored 100%” are not equivalent. • Ex 2: If you won the lottery, you are rich.
  • 21. 21 Other conditionals Inverse: • inverse of p  q is p  q • How is this related to the converse? Biconditional: • “If and only if” • True if p,q have same truth values, false otherwise. Q: How is this related to XOR? • Can also be defined as (p  q)  (q  p)
  • 22. 22 Example • Q16(c) 1+1=3 if and only if monkeys can fly.
  • 23. 23 Readings and notes • Read pages 1-12. • Think about the notion of truth tables. • Master the rationale behind the definition of conditionals. • Practice translating English sentences to propositional logic statements.
  • 24. 24 Next Ch. 1.2, 1.3: Propositional Logic - contd – Compound propositions, precedence rules – Tautologies and logical equivalences – Read only the first section called “Translating English Sentences” in 1.2.
  • 25. 25 Compound Propositions • Example: p  q  r : Could be interpreted as (p  q)  r or p  (q  r) • precedence order:      (IMP!) (Overruled by brackets) • We use this order to compute truth values of compound propositions.
  • 26. 26 Tautology • A compound proposition that is always TRUE, e.g. q  q • Logical equivalence redefined: p,q are logical equivalences if p  q is a tautology. Symbolically p  q. • Intuition: p  q is true precisely when p,q have the same truth values.
  • 27. 27 Manipulating Propositions • Compound propositions can be simplified by using simple rules. • Read page 25 - 28. • Some are obvious, e.g. Identity, Domination, Idempotence, double negation, commutativity, associativity • Less obvious: Distributive, De Morgan’s laws, Absorption
  • 28. 28 Distributive Laws p  (q  r)  (p  q)  (p  r) Intuition (not a proof!) – For the LHS to be true: p must be true and q or r must be true. This is the same as saying p and q must be true or p and r must be true. p  (q  r)  (p  q)  (p  r) Intuition (less obvious) – For the LHS to be true: p must be true or both q and r must be true. This is the same as saying p or q must be true and p or r must be true. Proof: use truth tables.
  • 29. 29 De Morgan’s Laws (q  r)  q  r Intuition – For the LHS to be true: neither q nor r can be true. This is the same as saying q and r must be false. (q  r)  q  r Intuition – For the LHS to be true: q  r must be false. This is the same as saying q or r must be false. Proof: use truth tables.
  • 30. 30 Using the laws • Q: Is p  (p  q) a tautology? • Can use truth tables • Can write a compound proposition and simplify
  • 31. 31 Limitations of Propositional Logic • What can we NOT express using predicates? Ex: How do you make a statement about all even integers? If x >2 then x2 >4 • A more general language: Predicate logic (Sec 1.4)
  • 32. 32 Next: Predicate Logic Ch 1.4 –Predicates and quantifiers –Rules of Inference
  • 33. 33 Predicate Logic • A predicate is a proposition that is a function of one or more variables. E.g.: P(x): x is an even number. So P(1) is false, P(2) is true,…. • Examples of predicates: – Domain ASCII characters - IsAlpha(x) : TRUE iff x is an alphabetical character. – Domain floating point numbers - IsInt(x): TRUE iff x is an integer. – Domain integers: Prime(x) - TRUE if x is prime, FALSE otherwise.
  • 34. 34 Quantifiers • describes the values of a variable that make the predicate true. E.g. x P(x) • Domain or universe: range of values of a variable (sometimes implicit)
  • 35. 35 Two Popular Quantifiers • Universal: x P(x) – “P(x) for all x in the domain” • Existential: x P(x) – “P(x) for some x in the domain” or “there exists x such that P(x) is TRUE”. • Either is meaningless if the domain is not known/specified. • Examples (domain real numbers) – x (x2 >= 0) – x (x >1) – (x>1) (x2 > x) – quantifier with restricted domain
  • 36. 36 Using Quantifiers Domain integers: • Using implications: The cube of all negative integers is negative. x (x < 0) (x3 < 0) • Expressing sums : n n ( i = n(n+1)/2) i=1 Aside: summation notation
  • 37. 37 Scope of Quantifiers •   have higher precedence than operators from Propositional Logic; so x P(x)  Q(x) is not logically equivalent to x (P(x)  Q(x)) •  x (P(x)  Q(x))  x R(x) Say P(x): x is odd, Q(x): x is divisible by 3, R(x): (x=0) (2x >x) • Logical Equivalence: P  Q iff they have same truth value no matter which domain is used and no matter which predicates are assigned to predicate variables.
  • 38. 38 Negation of Quantifiers • “There is no student who can …” • “Not all professors are bad….” • “There is no Toronto Raptor that can dunk like Vince …” •  x P(x)   x P(x) why? •   x P(x)   x P(x) • Careful: The negation of “Every Canadian loves Hockey” is NOT “No Canadian loves Hockey”! Many, many students make this mistake!
  • 39. 39 Nested Quantifiers • Allows simultaneous quantification of many variables. • E.g. – domain integers,  x  y  z x2 + y2 = z2 • n  x  y  z xn + yn = zn (Fermat’s Last Theorem) • Domain real numbers: x  y  z (x < z < y)  (y < z < x) Is this true?
  • 40. 40 Nested Quantifiers - 2 x y (x + y = 0) is true over the integers • Assume an arbitrary integer x. • To show that there exists a y that satisfies the requirement of the predicate, choose y = -x. Clearly y is an integer, and thus is in the domain. • So x + y = x + (-x) = x – x = 0. • Since we assumed nothing about x (other than it is an integer), the argument holds for any integer x. • Therefore, the predicate is TRUE.
  • 41. 41 Nested Quantifiers - 3 • Caveat: In general, order matters! Consider the following propositions over the integer domain: x y (x < y) and y x (x < y) • x y (x < y) : “there is no maximum integer” • y x (x < y) : “there is a maximum integer” • Not the same meaning at all!!!