4. What is discrete mathematics?
The study of discrete objects. Discrete mathematics is the part
of mathematics devoted to discrete means consisting of
distinct or unconnected elements.
5. The kinds of problems solved using discrete mathematics include:
• How many ways are there to choose a valid password on a computer system?
• What is the probability of winning a lottery?
• Is there a link between two computers in a network?
• How can I identify spam e-mail messages?
• How can I encrypt a message so that no unintended recipient can read it?
• What is the shortest path between two cities using a transportation system?
• How can a list of integers be sorted so that the integers are in increasing order?
6. The kinds of problems solved using discrete mathematics include:
• How many steps are required to do such a sorting?
• How can it be proved that a sorting algorithm correctly sorts a list?
• How can a circuit that adds two integers be designed?
• How many valid Internet addresses are there?
You will learn the discrete structures and techniques needed to solve problems
such as these.
More generally, discrete mathematics is used whenever objects are counted,
when relationships between finite (or countable) sets are studied, and when
processes involving a finite number of steps are analyzed. A key reason for the
growth in the importance of discrete mathematics is that information is stored
and manipulated by computing machines in a discrete fashion.
8. Through this course you can develop your mathematical
maturity: that is, your ability to understand and create mathematical
arguments.You will not get very far in your studies in the
mathematical sciences without these skills.
Second, discrete mathematics is the gateway to more advanced
courses in all parts of the mathematical sciences. Discrete
mathematics provides the mathematical foundations for many
computer science courses including data structures and algorithms,
database theory, formal languages, compiler theory, computer
security, and operating systems.
Why Study Discrete Math?
9. Math courses based on the material studied in discrete mathematics
include logic, set theory, number theory, linear algebra, abstract
algebra, combinatorics, graph theory, and probability theory (the
discrete part of the subject).
Also, discrete mathematics contains the necessary mathematical
background for solving problems in operations research (including
many discrete optimization techniques), chemistry, engineering,
biology, and so on. In the text, we will study applications to some of
these areas.
Many students find their introductory discrete mathematics course
to be significantly more challenging than courses they have
Why Study Discrete Math?
11. LEARNING OUTCOMES
By: SHERWIN C. SANGALANG
At the end of the lesson, the students should be able to:
1. explain and apply basic notions of symbolic logic
2. define proposition and argument and explain propositional
connectives.
3. construct truth table and apply logical operators
4. explain and exemplify truth value status of a proposition
12. Logic
Logic is a language for reasoning.
In logic we are interested whether the statement is true or
false , and how the truthness/falsehood of a statement can
be determined from other statements.
“Logic” is “the study of the principles of reasoning,
especially of the structure of propositions as distinguished
from their content and of method and validity in deductive
reasoning.” (thefreedictionary.com)
13. Logic
Logic – used to distinguish between valid and invalid
mathematical arguments.
There are various types of logic such as logic of sentences,
logic of objects, logic involving uncertainties, temporal
logic etc.
14.
15. Propositional Logic
Propositional Logic is the logic of compound
statements built from simpler statements
using so-called Boolean connectives.
Some applications in computer science:
• Design of digital electronic circuits.
• Expressing conditions in programs.
• Queries to databases & search engines.
2024-02-05 15
Topic #1 – Propositional Logic
George Boole
(1815-1864)
Chrysippus of Soli
(ca. 281 B.C. – 205 B.C.)
16. Propositional Logic
Propositional logic is a logic at the sentential level.
The smallest unit we deal with in propositional logic
is a sentence.
Sentences considered in propositional logic are not
arbitrary sentences but are the ones that are either
true or false, but not both. This kind of sentences are
called propositions.
17. Definition of a Proposition
A proposition (p, q, r, …) is simply a statement (i.e., a
declarative sentence) with a definite meaning, having a
truth value that’s either true (T) or false (F) (never both,
neither, or somewhere in between).
(However, you might not know the actual truth value, and it
might be situation-dependent.)
[Later we will study probability theory, in which we assign degrees
of certainty to propositions. But for now: think True/False only!]
17
Topic #1 – Propositional Logic
18. Examples of Propositions
• “It is raining.” (In a given situation.)
• “Beijing is the capital of China.” • “1 + 2 = 3”
But, the following are NOT propositions:
• “Who’s there?” (interrogative, question)
• “La la la la la.” (meaningless interjection)
• “Just do it!” (imperative, command)
• “Yeah, I sorta dunno, whatever...” (vague)
• “1 + 2” (expression with a non-true/false value) 18
Topic #1 – Propositional Logic
19. Propositional Logic
If a proposition is true, then we say it has a truth
value of "true"; if a proposition is false, its truth value
is "false".
The first proposition has the truth value of "true" and
the second "false".
Example: "Grass is green",
"2 + 5 = 5"
20. Propositional Logic
1. San Jose, is the capital of Occidental Mindoro.
2. 1 + 1 = 2
3. What time is it?
4. Read this carefully.
5. x + 1 = 2
21. Elements of Propositional Logic
Simple sentences which are true or false are basic
propositions. Larger and more complex sentences are
constructed from basic propositions by combining them
with connectives. Compound Proposition is a proposition
that has its truth value completely determined by the truth
values of two or more propositions and the operators (also
called connectives) connecting them.
22. Operators / Connectives
An operator or connective combines one or more
operand expressions into a larger expression. (E.g., “+”
in numeric exprs.)
Unary operators take 1 operand (e.g., −3); binary
operators take 2 operands (eg 3 4).
Propositional or Boolean operators operate on
propositions or truth values instead of on numbers.
22
Topic #1.0 – Propositional Logic: Operators
23. Elements of Propositional Logic
Though there are many connectives, we are going to
use the following five basic:
NOT (), AND (), OR (), IF_THEN or IMPLY (),
IF_AND_ONLY_IF ().
24. Some Popular Boolean Operators
Formal Name Nickname Arity Symbol
Negation operator NOT Unary ¬
Conjunction operator AND Binary
Disjunction operator OR Binary
Exclusive-OR operator XOR Binary
Implication operator IMPLIES Binary
Biconditional operator IFF Binary ↔
24
25. Elements of Propositional Logic
In such a case rather than stating them for each
individual proposition we use variables representing
an arbitrary proposition and state properties/relations
in terms of those variables. Those variables are called
a propositional variable. Propositional variables are
also considered a proposition and called a proposition
since they represent a proposition hence they behave
the same way as propositions.
27. Compound Propositions
When two or more propositions are joined together
using connectives this statement is called a compound
proposition. Example “John is smart or he studies
every night.”
28. TRUTH TABLE
A truth table is a device that allows us to analyze and
compare compound logic statements. In logic, given a
proposition, a truth table shows all the possible truth
values of a proposition.
Example: (for a simple proposition), the truth table is
p
T
F
29. TRUTH TABLE
• A truth table is useful if we need to show the possible
truth values of compound propositions.
• Example: (for compound propositions with p and q as
component propositions)
• First determine the number of possible combinations
of the simple propositions. For 2 component
propositions, the number of combinations is 4 (given
by the equation “𝑁 = 2𝑛” where N is the number of
combinations and n is the number of component
propositions.
30. THE BASIC RULES FOR CONSTRUCTING A TRUTH
TABLE FOR A COMPOUND STATEMENT
1. The number of rows in the truth table depends upon the number
of basic variables in the compound statement. To determine the
number of rows required, count the number of basic variables in the
statement, but don't re-count multiple occurrences of a variable.
• variable---2 rows
• variables--4 rows
• variables--8 rows
• variables--16 rows and so forth.
31. THE BASIC RULES FOR CONSTRUCTING A TRUTH
TABLE FOR A COMPOUND STATEMENT
2. The number of columns in a truth table depends upon the number
of logical connectives in the statement. The following guidelines are
usually reliable.
• There will be one column for each basic variable; and
• To determine the number of other columns, count the number of
logical connectives in the statement; do re-count multiple
occurrences of the same connective. The “~” symbol counts as a
logical connective.
• In addition to the columns for each basic variable, there will usually
be one column for each occurrence of a logical connective
32. THE BASIC RULES FOR CONSTRUCTING A TRUTH
TABLE FOR A COMPOUND STATEMENT
3. The beginning columns are filled in so as to take into
account every possible combination of the basic variables
being true or false. Each row represents one of the possible
combinations.
4. In order to fill in any other column in the truth table, you
must refer to a previous column or columns.
33. The Negation Operator
The unary negation operator “¬” (NOT) transforms a prop.
into its logical negation.
E.g. If p = “I have brown hair.”
then ¬p = “I do not have brown hair.”
Truth table for NOT:
33
p p
T F
F T
T :≡ True; F :≡ False
“:≡” means “is defined as” Operand
column
Result
column
Topic #1.0 – Propositional Logic: Operators
34. Logical Connectives
(1) Not (negation) : (~) or ()
Let p be a proposition. The negation of p is denoted by:
p, and read as “not p”.
Example:
Find the negation of the proposition “Today is Friday”.
35. Logical Connectives
DEFINITION 1 Let p be a proposition. The negation of p,
denoted by¬p (also denoted by ¯), is the statement
“It is not the case that p.”
The proposition ¬p is read “not p.” The truth value of the
negation of p, ¬p, is the opposite
of the truth value of p.
P
36. EXAMPLE
EXAMPLE1. Find the negation of the proposition
“Michael’s PC runs Linux”
and express this in simple English.
SOLUTION: The negation is
“It is not the case that Michael’s PC runs Linux.”
This negation can be more simply expressed as
“Michael’s PC does not run Linux.”
▲
37. EXAMPLE
Find the negation of the proposition
“Maria’s smartphone has at least 32GB of memory”
and express this in simple English.
Solution: The negation is
“It is not the case that Maria’s smartphone has at least 32GB of memory.”
This negation can also be expressed as
“Maria’s smartphone does not have at least 32GB of memory”
or even more simply as
“Maria’s smartphone has less than 32GB of memory.”
38. The Conjunction Operator
The binary conjunction operator “” (AND) combines
two propositions to form their logical conjunction.
E.g. If p=“I will have salad for lunch.” and q=“I will have
steak for dinner.”, then pq=“I will have salad for lunch
and
I will have steak for dinner.”
38
Remember: “” points up like an “A”, and it means “ND”
ND
Topic #1.0 – Propositional Logic: Operators
39. Logical Connectives
(2) And (conjunction) :
Let p and q be prepositions. The preposition of “p and q” is
denoted by p q, is TRUE when BOTH p and q are true and
otherwise is FALSE.
p q p q
T T T
T F F
F T F
F F F
40. Conjunction Truth Table
• Note that a
conjunction
p1 p2 … pn
of n propositions
will have 2n rows
in its truth table.
• Also: ¬ and operations together are suffi-
cient to express any Boolean truth table!
40
p q pq
T T T
T F F
F T F
F F F
Operand columns
41. EXAMPLE
Find the conjunction of the propositions p and q where p is the
proposition “Rebecca’s PC has more than 16 GB free hard disk space”
and q is the proposition “The processor in Rebecca’s PC runs faster
than 1 GHz.
42. Solution:
The conjunction of these propositions, p ∧ q, is the proposition
“Rebecca’s PC has more than 16 GB free hard disk space, and the
processor in Rebecca’s PC runs faster than 1GHz.” This conjunction
can be expressed more simply as “Rebecca’s PC has more than 16 GB
free hard disk space, and its processor runs faster than 1 GHz.” For
this conjunction to be true, both conditions given must be true. It is
false, when one or both of these conditions are false.
43. Logical Connectives
(3) Or (disjunction) :
Let p and q be propositions. The preposition of “p or q” -
denoted pq, is FALSE when BOTH p and q are FALSE and
TRUE otherwise.
p q pq
T T T
T F T
F T T
F F F
44. The Disjunction Operator
The binary disjunction operator “” (OR) combines two
propositions to form their logical disjunction.
p=“My car has a bad engine.”
q=“My car has a bad carburetor.”
pq=“Either my car has a bad engine, or
my car has a bad carburetor.”
44
After the downward-
pointing “axe” of “”
splits the wood, you
can take 1 piece OR the
other, or both.
Topic #1.0 – Propositional Logic: Operators
Meaning is like “and/or” in English.
45. Disjunction Truth Table
• Note that pq means
that p is true, or q is
true, or both are true!
• So, this operation is
also called inclusive or,
because it includes the
possibility that both p and q are true.
• “¬” and “” together are also universal.
45
p q pq
T T T
T F T
F T T
F F F
Note
difference
from AND
46. Activity
Consider the propositions and state whether it is
true or false:
1) Ice floats in water and 2 + 2 = 4
2) China is not in Europe and 2 + 2 = 4
3) 5 – 3 = 1 or 2 x 2 = 4
47. Another Activity
Translate the following into logical notation, using p and q and logical
connectives.
p = It is below freezing
q = It is snowing
(a) It is below freezing and snowing
(b) It is below freezing but not snowing
(c) It is not below freezing and it is not snowing
48. Conditional Statements/Implication
Let p and q be a proposition. The implication pq is the
proposition that is FALSE when p is true, q is false. Otherwise
is TRUE. p is the antecedent and q is the consequence.
p q pq
T T T
T F F
F T T
F F T
49. Conditional Statements/Implication
The following list presents
some of the variations. These
are all logically equivalent,
that is as far as true or false of
statement is concerned there
is no difference between
them.
If p, then q.
If p, q.
p only if q.
p is sufficient for q.
q if p.
q whenever p.
q is necessary for p.
It is necessary for p that q.
50. Example:
• Let p be the statement “Maria learns discrete mathematics.” and q the
statement “Maria will find a good job.” Express the statement p → q as a
statement in English.
50
Solution: Any of the following -
“If Maria learns discrete mathematics, then she will find a good job.
“Maria will find a good job when she learns discrete mathematics.”
“For Maria to get a good job, it is sufficient for her to learn
discrete mathematics.”
51. Conditional Statements/Implication
Example: Use this proposition and translate this to different
variations of conditional statement.
(1) If she smiles then she is happy.
(2) The door will open only if you have the keys.
(3) Cats are annoyed when its raining
52. Conditional Statements/Implication
A useful way to understand the truth value of a conditional
statement is to think of an obligation or a contract. For
example, the pledge many politicians make when running for
office is
“If I am elected, then I will lower taxes.”
53. The Implication Operator
The implication p q states that p implies q.
I.e., If p is true, then q is true; but if p is not true, then q could be either
true or false.
E.g., let p = “You study hard.”
q = “You will get a good grade.”
p q = “If you study hard, then you will get a good grade.” (else, it could
go either way)
Topic #1.0 – Propositional Logic: Operators
antecedent consequent
54. Implication Truth Table
• p q is false only when
p is true but q is not true.
• p q does not say
that p causes q!
• p q does not require
that p or q are ever true!
• E.g. “(1=0) pigs can fly” is TRUE!
54
p q pq
T T T
T F F
F T T
F F T
The
only
False
case!
55. Examples of Implications
• “If this lecture ends, then the sun will rise tomorrow.”
True or False?
• “If Tuesday is a day of the week, then I am a penguin.”
True or False?
• “If 1+1=6, then Duterte is president.”
True or False?
• “If the moon is made of green cheese, then I am richer
than Bill Gates.” True or False?
56. Equivalence/Bi-conditional
Let p and q be a proposition. The bi-conditional pq is the
proposition that is TRUE when p and q have the same truth
values, and FALSE otherwise.
Example: “ p if and only if q”
p q p q
T T T
T F F
F T F
F F T
57. The biconditional operator
The biconditional p q states that p is true if and
only if (IFF) q is true.
p = “Obama wins the 2008 election.”
q = “Obama will be president for all of 2009.”
p q = “If, and only if, Obama wins the 2008
election, Obama will be president for all of 2009.”
2008 2009
I’m still
here!
58. Biconditional Truth Table
• p q means that p and q
have the same truth value.
• Note this truth table is the
exact opposite of ’s!
• p q means ¬(p q)
• p q does not imply
p and q are true, or cause each other.
58
p q p q
T T T
T F F
F T F
F F T
59. Equivalence/Biconditional
Example:
(1) Tom is happy if and only if he is healthy
(2) Let p be the statement “You can take the flight” and let q be
the statement “You buy a ticket.” Then p ↔ q is the statement
“You can take the flight if and only if you buy a ticket.”
Implication:
If you buy a ticket you can take the flight.
If you don’t buy a ticket you cannot take the flight.
60. Converse, Inverse and Contrapositive
For the proposition p q, the first statement p is the
antecedent or the hypothesis and the second statement q is the
consequent or conclusion. When q became the hypothesis and
p became the consequent this statement is called converse
proposition (q p). Example the statement “If I get high
grades, then I study hard” is the converse proposition for the
statement “If I study hard, then I will get high grades”.
61. Converse, Inverse and Contrapositive
Inverse proposition on the other hand is when the proposition p
q is negated and became p q. Both converse and inverse
proposition are not necessary true as the conditional proposition.
However the contrapositive proposition and the conditional
proposition are logically equivalent. Which means q p p
q.
62. Converse, Inverse, Contrapositive
Some terminology, for an implication p q:
• Its converse is: q p.
• Its inverse is: ¬p ¬q.
• Its contrapositive: ¬q ¬ p.
• One of these three has the same meaning (same truth table)
as p q. Can you figure out which?
63. How do we know for sure?
Proving the equivalence of p q and its contrapositive using truth
tables:
63
p q q p pq q p
F F T T T T
F T F T T T
T F T F F F
T T F F T T
64. EXAMPLE
What are the contrapositive, the converse, and the inverse of the conditional statement
“The home team wins whenever it is raining?”
Solution: Because “q whenever p” is one of the ways to express the conditional statement
p → q, the original statement can be rewritten as
“If it is raining, then the home team wins.”
Consequently, the contrapositive of this conditional statement is
“If the home team does not win, then it is not raining.”
The converse is
“If the home team wins, then it is raining.”
The inverse is
“If it is not raining, then the home team does not win.”
Only the contrapositive is equivalent to the original statement.
65. Converse and Contrapositive
Example: Find the converse, inverse and contrapositive
propositions for the following statements.
P = I study hard.
Q = I’ll get high grades.
66. Converse and Contrapositive
Example: Find the converse and contrapositive propositions for
the following propositions:
(1) The sun goes down only if it is night time.
(2) It is a sunny day and the sky is blue
(3) Scott is a rich kid if and only if he has a sports car.
67. Nested Propositional Expressions
• Use parentheses to group sub-expressions:
“I just saw my old friend, and either he’s grown or I’ve shrunk.” = p
(q r)
• (p q) r would mean something different
• p q s would be ambiguous
• By convention, “¬” takes precedence over both “” and “”.
• ¬r p means (¬r) p , not ¬ (r p)
68. A Simple Exercise
Let p=“It rained last night”,
q=“The sprinklers came on last night,”
r=“The lawn was wet this morning.”
Translate each of the following into English:
¬p =
r ¬p =
(¬ r p) q =
68
“It didn’t rain last night.”
“The lawn was wet this morning, and
it didn’t rain last night.”
“Either the lawn wasn’t wet this
morning, or it rained last night, or
the sprinklers came on last night.”
Topic #1.0 – Propositional Logic: Operators
69. The Exclusive Or Operator
The binary exclusive-or operator “” (XOR) combines two
propositions to form their logical “exclusive or” (exjunction?).
p = “I will earn an A in this course,”
q = “I will drop this course,”
p q = “I will either earn an A for this course, or I will drop it
(but not both!)”
70. Exclusive-Or Truth Table
• Note that pq means
that p is true, or q is
true, but not both!
• This operation is
called exclusive or,
because it excludes the
possibility that both p and q are true.
• “¬” and “” together are not universal.
p q pq
T T F
T F T
F T T
F F F
71. Constructing a Truth Table
Construct a truth table for the propositional form
(pq)
72. Constructing a Truth Table
Construct a truth table for the propositional form
p(pq)
Editor's Notes
The foundation of the logic we are going to learn here was laid down by a British mathematician George Boole in the middle of the 19th century, and it was further developed and used in an attempt to derive all of mathematics by Gottlob Frege, a German mathematician, towards the end of the 19th century. A British philosopher/mathematician, Bertrand Russell, found a flaw in basic assumptions in Frege's attempt but he, together with Alfred Whitehead, developed Frege's work further and repaired the damage. The logic we study today is more or less along this line.
There are various types of logic such as logic of sentences (propositional logic), logic of objects (predicate logic), logic involving uncertainties, logic dealing with fuzziness, temporal logic etc.
2024-02-05
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
. We do not go inside individual sentences and analyze or discuss their meanings. We are going to be interested only in true or false of sentences, and major concern is whether or not the truth or falsehood of a certain sentence follows from those of a set of sentences, and if so, how.
. We do not go inside individual sentences and analyze or discuss their meanings. We are going to be interested only in true or false of sentences, and major concern is whether or not the truth or falsehood of a certain sentence follows from those of a set of sentences, and if so, how.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
2024-02-05
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
2024-02-05
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
2024-02-05
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
2024-02-05
2024-02-05
2024-02-05
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
2024-02-05
2024-02-05
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
If I study hard, then I will get high grades (if p then q)
She is a good photographer only if she passes the photographers exam (q only if p)
cats are annoyed when its raining (p when q)
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
If I study hard, then I will get high grades (if p then q)
She is a good photographer only if she passes the photographers exam (q only if p)
cats are annoyed when its raining (p when q)
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
2024-02-05
If I study hard, then I will get high grades (if p then q)
She is a good photographer only if she passes the photographers exam (q only if p)
cats are annoyed when its raining (p when q)
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.
Proposition (or statement) = a declarative statement (in contrast to a command, a question, or an exclamation) which is true or false, but not both.