Anda di halaman 1dari 16

Discrete Mathematics

Table of Contents
UNIT 1. INTRODUCTION TO DISCRETE STRUCTURES....................................................................... 3
UNIT 2. LOGIC AND PROOFS..................................................................................................................... 3
LESSON 2.1. PROPOSITIONS..........................................................................................................................................4
2.1.1. PROPOSITION..................................................................................................................................................... 4
2.1.2. LOGICAL MATRIX.............................................................................................................................................. 5
2.1.3. LOGICAL OPERATORS..................................................................................................................................... 5
LESSON 2.3. REASONING WITH PROPOSITION..................................................................................................12
DEFINITION 2.3.1.A IDENTITIES................................................................................................................................13

Page 2
Discrete Mathematics

UNIT 1. INTRODUCTION TO DISCRETE STRUCTURES

Discrete Mathematics is mathematics that deals with discrete objects.


Discrete objects are those which are separated from (not connected
to/distinct from) each other. Integers (aka whole numbers), rational numbers
(ones that can be expressed as the quotient of two integers), automobiles,
houses, people etc. are all discrete objects. On the other hand real numbers
which include rational as well as irrational numbers are not discrete. As you
know between any two different real numbers there is another real number
different from either of them. In this course we will be concerned with objects
such as integers, propositions, sets, relations and functions, which are all
discrete. We are going to learn concepts associated with them, their
properties, and relationships among them among others.

Let us first see why we should be interested in the formal/theoretical


approaches in computer science. Some of the major reasons that we adopt
formal approaches are 1) we can handle infinity and indefiniteness with them,
and 2) results from formal approaches are reusable.

Discrete mathematics is the foundation for the formal approaches. It


discusses languages used in mathematical reasoning, basic concepts, and their
properties and relationships among them. Though there is no time to cover
them in this course, discrete mathematics is also concerned with techniques
to solve certain types of problems such as how to count or enumerate
quantities. The kind of counting problems includes: How many routes exist
from point A to point B in a computer network? How much execution time is
required to sort a list of integers in increasing order? What is the probability
of winning a lottery? What is the shortest path from point A to point B in a
computer network? Etc. Much of this topic is dealt with in an introductory
probability course.

UNIT 2. LOGIC AND PROOFS

Logic is a language of reasoning. It is a collection of rules we use when


doing logical reasoning. Human reasoning has been observed over centuries
from at least the times of Greeks, and patterns appearing in reasoning have
been extracted, abstracted, and streamlined. 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
Page 3
Discrete Mathematics

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.

In logic we are interested in true or false of statements, and how the


truth/falsehood of a statement can be determined from other statements.
However, instead of dealing with individual specific statements, we are going
to use symbols to represent arbitrary statements so that the results can be
used in many similar but different cases. The formalization also promotes the
clarity of thought and eliminates mistakes.

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. Here we are going to be concerned
with propositional logic and predicate logic, which are fundamental to all
types of logic.

Lesson 2.1. PROPOSITIONS

2.1.1. PROPOSITION
A proposition is a sentence that is either true or false, but not both. It is
typically expressed as a declarative sentence (as opposed to a question,
command, etc.). Propositions are the basic building blocks of any theory of
logic.

We will use lowercase letters, such as p, q, and r, to represent


propositions. We will also use the notation

p: 1 + 1 = 3

to define p to be the proposition 1 + 1 = 3.

Example 2.1.1.a.1

All the following sentences are propositions.

1. The only positive integers that divide 7 are 1 and 7 itself.

2. Quezon City was once the capital of the Philippines.

3. 16 ÷ 4 = 4.

4. √ 3 isan integer .

Propositions 1, 2, 3 are true, whereas 4 is false.

Page 4
Discrete Mathematics

2.1.2. LOGICAL MATRIX


An acceptable proposition is given the decision value true (T or 1), while
an unacceptable statement is assigned a decision value false (F or 0). An array
of decision value (truth value) is called a logical matrix (or truth table).

2.1.3. LOGICAL OPERATORS


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. Thus propositions and connectives are
the basic elements of propositional logic. Though there are many
connectives, we are going to use the following five basic connectives here:
NOT, AND, OR, IF_THEN (or IMPLY), IF_AND_ONLY_IF.
They are also denoted by the symbols:   ,   ,   ,   ,   , respectively.

Propositions such as p ⋀ q and p ⋁q that result from combining


propositions are called compound propositions.

Definition 2.1.3.a CONJUNCTION

Let p and q be propositions. The proposition p and q,


denoted p ⋀ q, is the proposition that is true when both p and q
are true and is false otherwise. The proposition p ⋀ q is called
the conjunction of p and q.
Example 2.1.3.a.1
1. Let p: 2 + 4 = 8, q: A decade is 10 years.

The conjunction of p and q,

p ⋀ q: 2 + 4 = 8 and a decade is 10 years

is false.
Table . The Truth Matrix for the Conjunction of Two Propositions

p q p⋀q
T T T
T F F
F T F
F F F

Page 5
Discrete Mathematics

Definition 2.1.3.b DISJUNCTION

Let p and q be propositions. The proposition p or q,


denoted p ⋁q, is the proposition that is false when both p and q
are false and is true otherwise. The proposition p ⋁ q is called
the disjunction of p and q.
Example 2.1.3.b.1
1. Let p: 2 + 4 = 8, q: A decade is 10 years.

The disjunction of p and q,

p ⋁q: 2 + 4 = 8 or a decade is 10 years

is true.
Table . The Truth Matrix for the Disjunction of Two Propositions

p q p⋁q
T T T
T F T
F T T
F F F

Definition 2.1.3.c EXCLUSIVE-OR

Let p and q be propositions. The exclusive-or of p and q,


denoted by p ⊕ q is the proposition that is true when exactly
one of p and q is true and is false otherwise.

Example 2.1.3.c.1
1. Let p: You can have a glass of milk for breakfast.
q: You can have a glass of orange juice for breakfast.
The exclusive-or proposition of p and q is
Either you can have a glass of milk or a glass of orange juice for
breakfast.

Table . The Truth Matrix for Exclusive-Or of a Proposition

p q p⊕q
T T F
T F T
F T T
F F F

Page 6
Discrete Mathematics

Definition 2.1.3.d NEGATION

Let p be a proposition. The statement

“It is not the case that p”

is another proposition, called the negation of p, denoted by


¬p. The proposition ¬p is read “not p.”

Example 2.1.3.d.1
1. Let p: 20 is a negative integer.
The negation of p is the proposition

¬p: It is not the case that 20 is a negative integer.

Since p is false, ¬p is true. (20 is a positive integer.) The negation


would normally be written:
Twenty (20) is not a negative number.

Table . The Truth Matrix of the Negation of a Proposition

p ¬p
T F
F T

Example 2.1.3.d.2
1. Let p: Blaise Pascal invented several calculating machines,
q: The first all-electronic digital computer was constructed
in the twentieth century,
r: π was calculated to 1,000,000 decimal digits in 1954.

Represent the proposition


Either Blaise invented several calculating machines and it is
not the case that the first all-electronic digital computer was
constructed in the twentieth century; or was calculated to
1,000,00 decimal digits in 1954.
symbolically and determine whether it is true or false.
The proposition may be written symbolically as (p ⋀ ¬q) ⋁ r.

We first note that p and q are true and r is false. (It is not until 1973 that
1,000,000 decimal digits of π were computed. Since then over 2,000,000,000
decimal digits of π have been computed.) If we replace each symbol by its
truth value, we find that

Page 7
Discrete Mathematics

(p ⋀ ¬q) ⋁ r = (T ⋀ ¬T) ⋁ F

= (T ⋀ F) ⋁ F

= F⋁F

= F

Therefore, the given proposition is false.

Exercise
A. Determine whether each sentence is a proposition. If the sentence is a
proposition, write its negation.
1. Today is Friday.
2. 2 + 5 =19.
3. Waiter, will you serve the nuts—I mean, would you serve the guests
the nuts?
4. Every even integer greater than 4 is the sum of two primes.
5. x – 6 ≥ 11.
6. Tom Cruise starred in Knight and day.
7. Peel me a grape.
8. Why should you take discrete mathematics before autumata?
9. The town fiesta of Carigara, Leyte is on the 16th of July.
10. Curiosity is what drives problem solving.

B. Evaluate each proposition for the truth values


p = F, q = T, r = F.
1. p ⋁ q
2. ¬ p ⋁ q
3. ¬(p ⋁ q) ⋀ (¬p ⋁ r)
4. ¬ p ⋁ ¬q
5. ¬ p ⋁ ¬(q ⋀ r)
6. (p ⋁ ¬r) ⋀ ¬[(q ⋁ r) ⋁ ¬(r ⋁ p)]

C. Formulate the symbolic expression in words using


p: Today is Monday.
q: It is raining.
r: It is hot.
1. p ⋁ q
2. (p ⋀ q) ⋀ ¬(r ⋁ p)
3. ¬ p ⋁ (q ⋁ r)
4. ¬ (p ⋁ q) ⋀ r
5. [p ⋀ (q ⋁ r)] ⋀ [r ⋁ (q ⋁ p)]

Page 8
Discrete Mathematics

Lesson 2.2. CONDITIONAL PROPOSITIONS AND LOGICAL EQUIVALENCE

Definition 2.2.1.a CONDITIONAL (OR IMPLICATION)

Let p and q be propositions. The implication p → q is the


proposition that is false when p is true and q is false, and true
otherwise. In this implication p is called the hypothesis (or
premise) and q is called the conclusion ( or consequent).

Example 2.2.1.a.1

Restate each proposition in the form of a conditional proposition.

1. Mary will be a good student if she studies hard.

The hypothesis is the clause following if; thus an equivalent formulation


is
If Mary studies hard, then she will be a good student.

2. John may take calculus only if he has sophomore, junior, or senior


standing.

The only if clause is the conclusion; that is, if p then q is considered


logically the same as p only if q.
An equivalent formulation is
If John takes calculus, then he has sophomore, junior, or senior
standing.

3. When you sing, my ears hurt.

When means the same as if; thus an equivalent formulation is


If you sing, then my ears hurt.

4. A necessary condition for the Cubs to win the World Series is that they
sign a right-handed relief pitcher.

The conclusion expresses a necessary condition; thus an equivalent


formulation is
If the Cubs win the World Series, then they sign a right-handed
relief pitcher.

Page 9
Discrete Mathematics

5. A sufficient condition for Ralph to visit California is that he goes to


Disneyland.

The hypothesis expresses a sufficient condition; thus an equivalent


formulation is
If Ralph goes to Disneyland, then he visits California.

Table . The Truth Matrix for Conditional Proposition p → q

p q p→q
T T T
T F F
F T T
F F T

There are some related implications that can be formed from p → q.

The proposition q → p is called the converse of p → q.

The proposition ¬q → ¬p is called the contra-positive of p → q.

The proposition ¬p → ¬q is called the inverse of p → q.

Example 2.2.1.a.2

What are the contra-positive, the converse and the inverse of the
implication?

“The price of crude oil goes up whenever the US goes to war”

This proposition can be expressed in the if-then form.

“If the US goes to war, then the price of crude oil goes up.”

Consequently, the converse of this implication is

“If the price of crude oil goes up, then the US goes to war.”

The contra-positive is

“If the price of crude oil does not go up, then the US does not go to war.”

The inverse is

“If the US does not go to war, then the price of crude oil does not go up.”

Page 10
Discrete Mathematics

Definition 2.2.1.b Bi-CONDITIONAL

Let p and q be propositions. The compound proposition


p if and only if q, denoted by p ↔ q, is called bi-conditional
proposition that is true when p and q have the same truth
value, and is false otherwise.

Example 2.2.1.b.1
The statement
1 < 5 if and only if 2 < 8
can be written symbolically as
p↔q
if we define
p: 1 < 5, q: 2 < 8.
Since both p and q are true, the statement p ↔ q is true.
An alternative way to state such proposition is: A necessary and
sufficient condition for 1 < 5 is that 2 < 8.

Definition 2.2.1.c LOGICAL EQUIVALENCE

Suppose that the compound propositions P and Q are


made up of the propositions p1, …, pn . We say that P and Q are
logically equivalent and write

P ≡ Q,

provided that given any truth values of p1, …, pn, either P and Q
are both true or P and Q are both false.

Example 2.2.1.c.1
Show that ¬ (p ⋀ q) and ¬p ⋁ ¬q are equivalent.
Solution:

p q (p ⋀ q) ¬ (p ⋀ q) ¬p ¬q ¬p ⋁ ¬q
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T

Because ¬ (p ⋀ q) and ¬p ⋁ ¬q have the same truth values, they are


equivalent.

Page 11
Discrete Mathematics

Lesson 2.3. REASONING WITH PROPOSITION

Logical reasoning is the process of drawing conclusions from premises using


rules of inference. Here we are going to study reasoning with propositions. Later
we are going to see reasoning with predicate logic, which allows us to reason about
individual objects. However, inference rules of propositional logic are also
applicable to predicate logic and reasoning with propositions is fundamental to
reasoning with predicate logic.

These inference rules are results of observations of human reasoning over


centuries. Though there is nothing absolute about them, they have contributed
significantly in the scientific and engineering progress the mankind has made.
Today they are universally accepted as the rules of logical reasoning and they
should be followed in our reasoning.

Since inference rules are based on identities and implications, we are going
to study them first. We start with three types of proposition which are used to
define the meaning of "identity" and "implication".

Types of Proposition

Some propositions are always true regardless of the truth value of


its component propositions.
For example (P P) is always true regardless of the value of the
proposition P.
A proposition that is always true called a tautology.

There are also propositions that are always false such as (P P). Such a
proposition is called a contradiction. A proposition that is neither a
tautology nor a contradiction is called a contingency.
For example (P Q) is a contingency.
These types of propositions play a crucial role in reasoning. In particular
every inference rule is a tautology as we see in identities and implications.

Definition 1.1.1.a IDENTITIES

From the definitions (meaning) of connectives, a number of relations


between propositions which are useful in reasoning can be derived. Below some

Page 12
Discrete Mathematics

of the often encountered pairs of logically equivalent propositions, also called


identities, are listed.

These identities are used in logical reasoning. In fact we use them in our
daily life, often more than one at a time, without realizing it.
If two propositions are logically equivalent, one can be substituted for the other
in any proposition in which they occur without changing the logical value of the
proposition.

Below ⟺ corresponds to ↔ and it means that the equivalence is always true (a


tautology).

Example 2.3.1.a.1
1. p ⟺ (p ⋁ p) ----- Idempotence of ⋁

What this says is, for example, that "Tom is happy." is equivalent to "Tom is
happy or Tom is happy". This and the next identity are rarely used, if ever, in
everyday life. However, these are useful when manipulating propositions in
reasoning in symbolic form.

2. p ⟺ (p ⋀ p) ----- Idempotence of ⋀

Similar to 1. above.

3. (p ⋁ q) ⟺ (q ⋁ p) ----- Commutativity of ⋁

What this says is, for example, that "Tom is rich or (Tom is) famous." is
equivalent to "Tom is famous or (Tom is) rich".

4. (p ⋀ q) ⟺ (q ⋀ p) ----- Commutativity of ⋀

What this says is, for example, that "Tom is rich and (Tom is) famous." is
equivalent to "Tom is famous and (Tom is) rich".

5. [(p ⋁ q) ⋁ r] ⟺[p ⋁ (q ⋁ r)] ----- associativity of

What this says is, for example, that "Tom is rich or (Tom is) famous, or he is
also happy." is equivalent to "Tom is rich, or he is also famous or (he is)
happy".

6. [(p ⋀ q) ⋀ r] ⟺[p ⋀ (q ⋀ r)] ----- associativity of

Page 13
Discrete Mathematics

Similar to 5. above.

7. ¬(p ⋁ q) ⟺ (¬p ⋀ ¬q) ----- DeMorgan's Law

For example, "It is not the case that Tom is rich or famous." is true if and only
if "Tom is not rich and he is not famous."

8. ¬(p ⋀ q) ⟺ (¬p ⋁ ¬q) ----- DeMorgan's Law

For example, "It is not the case that Tom is rich and famous." is true if and only
if "Tom is not rich or he is not famous."

9. [p ⋀ (q ⋁ r)] ⟺ [(p ⋀ q) ⋁ (p ⋀ r)] ----- Distributivity of ⋀ over ⋁

What this says is, for example, that "Tom is rich, and he is famous or (he is)
happy." is equivalent to "Tom is rich and (he is) famous, or Tom is rich and (he
is) happy".

10. [p ⋁ (q ⋀ r)] ⟺ [(p ⋁ q) ⋀ (p ⋁ r)] ----- Distributivity of ⋀ over ⋁

Similarly to 9. above, what this says is, for example, that "Tom is rich, or he is
famous and (he is) happy." is equivalent to "Tom is rich or (he is) famous, and
Tom is rich or (he is) happy".

11. (p ⋁ True) ⟺ True.  


Here True is a proposition that is always true. Thus the proposition (p ⋁ True)
is always true regardless of what P is.
This and the next three identities, like identities 1 and 2, are rarely used, if ever,
in everyday life. However, these are useful when manipulating propositions in
reasoning in symbolic form.

12. (p ⋀ False) ⟺ False

13. (p ⋁ False) ⟺ p

14. (p ⋀ True) ⟺ p

15. (p ⋁ ¬P) ⟺ True

What this says is that a statement such as "Tom is 6 foot tall or he is not 6 foot
tall." is always true.

Page 14
Discrete Mathematics

16. (p ⋀ ¬p) ⟺ False

What this says is that a statement such as "Tom is 6 foot tall and he is not 6 foot
tall." is always false.

17. p ⟺ ¬(¬p) ----- double negation

What this says is, for example, that "It is not the case that Tom is not 6 foot
tall." is equivalent to "Tom is 6 foot tall."

18. (p → q) ⟺ (¬p ⋁ q) ----- implication

For example, the statement "If I win the lottery, I will give you a million
dollars." is not true, that is, I am lying, if I win the lottery and don't give you a
million dollars. It is true in all the other cases. Similarly, the statement "I don't
win the lottery or I give you a million dollars." is false, if I win the lottery and
don't give you a million dollars. It is true in all the other cases. Thus these two
statements are logically equivalent.

19. (p ↔ q) ⟺ [( p → q) ⋀ ( q → p)]----- equivalence

What this says is, for example, that "Tom is happy if and only if he is healthy."
is logically equivalent to ""if Tom is happy then he is healthy, and if Tom is
healthy he is happy."

20. [(p ⋀ q) → r] ⟺ [p →(q →r)] ----- exportation

For example, "If Tom is healthy, then if he is rich, then he is happy." is


logically equivalent to "If Tom is healthy and rich, then he is happy."

21. [(p →q) ⋀ (p →¬q)] ⟺ ¬p ----- absurdity

For example, if "If Tom is guilty then he must have been in that room." and "If
Tom is guilty then he could not have been in that room." are both true, then
there must be something wrong about the assumption that Tom is guilty.

22. (p →q) ⟺ (¬q →¬p) ----- contrapositive

For example, "If Tom is healthy, then he is happy." is logically equivalent to "If
Tom is not happy, he is not healthy."

Page 15
Discrete Mathematics

The identities 1 ~ 16 listed above can be paired by duality relation, which is


defined below, as 1 and 2, 3 and 4, ..., 15 and 16. That is 1 and 2 are dual to
each other, 3 and 4 are dual to each other, .... Thus if you know one of a pair,
you can obtain the other of the pair by using the duality.

Page 16

Anda mungkin juga menyukai