SlideShare a Scribd company logo
1 of 39
CSE115/ENGR160 Discrete Mathematics
01/17/12
Ming-Hsuan Yang
UC Merced
1
CSE 115/ENGR 160
• Instructor: Ming-Hsuan Yang (mhyang@ucmerced.edu)
• Teaching assistant: Jime Yang (jyang44@ucmerced.edu) and
Chih-Yuan Yang (cyang35@ucmerced.edu)
• Lectures:
– KL 217, Tuesday/Thursday 4:30 pm to 5:45 pm
• Labs:
– SE 138, Monday 8:00 am to 10:50 am (CSE115-02L), Wednesday 1:00
pm to 3:50 pm (CSE115-03L)
• Web site: http://faculty.ucmerced.edu/mhyang/course/cse115
2
Office hours
• Office hours:
– Wednesday 3:00 pm – 4:00 pm
– SE 258
• TA hours
– Monday 8:00 am to 10:50 am, Wednesday 1:00
pm to 3:50 pm
– SE 138
3
Course goals
• Mathematical reasoning
– Logic, inference, proof
• Combinatorial analysis
– Count and enumerate objects
• Discrete structures
– Sets, sequences, functions, graphs, trees, relations
• Algorithmic reasoning
– Specifications and verifications
• Applications and modeling
– Internet, business, artificial intelligence, etc.
4
Topics
• Logic
• Proof
• Sets
• Functions
• Number theory
• Counting
• Relations
• Graph
• Boolean algebra
5
Textbook
• Discrete Mathematics and Its Applications
by Kenneth H. Rosen, 7th edition, McGraw Hill
6
Prerequisite
• Upper division standing
• Basic knowledge of calculus (MATH 21 and
MATH 22)
• Basic knowledge in computer science
7
Grading
• 5% Class participation
• 25% Homework
• 20% Four quizzes
• 20% Two midterms
• 30% Final
8
Class policy
• Do not use computers or smart phones in
class
• All the lecture notes will be posted on the
class web
• Weekly homework assigned on Thursday and
due in the following Thursday in class
• Must be your own work
• Homework returned in class
9
1.1 Propositional logic
• Understand and construct correct
mathematical arguments
• Give precise meaning to mathematical
statements
• Rules are used to distinguish between valid
(true) and invalid arguments
• Used in numerous applications: circuit design,
programs, verification of correctness of
programs, artificial intelligence, etc.
10
Proposition
• A declarative sentence that is either true or
false, but not both
– Washington, D.C., is the capital of USA
– California is adjacent to New York
– 1+1=2
– 2+2=5
– What time is it?
– Read this carefully
11
Logical operators
• Negation operator
• Conjunction (and, ^)
• Disjunction (or v )
• Conditional statement 
• Biconditional statement 
• Exclusive Or
12
Negation
13
Example
• “Today is Friday”
– It is not the case that today is Friday
– Today is not Friday
• At least 10 inches of rain fell today in Miami
– It is not the case that at least 10 inches of rain fell
today in Miami
– Less than 10 inches of rain fell today in Miami
14
Conjunction
15
Conjunction: p ^ q is true when both p and q are
true. False otherwise
Example
• p: “Today is Friday”, q: “It is raining today”
• p˄q “Today is Friday and it is raining today”
– true: on rainy Fridays
– false otherwise:
• Any day that is not a Friday
• Fridays when it does not rain
16
Disjunction
17
Disjunction: p v q is false when both p and q are
false. True otherwise
Example
• p ˅ q: “Today is Friday or it is raining today”
– True:
• Today is Friday
• It is raining today
• It is a rainy Friday
– False
• Today is not Friday and it does not rain
18
Exclusive or
19
Exclusive Or is true when exactly one
of p, q is true. False otherwise
Conditional statement
20
Conditional Statement:
• p is called the premise (or antecedent) and q is
called the conclusion (or consequent)
• p q is false when p is true and q is false. True
otherwise
Conditional statement pq
• Also called an implication
21
if p, then q p implies q
if p, q p only if q
p is sufficient for q a sufficient condition for q is p
q if p q whenever p
q when p q is necessary for p
a necessary condition for p is q
q unless ┐ p
q follows from p
Conditional Statement: pq is false when p is true and q is
false. True otherwise
Example
p: you go, q: I go. pq means “If you go, then I go” is
equivalent to p only if q “You go only if I go” (not the same as
“I go only if you go” which is q only if p)
pq
• p only if q:
– p cannot be true when q is not true
– The statement is false if p is true but q is
false
– When p is false, q may be either true or
false
– Not to use “q only if p” to express pq
• q unless ┐ p
– If ┐ p is false, then q must be true
– The statement is false when p is true but q
is false, but the statement is true otherwise
22
Example
• If Maria learns discrete mathematics, then she
will find a good job
– Maria will find a good job when she learns
discrete mathematics (q when p)
– For Maria to get a good job, it is sufficient for her
to learn discrete mathematics (sufficient condition
for q is p)
– Maria will find a good job unless she does not
learn discrete mathematics (q unless not p)
23
Common mistake for pq
• Correct: p only if q
• Mistake to think “q only if p”
24
Example
• “If today is Friday, then 2+3=6”
– The statement is true every day except Friday
even though 2+3=6 is false
25
Converse, contrapositive and
inverse
• For conditional statement p q
– Converse: q p
– Contrapositive: ┐q  ┐ p
– Inverse: ┐p  ┐ q
• Contrapositive and conditional statements are
equivalent
26
Biconditional statement
27
• Biconditional Statement: “p if and only if q”
• p  q is true when p, q have the same truth
value. False otherwise
• Also known as bi-implications
Example
• P: “you can take the flight”, q: “you buy a
ticket”
• P  q: “You can take the flight if and only if
you buy a ticket”
– This statement is true
• If you buy a ticket and take the flight
• If you do not buy a ticket and you cannot take the flight
28
Truth table of compound propositions
29
Precedence of logic operators
30
Bit operations
31
1.2 Translating English to logical
expressions
Why?
English is often ambiguous and translating
sentences into compound propositions
removes the ambiguity
Using logical expressions, we can analyze them
and determine their truth values
We can use rules of inferences to reason about
them
32
Example
“ You can access the internet from campus only
if you are a computer science major or you are
not a freshman.
p : “You can access the internet from campus”
q : “You are a computer science major”
r : “You are freshmen”
p  ( q v ┐r )
33
System specification
• Translating sentences in natural language into
logical expressions is an essential part of
specifying both hardware and software
systems.
• Consistency of system specification.
• Example: Express the specification “The
automated reply cannot be sent when the file
system is full”
34
Example
1. Let p denote “The automated reply can be
sent”
2. Let q denote “The file system is full”
The logical expression for the sentence “The
automated reply cannot be sent when the
file system is full” is
35
Example
Determine whether these system specifications
are consistent:
1. The diagnostic message is stored in the
buffer or it is retransmitted.
2. The diagnostic message is not stored in the
buffer.
3. If the diagnostic message is stored in the
buffer, then it is retransmitted.
36
Example
• Let p denote “The diagnostic message is
stored in the buffer”
• Let q denote “The diagnostic message is
retransmitted”
The three specifications are
37
Example
• If we add one more requirement “The
diagnostic message is not retransmitted”
The new specifications now are
38
This is inconsistent! No truth values of p and q will
make all the above statements true
Logic gates
39

More Related Content

Similar to lecture011712 (1).ppt

unit1rulesofinference-170113152312.pdf
unit1rulesofinference-170113152312.pdfunit1rulesofinference-170113152312.pdf
unit1rulesofinference-170113152312.pdf
BhanuCharan9
 
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
Moshe Vardi
 

Similar to lecture011712 (1).ppt (20)

DM 1.pptx
DM 1.pptxDM 1.pptx
DM 1.pptx
 
unit1rulesofinference-170113152312.pdf
unit1rulesofinference-170113152312.pdfunit1rulesofinference-170113152312.pdf
unit1rulesofinference-170113152312.pdf
 
Unit 1 rules of inference
Unit 1  rules of inferenceUnit 1  rules of inference
Unit 1 rules of inference
 
PropositionalLogic.ppt
PropositionalLogic.pptPropositionalLogic.ppt
PropositionalLogic.ppt
 
Mathematical Reasoning DM
Mathematical Reasoning DMMathematical Reasoning DM
Mathematical Reasoning DM
 
CSE-203 Lec_1.pptx
CSE-203 Lec_1.pptxCSE-203 Lec_1.pptx
CSE-203 Lec_1.pptx
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
 
Knowledge base artificial intelligence.pdf
Knowledge base  artificial intelligence.pdfKnowledge base  artificial intelligence.pdf
Knowledge base artificial intelligence.pdf
 
02-boolean.ppt
02-boolean.ppt02-boolean.ppt
02-boolean.ppt
 
Discrete mathematics Chapter1 presentation.ppt
Discrete mathematics Chapter1 presentation.pptDiscrete mathematics Chapter1 presentation.ppt
Discrete mathematics Chapter1 presentation.ppt
 
Discrete mathematics suraj ppt
Discrete mathematics suraj pptDiscrete mathematics suraj ppt
Discrete mathematics suraj ppt
 
Basic Connectives and Truth Tables.ppt
Basic Connectives and Truth Tables.pptBasic Connectives and Truth Tables.ppt
Basic Connectives and Truth Tables.ppt
 
Lecture # 2 discrete for beginners.ppt
Lecture # 2 discrete for beginners.pptLecture # 2 discrete for beginners.ppt
Lecture # 2 discrete for beginners.ppt
 
Logic agent
Logic agentLogic agent
Logic agent
 
Inference
InferenceInference
Inference
 
4535092.ppt
4535092.ppt4535092.ppt
4535092.ppt
 
Top school in delhi ncr
Top school in delhi ncrTop school in delhi ncr
Top school in delhi ncr
 
DMS UNIT-1 ppt.pptx
DMS UNIT-1 ppt.pptxDMS UNIT-1 ppt.pptx
DMS UNIT-1 ppt.pptx
 
AI-Unit4.ppt
AI-Unit4.pptAI-Unit4.ppt
AI-Unit4.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
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Recently uploaded (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

lecture011712 (1).ppt

  • 2. CSE 115/ENGR 160 • Instructor: Ming-Hsuan Yang (mhyang@ucmerced.edu) • Teaching assistant: Jime Yang (jyang44@ucmerced.edu) and Chih-Yuan Yang (cyang35@ucmerced.edu) • Lectures: – KL 217, Tuesday/Thursday 4:30 pm to 5:45 pm • Labs: – SE 138, Monday 8:00 am to 10:50 am (CSE115-02L), Wednesday 1:00 pm to 3:50 pm (CSE115-03L) • Web site: http://faculty.ucmerced.edu/mhyang/course/cse115 2
  • 3. Office hours • Office hours: – Wednesday 3:00 pm – 4:00 pm – SE 258 • TA hours – Monday 8:00 am to 10:50 am, Wednesday 1:00 pm to 3:50 pm – SE 138 3
  • 4. Course goals • Mathematical reasoning – Logic, inference, proof • Combinatorial analysis – Count and enumerate objects • Discrete structures – Sets, sequences, functions, graphs, trees, relations • Algorithmic reasoning – Specifications and verifications • Applications and modeling – Internet, business, artificial intelligence, etc. 4
  • 5. Topics • Logic • Proof • Sets • Functions • Number theory • Counting • Relations • Graph • Boolean algebra 5
  • 6. Textbook • Discrete Mathematics and Its Applications by Kenneth H. Rosen, 7th edition, McGraw Hill 6
  • 7. Prerequisite • Upper division standing • Basic knowledge of calculus (MATH 21 and MATH 22) • Basic knowledge in computer science 7
  • 8. Grading • 5% Class participation • 25% Homework • 20% Four quizzes • 20% Two midterms • 30% Final 8
  • 9. Class policy • Do not use computers or smart phones in class • All the lecture notes will be posted on the class web • Weekly homework assigned on Thursday and due in the following Thursday in class • Must be your own work • Homework returned in class 9
  • 10. 1.1 Propositional logic • Understand and construct correct mathematical arguments • Give precise meaning to mathematical statements • Rules are used to distinguish between valid (true) and invalid arguments • Used in numerous applications: circuit design, programs, verification of correctness of programs, artificial intelligence, etc. 10
  • 11. Proposition • A declarative sentence that is either true or false, but not both – Washington, D.C., is the capital of USA – California is adjacent to New York – 1+1=2 – 2+2=5 – What time is it? – Read this carefully 11
  • 12. Logical operators • Negation operator • Conjunction (and, ^) • Disjunction (or v ) • Conditional statement  • Biconditional statement  • Exclusive Or 12
  • 14. Example • “Today is Friday” – It is not the case that today is Friday – Today is not Friday • At least 10 inches of rain fell today in Miami – It is not the case that at least 10 inches of rain fell today in Miami – Less than 10 inches of rain fell today in Miami 14
  • 15. Conjunction 15 Conjunction: p ^ q is true when both p and q are true. False otherwise
  • 16. Example • p: “Today is Friday”, q: “It is raining today” • p˄q “Today is Friday and it is raining today” – true: on rainy Fridays – false otherwise: • Any day that is not a Friday • Fridays when it does not rain 16
  • 17. Disjunction 17 Disjunction: p v q is false when both p and q are false. True otherwise
  • 18. Example • p ˅ q: “Today is Friday or it is raining today” – True: • Today is Friday • It is raining today • It is a rainy Friday – False • Today is not Friday and it does not rain 18
  • 19. Exclusive or 19 Exclusive Or is true when exactly one of p, q is true. False otherwise
  • 20. Conditional statement 20 Conditional Statement: • p is called the premise (or antecedent) and q is called the conclusion (or consequent) • p q is false when p is true and q is false. True otherwise
  • 21. Conditional statement pq • Also called an implication 21 if p, then q p implies q if p, q p only if q p is sufficient for q a sufficient condition for q is p q if p q whenever p q when p q is necessary for p a necessary condition for p is q q unless ┐ p q follows from p Conditional Statement: pq is false when p is true and q is false. True otherwise Example p: you go, q: I go. pq means “If you go, then I go” is equivalent to p only if q “You go only if I go” (not the same as “I go only if you go” which is q only if p)
  • 22. pq • p only if q: – p cannot be true when q is not true – The statement is false if p is true but q is false – When p is false, q may be either true or false – Not to use “q only if p” to express pq • q unless ┐ p – If ┐ p is false, then q must be true – The statement is false when p is true but q is false, but the statement is true otherwise 22
  • 23. Example • If Maria learns discrete mathematics, then she will find a good job – Maria will find a good job when she learns discrete mathematics (q when p) – For Maria to get a good job, it is sufficient for her to learn discrete mathematics (sufficient condition for q is p) – Maria will find a good job unless she does not learn discrete mathematics (q unless not p) 23
  • 24. Common mistake for pq • Correct: p only if q • Mistake to think “q only if p” 24
  • 25. Example • “If today is Friday, then 2+3=6” – The statement is true every day except Friday even though 2+3=6 is false 25
  • 26. Converse, contrapositive and inverse • For conditional statement p q – Converse: q p – Contrapositive: ┐q  ┐ p – Inverse: ┐p  ┐ q • Contrapositive and conditional statements are equivalent 26
  • 27. Biconditional statement 27 • Biconditional Statement: “p if and only if q” • p  q is true when p, q have the same truth value. False otherwise • Also known as bi-implications
  • 28. Example • P: “you can take the flight”, q: “you buy a ticket” • P  q: “You can take the flight if and only if you buy a ticket” – This statement is true • If you buy a ticket and take the flight • If you do not buy a ticket and you cannot take the flight 28
  • 29. Truth table of compound propositions 29
  • 30. Precedence of logic operators 30
  • 32. 1.2 Translating English to logical expressions Why? English is often ambiguous and translating sentences into compound propositions removes the ambiguity Using logical expressions, we can analyze them and determine their truth values We can use rules of inferences to reason about them 32
  • 33. Example “ You can access the internet from campus only if you are a computer science major or you are not a freshman. p : “You can access the internet from campus” q : “You are a computer science major” r : “You are freshmen” p  ( q v ┐r ) 33
  • 34. System specification • Translating sentences in natural language into logical expressions is an essential part of specifying both hardware and software systems. • Consistency of system specification. • Example: Express the specification “The automated reply cannot be sent when the file system is full” 34
  • 35. Example 1. Let p denote “The automated reply can be sent” 2. Let q denote “The file system is full” The logical expression for the sentence “The automated reply cannot be sent when the file system is full” is 35
  • 36. Example Determine whether these system specifications are consistent: 1. The diagnostic message is stored in the buffer or it is retransmitted. 2. The diagnostic message is not stored in the buffer. 3. If the diagnostic message is stored in the buffer, then it is retransmitted. 36
  • 37. Example • Let p denote “The diagnostic message is stored in the buffer” • Let q denote “The diagnostic message is retransmitted” The three specifications are 37
  • 38. Example • If we add one more requirement “The diagnostic message is not retransmitted” The new specifications now are 38 This is inconsistent! No truth values of p and q will make all the above statements true