SlideShare a Scribd company logo
Spring 2003 CMSC 203 - Discrete Structures 1
Let’s get started with...
Logic!
Spring 2003 CMSC 203 - Discrete Structures 2
Logic
• Crucial for mathematical reasoning
• Important for program design
• Used for designing electronic circuitry
• (Propositional )Logic is a system based on
propositions.
• A proposition is a (declarative) statement
that is either true or false (not both).
• We say that the truth value of a proposition
is either true (T) or false (F).
• Corresponds to 1 and 0 in digital circuits
Spring 2003 CMSC 203 - Discrete Structures 3
The Statement/Proposition Game
“Elephants are bigger than mice.”
Is this a statement? yes
Is this a proposition? yes
What is the truth value
of the proposition? true
Spring 2003 CMSC 203 - Discrete Structures 4
The Statement/Proposition Game
“520 < 111”
Is this a statement? yes
Is this a proposition? yes
What is the truth value
of the proposition? false
Spring 2003 CMSC 203 - Discrete Structures 5
The Statement/Proposition Game
“y > 5”
Is this a statement? yes
Is this a proposition? no
Its truth value depends on the value of y,
but this value is not specified.
We call this type of statement a
propositional function or open sentence.
Spring 2003 CMSC 203 - Discrete Structures 6
The Statement/Proposition Game
“Today is January 27 and 99 < 5.”
Is this a statement? yes
Is this a proposition? yes
What is the truth value
of the proposition? false
Spring 2003 CMSC 203 - Discrete Structures 7
The Statement/Proposition Game
“Please do not fall asleep.”
Is this a statement? no
Is this a proposition? no
Only statements can be propositions.
It’s a request.
Spring 2003 CMSC 203 - Discrete Structures 8
The Statement/Proposition Game
“If the moon is made of cheese,
then I will be rich.”
Is this a statement? yes
Is this a proposition? yes
What is the truth value
of the proposition? probably true
Spring 2003 CMSC 203 - Discrete Structures 9
The Statement/Proposition Game
“x < y if and only if y > x.”
Is this a statement? yes
Is this a proposition? yes
What is the truth value
of the proposition? true
… because its truth value
does not depend on
specific values of x and y.
Spring 2003 CMSC 203 - Discrete Structures 10
Combining Propositions
As we have seen in the previous examples,
one or more propositions can be combined
to form a single compound proposition.
We formalize this by denoting propositions
with letters such as p, q, r, s, and
introducing several logical operators or
logical connectives.
Spring 2003 CMSC 203 - Discrete Structures 11
Logical Operators (Connectives)
We will examine the following logical operators:
• Negation (NOT, )
• Conjunction (AND, )
• Disjunction (OR, )
• Exclusive-or (XOR,  )
• Implication (if – then, → )
• Biconditional (if and only if,  )
Truth tables can be used to show how these
operators can combine propositions to
compound propositions.
Spring 2003 CMSC 203 - Discrete Structures 12
Negation (NOT)
Unary Operator, Symbol: 
P  P
true (T) false (F)
false (F) true (T)
Spring 2003 CMSC 203 - Discrete Structures 13
Conjunction (AND)
Binary Operator, Symbol: 
P Q P Q
T T T
T F F
F T F
F F F
Spring 2003 CMSC 203 - Discrete Structures 14
Disjunction (OR)
Binary Operator, Symbol: 
P Q P  Q
T T T
T F T
F T T
F F F
Spring 2003 CMSC 203 - Discrete Structures 15
Exclusive Or (XOR)
Binary Operator, Symbol: 
P Q PQ
T T F
T F T
F T T
F F F
Spring 2003 CMSC 203 - Discrete Structures 16
Implication (if - then)
Binary Operator, Symbol: →
P Q P→Q
T T T
T F F
F T T
F F T
Spring 2003 CMSC 203 - Discrete Structures 17
Biconditional (if and only if)
Binary Operator, Symbol: 
P Q PQ
T T T
T F F
F T F
F F T
Spring 2003 CMSC 203 - Discrete Structures 18
Statements and Operators
Statements and operators can be combined in any
way to form new statements.
P Q P Q (P)(Q)
T T F F F
T F F T T
F T T F T
F F T T T
Spring 2003 CMSC 203 - Discrete Structures 19
Statements and Operations
Statements and operators can be combined in any
way to form new statements.
P Q PQ (PQ) (P)(Q)
T T T F F
T F F T T
F T F T T
F F F T T
Spring 2003 CMSC 203 - Discrete Structures 20
Exercises
• To take discrete mathematics, you must have
taken calculus or a course in computer science.
• When you buy a new car from Acme Motor
Company, you get $2000 back in cash or a 2%
car loan.
• School is closed if more than 2 feet of snow
falls or if the wind chill is below -100.
Spring 2003 CMSC 203 - Discrete Structures 21
Exercises
– P: take discrete mathematics
– Q: take calculus
– R: take a course in computer science
• P → Q  R
• Problem with proposition R
– What if I want to represent “take CMSC201”?
• To take discrete mathematics, you must have
taken calculus or a course in computer science.
Spring 2003 CMSC 203 - Discrete Structures 22
Exercises
– P: buy a car from Acme Motor Company
– Q: get $2000 cash back
– R: get a 2% car loan
• P → Q  R
• Why use XOR here? – example of ambiguity of
natural languages
• When you buy a new car from Acme Motor
Company, you get $2000 back in cash or a 2%
car loan.
Spring 2003 CMSC 203 - Discrete Structures 23
Exercises
– P: School is closed
– Q: 2 feet of snow falls
– R: wind chill is below -100
• Q  R → P
• Precedence among operators:
, , , →, 
• School is closed if more than 2 feet of snow
falls or if the wind chill is below -100.
Spring 2003 CMSC 203 - Discrete Structures 24
Equivalent Statements
P Q (PQ) (P)(Q) (PQ)(P)(Q)
T T F F T
T F T T T
F T T T T
F F T T T
The statements (PQ) and (P)  (Q) are logically
equivalent, since they have the same truth table, or put
it in another way, (PQ) (P)  (Q) is always true.
Spring 2003 CMSC 203 - Discrete Structures 25
Tautologies and Contradictions
A tautology is a statement that is always true.
Examples:
– R(R)
– (PQ)  (P)( Q)
A contradiction is a statement that is always false.
Examples:
– R(R)
– ((P  Q)  (P)  (Q))
The negation of any tautology is a contradiction, and
the negation of any contradiction is a tautology.
Spring 2003 CMSC 203 - Discrete Structures 26
Equivalence
Definition: two propositional statements
S1 and S2 are said to be (logically)
equivalent, denoted S1  S2 if
– They have the same truth table, or
– S1  S2 is a tautology
Equivalence can be established by
– Constructing truth tables
– Using equivalence laws (Table 5 in Section 1.2)
Spring 2003 CMSC 203 - Discrete Structures 27
Equivalence
Equivalence laws
– Identity laws, P  T  P,
– Domination laws, P  F  F,
– Idempotent laws, P  P  P,
– Double negation law,  ( P)  P
– Commutative laws, P  Q  Q  P,
– Associative laws, P  (Q  R) (P  Q)  R,
– Distributive laws, P  (Q  R) (P  Q)  (P  R),
– De Morgan’s laws,  (PQ)  ( P)  ( Q)
– Law with implication P → Q   P  Q
Spring 2003 CMSC 203 - Discrete Structures 28
Exercises
• Show that P → Q   P  Q: by truth table
• Show that (P → Q)  (P → R)  P → (Q  R):
by equivalence laws (q20, p27):
– Law with implication on both sides
– Distribution law on LHS
Spring 2003 CMSC 203 - Discrete Structures 29
Summary, Sections 1.1, 1.2
• Proposition
– Statement, Truth value,
– Proposition, Propositional symbol, Open proposition
• Operators
– Define by truth tables
– Composite propositions
– Tautology and contradiction
• Equivalence of propositional statements
– Definition
– Proving equivalence (by truth table or equivalence
laws)
Spring 2003 CMSC 203 - Discrete Structures 30
Propositional Functions & Predicates
Propositional function (open sentence):
statement involving one or more variables,
e.g.: x-3 > 5.
Let us call this propositional function P(x),
where P is the predicate and x is the variable.
What is the truth value of P(2) ? false
What is the truth value of P(8) ?
What is the truth value of P(9) ?
false
true
When a variable is given a value, it is said to be
instantiated
Truth value depends on value of variable
Spring 2003 CMSC 203 - Discrete Structures 31
Propositional Functions
Let us consider the propositional function
Q(x, y, z) defined as:
x + y = z.
Here, Q is the predicate and x, y, and z are the
variables.
What is the truth value of Q(2, 3, 5) ? true
What is the truth value of Q(0, 1, 2) ?
What is the truth value of Q(9, -9, 0) ?
false
true
A propositional function (predicate) becomes a
proposition when all its variables are instantiated.
Spring 2003 CMSC 203 - Discrete Structures 32
Propositional Functions
Other examples of propositional functions
Person(x), which is true if x is a person
Person(Socrates) = T
CSCourse(x), which is true if x is a
computer science course
CSCourse(CMSC201) = T
Person(dolly-the-sheep) = F
CSCourse(MATH155) = F
How do we say
All humans are mortal
One CS course
Spring 2003 CMSC 203 - Discrete Structures 33
Universal Quantification
Let P(x) be a predicate (propositional function).
Universally quantified sentence:
For all x in the universe of discourse P(x) is true.
Using the universal quantifier :
x P(x) “for all x P(x)” or “for every x P(x)”
(Note: x P(x) is either true or false, so it is a
proposition, not a propositional function.)
Spring 2003 CMSC 203 - Discrete Structures 34
Universal Quantification
Example: Let the universe of discourse be all
people
S(x): x is a UMBC student.
G(x): x is a genius.
What does x (S(x) → G(x)) mean ?
“If x is a UMBC student, then x is a genius.” or
“All UMBC students are geniuses.”
If the universe of discourse is all UMBC students,
then the same statement can be written as
x G(x)
Spring 2003 CMSC 203 - Discrete Structures 35
Existential Quantification
Existentially quantified sentence:
There exists an x in the universe of discourse
for which P(x) is true.
Using the existential quantifier :
x P(x) “There is an x such that P(x).”
“There is at least one x such that P(x).”
(Note: x P(x) is either true or false, so it is a
proposition, but no propositional function.)
Spring 2003 CMSC 203 - Discrete Structures 36
Existential Quantification
Example:
P(x): x is a UMBC professor.
G(x): x is a genius.
What does x (P(x)  G(x)) mean ?
“There is an x such that x is a UMBC professor
and x is a genius.”
or
“At least one UMBC professor is a genius.”
Spring 2003 CMSC 203 - Discrete Structures 37
Quantification
Another example:
Let the universe of discourse be the real numbers.
What does xy (x + y = 320) mean ?
“For every x there exists a y so that x + y = 320.”
Is it true?
Is it true for the natural numbers?
yes
no
Spring 2003 CMSC 203 - Discrete Structures 38
Disproof by Counterexample
A counterexample to x P(x) is an object c so
that P(c) is false.
Statements such as x (P(x) → Q(x)) can be
disproved by simply providing a counterexample.
Statement: “All birds can fly.”
Disproved by counterexample: Penguin.
Spring 2003 CMSC 203 - Discrete Structures 39
Negation
(x P(x)) is logically equivalent to x (P(x)).
(x P(x)) is logically equivalent to x (P(x)).
See Table 2 in Section 1.3.
This is de Morgan’s law for quantifiers
Spring 2003 CMSC 203 - Discrete Structures 40
Negation
Examples
Not all roses are red
x (Rose(x) → Red(x))
x (Rose(x)  Red(x))
Nobody is perfect
x (Person(x)  Perfect(x))
x (Person(x) → Perfect(x))
Spring 2003 CMSC 203 - Discrete Structures 41
Nested Quantifier
A predicate can have more than one variables.
– S(x, y, z): z is the sum of x and y
– F(x, y): x and y are friends
We can quantify individual variables in different
ways
– x, y, z (S(x, y, z) → (x <= z  y <= z))
– x y z (F(x, y)  F(x, z)  (y != z) → F(y, z)
Spring 2003 CMSC 203 - Discrete Structures 42
Nested Quantifier
Exercise: translate the following English
sentence into logical expression
“There is a rational number in between every
pair of distinct rational numbers”
Use predicate Q(x), which is true when x
is a rational number
x,y (Q(x)  Q (y)  (x < y) →
u (Q(u)  (x < u)  (u < y)))
Spring 2003 CMSC 203 - Discrete Structures 43
Summary, Sections 1.3, 1.4
• Propositional functions (predicates)
• Universal and existential quantifiers,
and the duality of the two
• When predicates become propositions
– All of its variables are instantiated
– All of its variables are quantified
• Nested quantifiers
– Quantifiers with negation
• Logical expressions formed by
predicates, operators, and quantifiers

More Related Content

Similar to Ch01-1.pdf

Ch7 slides
Ch7 slidesCh7 slides
Ch7 slides
fentaw leykun
 
Lecture 01.ppt
Lecture 01.pptLecture 01.ppt
Lecture 01.ppt
VinhQuang898733
 
Discrete Structures lecture 2
 Discrete Structures lecture 2 Discrete Structures lecture 2
Discrete Structures lecture 2
Ali Usman
 
Type and proof structures for concurrency
Type and proof structures for concurrencyType and proof structures for concurrency
Type and proof structures for concurrency
Facultad de Informática UCM
 
Logic DM
Logic DMLogic DM
Big oh Representation Used in Time complexities
Big oh Representation Used in Time complexitiesBig oh Representation Used in Time complexities
Big oh Representation Used in Time complexities
LAKSHMITHARUN PONNAM
 
Notes discrete math
Notes discrete mathNotes discrete math
Notes discrete math
liyana31
 
Infinite and Standard Computation with Unconventional and Quantum Methods Usi...
Infinite and Standard Computation with Unconventional and Quantum Methods Usi...Infinite and Standard Computation with Unconventional and Quantum Methods Usi...
Infinite and Standard Computation with Unconventional and Quantum Methods Usi...
Konstantinos Giannakis
 
Logic
LogicLogic
Large-scale computation without sacrificing expressiveness
Large-scale computation without sacrificing expressivenessLarge-scale computation without sacrificing expressiveness
Large-scale computation without sacrificing expressiveness
Sangjin Han
 
Slides ensae-2016-9
Slides ensae-2016-9Slides ensae-2016-9
Slides ensae-2016-9
Arthur Charpentier
 
Poggi analytics - star - 1a
Poggi   analytics - star - 1aPoggi   analytics - star - 1a
Poggi analytics - star - 1a
Gaston Liberman
 
Lecture notes in_discrete_mathematics
Lecture notes in_discrete_mathematicsLecture notes in_discrete_mathematics
Lecture notes in_discrete_mathematics
saiful26baiust
 
DMS UNIT-1 ppt.pptx
DMS UNIT-1 ppt.pptxDMS UNIT-1 ppt.pptx
DMS UNIT-1 ppt.pptx
DrMadhavaReddyCh
 
AIOU Code 1349 Solved Assignment 2 Autumn 2022.pptx
AIOU Code 1349 Solved Assignment 2 Autumn 2022.pptxAIOU Code 1349 Solved Assignment 2 Autumn 2022.pptx
AIOU Code 1349 Solved Assignment 2 Autumn 2022.pptx
Zawarali786
 
3_MLE_printable.pdf
3_MLE_printable.pdf3_MLE_printable.pdf
3_MLE_printable.pdf
Elio Laureano
 
Euler lagrange equations of motion mit-holonomic constraints_lecture7
Euler lagrange equations of motion  mit-holonomic  constraints_lecture7Euler lagrange equations of motion  mit-holonomic  constraints_lecture7
Euler lagrange equations of motion mit-holonomic constraints_lecture7
JOHN OBIDI
 
Machine learning (11)
Machine learning (11)Machine learning (11)
Machine learning (11)
NYversity
 
Slides ensae 9
Slides ensae 9Slides ensae 9
Slides ensae 9
Arthur Charpentier
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
IT Engineering Department
 

Similar to Ch01-1.pdf (20)

Ch7 slides
Ch7 slidesCh7 slides
Ch7 slides
 
Lecture 01.ppt
Lecture 01.pptLecture 01.ppt
Lecture 01.ppt
 
Discrete Structures lecture 2
 Discrete Structures lecture 2 Discrete Structures lecture 2
Discrete Structures lecture 2
 
Type and proof structures for concurrency
Type and proof structures for concurrencyType and proof structures for concurrency
Type and proof structures for concurrency
 
Logic DM
Logic DMLogic DM
Logic DM
 
Big oh Representation Used in Time complexities
Big oh Representation Used in Time complexitiesBig oh Representation Used in Time complexities
Big oh Representation Used in Time complexities
 
Notes discrete math
Notes discrete mathNotes discrete math
Notes discrete math
 
Infinite and Standard Computation with Unconventional and Quantum Methods Usi...
Infinite and Standard Computation with Unconventional and Quantum Methods Usi...Infinite and Standard Computation with Unconventional and Quantum Methods Usi...
Infinite and Standard Computation with Unconventional and Quantum Methods Usi...
 
Logic
LogicLogic
Logic
 
Large-scale computation without sacrificing expressiveness
Large-scale computation without sacrificing expressivenessLarge-scale computation without sacrificing expressiveness
Large-scale computation without sacrificing expressiveness
 
Slides ensae-2016-9
Slides ensae-2016-9Slides ensae-2016-9
Slides ensae-2016-9
 
Poggi analytics - star - 1a
Poggi   analytics - star - 1aPoggi   analytics - star - 1a
Poggi analytics - star - 1a
 
Lecture notes in_discrete_mathematics
Lecture notes in_discrete_mathematicsLecture notes in_discrete_mathematics
Lecture notes in_discrete_mathematics
 
DMS UNIT-1 ppt.pptx
DMS UNIT-1 ppt.pptxDMS UNIT-1 ppt.pptx
DMS UNIT-1 ppt.pptx
 
AIOU Code 1349 Solved Assignment 2 Autumn 2022.pptx
AIOU Code 1349 Solved Assignment 2 Autumn 2022.pptxAIOU Code 1349 Solved Assignment 2 Autumn 2022.pptx
AIOU Code 1349 Solved Assignment 2 Autumn 2022.pptx
 
3_MLE_printable.pdf
3_MLE_printable.pdf3_MLE_printable.pdf
3_MLE_printable.pdf
 
Euler lagrange equations of motion mit-holonomic constraints_lecture7
Euler lagrange equations of motion  mit-holonomic  constraints_lecture7Euler lagrange equations of motion  mit-holonomic  constraints_lecture7
Euler lagrange equations of motion mit-holonomic constraints_lecture7
 
Machine learning (11)
Machine learning (11)Machine learning (11)
Machine learning (11)
 
Slides ensae 9
Slides ensae 9Slides ensae 9
Slides ensae 9
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
 

Recently uploaded

2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 

Recently uploaded (20)

2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 

Ch01-1.pdf

  • 1. Spring 2003 CMSC 203 - Discrete Structures 1 Let’s get started with... Logic!
  • 2. Spring 2003 CMSC 203 - Discrete Structures 2 Logic • Crucial for mathematical reasoning • Important for program design • Used for designing electronic circuitry • (Propositional )Logic is a system based on propositions. • A proposition is a (declarative) statement that is either true or false (not both). • We say that the truth value of a proposition is either true (T) or false (F). • Corresponds to 1 and 0 in digital circuits
  • 3. Spring 2003 CMSC 203 - Discrete Structures 3 The Statement/Proposition Game “Elephants are bigger than mice.” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? true
  • 4. Spring 2003 CMSC 203 - Discrete Structures 4 The Statement/Proposition Game “520 < 111” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? false
  • 5. Spring 2003 CMSC 203 - Discrete Structures 5 The Statement/Proposition Game “y > 5” Is this a statement? yes Is this a proposition? no Its truth value depends on the value of y, but this value is not specified. We call this type of statement a propositional function or open sentence.
  • 6. Spring 2003 CMSC 203 - Discrete Structures 6 The Statement/Proposition Game “Today is January 27 and 99 < 5.” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? false
  • 7. Spring 2003 CMSC 203 - Discrete Structures 7 The Statement/Proposition Game “Please do not fall asleep.” Is this a statement? no Is this a proposition? no Only statements can be propositions. It’s a request.
  • 8. Spring 2003 CMSC 203 - Discrete Structures 8 The Statement/Proposition Game “If the moon is made of cheese, then I will be rich.” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? probably true
  • 9. Spring 2003 CMSC 203 - Discrete Structures 9 The Statement/Proposition Game “x < y if and only if y > x.” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? true … because its truth value does not depend on specific values of x and y.
  • 10. Spring 2003 CMSC 203 - Discrete Structures 10 Combining Propositions As we have seen in the previous examples, one or more propositions can be combined to form a single compound proposition. We formalize this by denoting propositions with letters such as p, q, r, s, and introducing several logical operators or logical connectives.
  • 11. Spring 2003 CMSC 203 - Discrete Structures 11 Logical Operators (Connectives) We will examine the following logical operators: • Negation (NOT, ) • Conjunction (AND, ) • Disjunction (OR, ) • Exclusive-or (XOR,  ) • Implication (if – then, → ) • Biconditional (if and only if,  ) Truth tables can be used to show how these operators can combine propositions to compound propositions.
  • 12. Spring 2003 CMSC 203 - Discrete Structures 12 Negation (NOT) Unary Operator, Symbol:  P  P true (T) false (F) false (F) true (T)
  • 13. Spring 2003 CMSC 203 - Discrete Structures 13 Conjunction (AND) Binary Operator, Symbol:  P Q P Q T T T T F F F T F F F F
  • 14. Spring 2003 CMSC 203 - Discrete Structures 14 Disjunction (OR) Binary Operator, Symbol:  P Q P  Q T T T T F T F T T F F F
  • 15. Spring 2003 CMSC 203 - Discrete Structures 15 Exclusive Or (XOR) Binary Operator, Symbol:  P Q PQ T T F T F T F T T F F F
  • 16. Spring 2003 CMSC 203 - Discrete Structures 16 Implication (if - then) Binary Operator, Symbol: → P Q P→Q T T T T F F F T T F F T
  • 17. Spring 2003 CMSC 203 - Discrete Structures 17 Biconditional (if and only if) Binary Operator, Symbol:  P Q PQ T T T T F F F T F F F T
  • 18. Spring 2003 CMSC 203 - Discrete Structures 18 Statements and Operators Statements and operators can be combined in any way to form new statements. P Q P Q (P)(Q) T T F F F T F F T T F T T F T F F T T T
  • 19. Spring 2003 CMSC 203 - Discrete Structures 19 Statements and Operations Statements and operators can be combined in any way to form new statements. P Q PQ (PQ) (P)(Q) T T T F F T F F T T F T F T T F F F T T
  • 20. Spring 2003 CMSC 203 - Discrete Structures 20 Exercises • To take discrete mathematics, you must have taken calculus or a course in computer science. • When you buy a new car from Acme Motor Company, you get $2000 back in cash or a 2% car loan. • School is closed if more than 2 feet of snow falls or if the wind chill is below -100.
  • 21. Spring 2003 CMSC 203 - Discrete Structures 21 Exercises – P: take discrete mathematics – Q: take calculus – R: take a course in computer science • P → Q  R • Problem with proposition R – What if I want to represent “take CMSC201”? • To take discrete mathematics, you must have taken calculus or a course in computer science.
  • 22. Spring 2003 CMSC 203 - Discrete Structures 22 Exercises – P: buy a car from Acme Motor Company – Q: get $2000 cash back – R: get a 2% car loan • P → Q  R • Why use XOR here? – example of ambiguity of natural languages • When you buy a new car from Acme Motor Company, you get $2000 back in cash or a 2% car loan.
  • 23. Spring 2003 CMSC 203 - Discrete Structures 23 Exercises – P: School is closed – Q: 2 feet of snow falls – R: wind chill is below -100 • Q  R → P • Precedence among operators: , , , →,  • School is closed if more than 2 feet of snow falls or if the wind chill is below -100.
  • 24. Spring 2003 CMSC 203 - Discrete Structures 24 Equivalent Statements P Q (PQ) (P)(Q) (PQ)(P)(Q) T T F F T T F T T T F T T T T F F T T T The statements (PQ) and (P)  (Q) are logically equivalent, since they have the same truth table, or put it in another way, (PQ) (P)  (Q) is always true.
  • 25. Spring 2003 CMSC 203 - Discrete Structures 25 Tautologies and Contradictions A tautology is a statement that is always true. Examples: – R(R) – (PQ)  (P)( Q) A contradiction is a statement that is always false. Examples: – R(R) – ((P  Q)  (P)  (Q)) The negation of any tautology is a contradiction, and the negation of any contradiction is a tautology.
  • 26. Spring 2003 CMSC 203 - Discrete Structures 26 Equivalence Definition: two propositional statements S1 and S2 are said to be (logically) equivalent, denoted S1  S2 if – They have the same truth table, or – S1  S2 is a tautology Equivalence can be established by – Constructing truth tables – Using equivalence laws (Table 5 in Section 1.2)
  • 27. Spring 2003 CMSC 203 - Discrete Structures 27 Equivalence Equivalence laws – Identity laws, P  T  P, – Domination laws, P  F  F, – Idempotent laws, P  P  P, – Double negation law,  ( P)  P – Commutative laws, P  Q  Q  P, – Associative laws, P  (Q  R) (P  Q)  R, – Distributive laws, P  (Q  R) (P  Q)  (P  R), – De Morgan’s laws,  (PQ)  ( P)  ( Q) – Law with implication P → Q   P  Q
  • 28. Spring 2003 CMSC 203 - Discrete Structures 28 Exercises • Show that P → Q   P  Q: by truth table • Show that (P → Q)  (P → R)  P → (Q  R): by equivalence laws (q20, p27): – Law with implication on both sides – Distribution law on LHS
  • 29. Spring 2003 CMSC 203 - Discrete Structures 29 Summary, Sections 1.1, 1.2 • Proposition – Statement, Truth value, – Proposition, Propositional symbol, Open proposition • Operators – Define by truth tables – Composite propositions – Tautology and contradiction • Equivalence of propositional statements – Definition – Proving equivalence (by truth table or equivalence laws)
  • 30. Spring 2003 CMSC 203 - Discrete Structures 30 Propositional Functions & Predicates Propositional function (open sentence): statement involving one or more variables, e.g.: x-3 > 5. Let us call this propositional function P(x), where P is the predicate and x is the variable. What is the truth value of P(2) ? false What is the truth value of P(8) ? What is the truth value of P(9) ? false true When a variable is given a value, it is said to be instantiated Truth value depends on value of variable
  • 31. Spring 2003 CMSC 203 - Discrete Structures 31 Propositional Functions Let us consider the propositional function Q(x, y, z) defined as: x + y = z. Here, Q is the predicate and x, y, and z are the variables. What is the truth value of Q(2, 3, 5) ? true What is the truth value of Q(0, 1, 2) ? What is the truth value of Q(9, -9, 0) ? false true A propositional function (predicate) becomes a proposition when all its variables are instantiated.
  • 32. Spring 2003 CMSC 203 - Discrete Structures 32 Propositional Functions Other examples of propositional functions Person(x), which is true if x is a person Person(Socrates) = T CSCourse(x), which is true if x is a computer science course CSCourse(CMSC201) = T Person(dolly-the-sheep) = F CSCourse(MATH155) = F How do we say All humans are mortal One CS course
  • 33. Spring 2003 CMSC 203 - Discrete Structures 33 Universal Quantification Let P(x) be a predicate (propositional function). Universally quantified sentence: For all x in the universe of discourse P(x) is true. Using the universal quantifier : x P(x) “for all x P(x)” or “for every x P(x)” (Note: x P(x) is either true or false, so it is a proposition, not a propositional function.)
  • 34. Spring 2003 CMSC 203 - Discrete Structures 34 Universal Quantification Example: Let the universe of discourse be all people S(x): x is a UMBC student. G(x): x is a genius. What does x (S(x) → G(x)) mean ? “If x is a UMBC student, then x is a genius.” or “All UMBC students are geniuses.” If the universe of discourse is all UMBC students, then the same statement can be written as x G(x)
  • 35. Spring 2003 CMSC 203 - Discrete Structures 35 Existential Quantification Existentially quantified sentence: There exists an x in the universe of discourse for which P(x) is true. Using the existential quantifier : x P(x) “There is an x such that P(x).” “There is at least one x such that P(x).” (Note: x P(x) is either true or false, so it is a proposition, but no propositional function.)
  • 36. Spring 2003 CMSC 203 - Discrete Structures 36 Existential Quantification Example: P(x): x is a UMBC professor. G(x): x is a genius. What does x (P(x)  G(x)) mean ? “There is an x such that x is a UMBC professor and x is a genius.” or “At least one UMBC professor is a genius.”
  • 37. Spring 2003 CMSC 203 - Discrete Structures 37 Quantification Another example: Let the universe of discourse be the real numbers. What does xy (x + y = 320) mean ? “For every x there exists a y so that x + y = 320.” Is it true? Is it true for the natural numbers? yes no
  • 38. Spring 2003 CMSC 203 - Discrete Structures 38 Disproof by Counterexample A counterexample to x P(x) is an object c so that P(c) is false. Statements such as x (P(x) → Q(x)) can be disproved by simply providing a counterexample. Statement: “All birds can fly.” Disproved by counterexample: Penguin.
  • 39. Spring 2003 CMSC 203 - Discrete Structures 39 Negation (x P(x)) is logically equivalent to x (P(x)). (x P(x)) is logically equivalent to x (P(x)). See Table 2 in Section 1.3. This is de Morgan’s law for quantifiers
  • 40. Spring 2003 CMSC 203 - Discrete Structures 40 Negation Examples Not all roses are red x (Rose(x) → Red(x)) x (Rose(x)  Red(x)) Nobody is perfect x (Person(x)  Perfect(x)) x (Person(x) → Perfect(x))
  • 41. Spring 2003 CMSC 203 - Discrete Structures 41 Nested Quantifier A predicate can have more than one variables. – S(x, y, z): z is the sum of x and y – F(x, y): x and y are friends We can quantify individual variables in different ways – x, y, z (S(x, y, z) → (x <= z  y <= z)) – x y z (F(x, y)  F(x, z)  (y != z) → F(y, z)
  • 42. Spring 2003 CMSC 203 - Discrete Structures 42 Nested Quantifier Exercise: translate the following English sentence into logical expression “There is a rational number in between every pair of distinct rational numbers” Use predicate Q(x), which is true when x is a rational number x,y (Q(x)  Q (y)  (x < y) → u (Q(u)  (x < u)  (u < y)))
  • 43. Spring 2003 CMSC 203 - Discrete Structures 43 Summary, Sections 1.3, 1.4 • Propositional functions (predicates) • Universal and existential quantifiers, and the duality of the two • When predicates become propositions – All of its variables are instantiated – All of its variables are quantified • Nested quantifiers – Quantifiers with negation • Logical expressions formed by predicates, operators, and quantifiers