0% found this document useful (0 votes)
53 views

Week 1 - Introduction To Discrete Structures-Merged

notes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Week 1 - Introduction To Discrete Structures-Merged

notes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Introduction to Discrete Structures

1 INTRODUCTION
It is a common perception for students who would like to take IT Education to choose programs other
than Computer Science. This is mainly because they want to avoid the courses of mathematics such as
Discrete Mathematics or Discrete Structure. Little do they know that the study of mathematics,
particularly Discrete Mathematics, is a pre-requisite knowledge in order to learn algorithms used in
computer programming.

This course will teach you sets of mathematical facts and how to apply them, more importantly, the
course would teach you how to think logically and mathematically.

Objectives:

After completing this module, you should be able to:

1. Define Discrete Mathematics.


2. Familiarize with goals of Discrete Mathematics.
3. Appreciate the study of Discrete Mathematics.

DISCRETE STRUCTURES 1 1
Introduction to Discrete Structures

Discrete Mathematics

• Discrete mathematics is the part of mathematics devoted to the study of discrete objects.

• Discrete mathematics describes processes that consist of a sequence of individual steps.

• 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.

Goals of Discrete Mathematics

A successful discrete mathematics course should carefully blend and balance all five themes.

1. Mathematical Reasoning

 Students must understand mathematical reasoning in order to read, comprehend, and


construct mathematical arguments.

2. Combinatorial Analysis

 An important problem-solving skill is the ability to count or enumerate objects.

3. Discrete Structures

 A course in discrete mathematics should teach students how to work with discrete
structures, which are the abstract mathematical structures used to represent discrete
objects and relationships between these objects.

4. Algorithmic Thinking

 Certain classes of problems are solved by the specification of an algorithm. After an


algorithm has been described, a computer program can be constructed implementing it.

5. Applications and Modeling

 Discrete mathematics has applications to almost every conceivable area of study. There
are many applications to computer science and data networking, as well as applications
to such diverse areas as chemistry, biology, linguistics, geography, business, and the
Internet.

Reasons for Studying Discrete Mathematics

1. To develop your mathematical maturity: that is, the ability to understand and create
mathematical arguments;

2. It provides the mathematical foundations for many computer science courses including data
structures, algorithms, database theory, automata theory, formal languages, compiler theory,
computer security, and operating systems.

DISCRETE STRUCTURES 1 2
Introduction to Discrete Structures

References:

1. Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition. McGrawHill, 2012
2. Gary Weiss Damian Lyons, et al., Fundamentals of Discrete Structures, 2nd edition, Pearson
Learning Solutions, 2012.
3. Susanna S. Epp, Discrete Mathematics with Applications, Brooks Cole; 4th edition, 2011.
4. James L. Hein, Discrete Structures, Logic, and Computability, 3rd edition, Jones & Bartlett
Publishers, 3rd edition, 2009.
5. Kolman, B., Busby, R. C., Ross, S. C. Discrete Mathematical Structures, 6th Edition. Prentice Hall,
2008.

DISCRETE STRUCTURES 1 3
Logic

2 LOGIC
The rules of logic specify the meaning of mathematical statements. It is the basis of all mathematical
reasoning (Rosen, 2012). Its application in the area of computer science is very vast that even the
computer itself defends on it, True or False, 1 or 0, and the presence or absence of bit. The study of logic
will increase your knowledge in formulating logical statements for the reason that program statements
and expressions are built from repeated application of logical operators. This module will help you
analyze arguments to determine the truth value of it.

Objectives:

After completing this module, you should be able to:

1. Define Logic.
2. Appreciate the importance of Logic in mathematics.
3. Identify Propositions.
4. Convert Propositions to propositional variables.
5. Apply logical connectives to form compound propositions.
6. Construct and prove statements using Truth Table.

DISCRETE STRUCTURES 1 4
Logic

Definition

• Logic is the study of the methods and principles used to distinguish good (correct) from bad
(incorrect) reasoning.

• The term is derived from the Greek word logike – the feminine of the word logikos which means
“of reason.”

• Logic, then, is also defined as the study of reason.

Importance of Logic

• The rules of logic specify the meaning of mathematical statements.

• Logic is the basis of all mathematical reasoning, and of all automated reasoning. It has practical
applications to the design of computing machines, to the specification of systems, to artificial
intelligence, to computer programming, to programming languages, and to other areas of
computer science, as well as to many other fields of study.

Arguments, Premises, Conclusion

• An argument, as it occurs in logic, is a group of propositions/statements which is divided into


one or more premises and one, and only one conclusion.

• The statement being supported is the conclusion of the argument and the statements that
support it are the premises of the argument.

Three types of Logic

1. Propositional Logic (PL)

2. First Order Predicate Logic (FOPL)

3. Fuzzy Logic

However, this course will focus only in Propositional Logic.

Propositional Logic

• Propositional Logic or PL is that part of logic which deals with statements that are either true or
false but not both.

• The bases for propositional logic are the three laws of Aristotelian logic. These are:

– Law of Identity. “A thing is itself.”

– Law of Excluded Middle. “A statement is either true or false but not both.”

– Law of Non-Contradiction. “No statement is both true and false.”

DISCRETE STRUCTURES 1 5
Logic

Example of Argument

If the program syntax is faulty or if program execution results in division by zero, then
the computer will generate an error message. Therefore, if the computer does not
generate an error message, then the program syntax is correct and program execution
does not result in division by zero.

• Propositional Logic or PL is that part of logic which deals with statements that are either true or
false but not both.

• The bases for propositional logic are the three laws of Aristotelian logic. These are:

– Law of Identity. “A thing is itself”

– Law of Excluded Middle. “A statement is either true or false but not both”

– Law of Non-Contradiction. “No statement is both true and false”

Propositions

• The rules of logic gives precise meaning of mathematical statements. These rules are used to
distinguish valid and invalid mathematical arguments.

• A declarative statement that is either true or false, but not both.

Example:

– 1+5=6
– The Earth revolves around the Sun
– 10 – 4 = 5
– Pigs can fly

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

Consider the following sentences

– x+3=5
– x+y=z
– When is your birthday?
– Pass your assignment.

Sentences 1 and 2 are not propositions because they are neither true nor false.

Sentences 1 and 2 are not propositions because they are not declarative sentences.

DISCRETE STRUCTURES 1 6
Logic

Propositional Variable

 A name that represents the proposition.

Example:

– p : The Earth revolves around the sun


– q : Pigs can fly
– r: 1+5=6

Exercise

Which of the following are propositions?

1. 10 is greater than 5

2. Please erase the board

3. 5 + a = 10

4. Take your medicine

5. It is not raining today

Compound Proposition

Can be obtained by: Negating a proposition, or Combining two or more propositions using
logical connectives

Logical Connectives

Compound Proposition uses the following logical connectives:

Logical Connectives Meaning


Negation Not
Conjunction And
Disjunction Or
Exclusive or XOr
Implication If – then
Biconditional If and only if

The basic logical connectives are: not, and, or, if then, and if and only if.

Not is used to modify propositions while and, or, if then and if and only if are used to join
propositions.

DISCRETE STRUCTURES 1 7
Logic

Precedence Rules

In forming sentences, we put grouping symbols (parentheses, brackets, or braces). Without the
presence of grouping symbols, we will assume that the grouping will follow the precedence
rules for the logical connectives.

Logical Connectives
Not
And
Or
If then
If and only if

The connective with the higher priority will be considered first over the one with the lower
priority. Connectives having the same priorities are then considered from left to right.

Truth Table

A table that lists the truth value of the compound proposition for all possible values of its
proposition variables.

Truth tables can be used to show how these operators can combine propositions to form
compound propositions.

Negation (Not)

Unary Operator, Symbol: ¬

p: The Earth does not revolve around the Sun p p


T: F true (T) false (F)

q: Pigs cannot fly


false (F) true (T)

F: T

Proposition Negation
p : The sun is shining p : The sun is not shining
q : The program is running q : The program is not running
r : The value of x is positive r : The value of x is not positive

DISCRETE STRUCTURES 1 8
Logic

Conjunction (And)

Binary Operator, Symbol: 

p  q: The Earth revolves around the p p pq


sun and pigs can fly. T T T
T F F
T  F: F
F T F
F F F

In logic, the word “but” is sometimes used instead of conjunction “and”. Generally, the
word “but” is used in place of “and” when the part of the sentence that follows is, in some way,
unexpected.

Therefore, if p and q are statements, then

p but q means p and q

Example:

Let

p : Mathematics is easy

q : I will pass mathematics

Therefore: p  q = Mathematics is easy and I will pass mathematics

The proposition will only result into TRUE if the statements p and q are both true. If one
of the statements results into False, the entire proposition will result into False.

Example:

Let

p : Today is Monday

q : The sun is shining

Find p  q

DISCRETE STRUCTURES 1 9
Logic

Disjunction (Or)

Binary Operator, Symbol: 

p  q : The Earth revolves around the p q pq


sun or pigs can fly. T T T
TF:T
T F T
F T T
Example:
F F F
Let

p : Mathematics is easy

q : I will pass mathematics

Therefore: p  q = Mathematics is easy or I will pass mathematics

The proposition will result into TRUE if the statements p or q are true. If one of the
statements results into True, the entire proposition will result into True.

Example:

Let

p : Today is Monday

q : The sun is shining

Find p  q

And, Or, and Inequalities

The notation for inequalities involves and and or statements. For instance, if x, a, and b
are particular real numbers, then

x≤a means x < a or x = a

a≤x≤b means a ≤ x and x ≤ b

Note that the inequality

2 ≤ x ≤ 1 is not satisfied by any real numbers because

2≤x≤1 means 2 ≤ x and x ≤ 1

and this is False no matter what the value of x happens to be.

DISCRETE STRUCTURES 1 10
Logic

Exclusive or (XOR)

Binary Operator, Symbol: 

p  q : Either the Earth revolves around the Sun or pigs can fly

TF:T p q pq
T T F
T F T
F T T
F F F
Example:

Let

p : Mathematics is easy

q : I will pass mathematics

Therefore: p  q = Either mathematics is easy or I will pass mathematics

The proposition will only result into TRUE if one of the statements is true. If both
statements result into True or False, the entire proposition will also result to False.

Example:

Let

p : Today is Monday

q : The sun is shining

Find p  q

Implication (if - then)

Binary Operator, Symbol: 

If p then q p q pq
p is sufficient for q T T T
q is necessary for p
T F F
F T T
p : Hypothesis
F F T
q : Conclusion

p  q

DISCRETE STRUCTURES 1 11
Logic

Example:

Let:

p: 2 < 6, r: 2 < 10, s: 2 < 1, t: 5 < 3

pr sp
If 2 < 6, then 2 < 10 If 2 < 1, then 2 < 6
TT:T FT:T
ps st
If 2 < 6, then 2 < 1 If 2 < 1, then 5 < 3
TF:F FF:T

Example:

Let

p : Mathematics is easy

q : I will pass mathematics

Therefore: p  q = If mathematics is easy then I will pass mathematics

The proposition will only result into FALSE when p is true and q is false, and TRUE
otherwise. In the conditional statement p  q, p is called hypothesis and q is called conclusion.

Example:

Let

p : Today is Monday

q : The sun is shining

Find p  q

Biconditional (if and only if)

Binary Operator, Symbol: 

p if and only if q p q pq


p is necessary and
T T T
sufficient for q
T F F
F T F
(p ® q)  (q ® p) F F T
 (p  q)

DISCRETE STRUCTURES 1 12
Logic

Example:

Let

p : Mathematics is easy

q : I will pass mathematics

Therefore: p  q = Mathematics is easy if and only if I will pass mathematics

The proposition will only result into TRUE when both p and q have the same value of
either True or False.

Example:

Let

p : Today is Monday

q : The sun is shining

Find p  q

Statements and Operators

Statements and operators can be combined in any way to form new statements.

Example:

p q p q p) v (q)
T T F F F
T F F T T
F T T F T
F F T T T

p q pq (pq) p) v (q)


T T T F F
T F F T T
F T F T T
F F F T T

DISCRETE STRUCTURES 1 13
Logic

Exercise

Write truth tables for the statements.

1. ¬p  q

2. p(qr)

3. ¬(p  q )  (p  q )

4. p  (¬q  r )

DISCRETE STRUCTURES 1 14
Logic

References:

1. Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition. McGrawHill, 2012
2. Gary Weiss Damian Lyons, et al., Fundamentals of Discrete Structures, 2nd edition, Pearson
Learning Solutions, 2012.
3. Susanna S. Epp, Discrete Mathematics with Applications, Brooks Cole; 4th edition, 2011.
4. James L. Hein, Discrete Structures, Logic, and Computability, 3rd edition, Jones & Bartlett
Publishers, 3rd edition, 2009.
5. Kolman, B., Busby, R. C., Ross, S. C. Discrete Mathematical Structures, 6th Edition. Prentice Hall,
2008.

DISCRETE STRUCTURES 1 15
Logic

3 LOGIC
There are some formulas whose truth values are always True or always False regardless of the truth
value assigned to the variables. The negation of tautology is contradiction and vice-versa. The
knowledge on the simplification of proposition will aid in determining validity of the argument faster
than the use of Truth Table and the use of Laws of Logic (inference rules), which can be used to
construct more complicated valid argument forms. This module will teach you how to establish the
validity of arguments and simplify compound propositions using Laws of Logic.

Objectives:

After completing this module, you should be able to:

1. Convert tautology statements to contradiction and vice-versa.


2. Establish the logical equivalence of propositions using De Morgan’s Laws.
3. Apply the Laws of Logic to simplify compound propositions.

DISCRETE STRUCTURES 1 16
Logic

Tautologies and Contradictions

 Tautology is a statement that is always true regardless of the truth values of the individual
logical variables.

Example:

R  (R)

(P  Q)  (P)  (Q)

If S  T is a tautology, we write S  T.

If S  T is a tautology, we write S  T.

A contradiction is a statement that is always false regardless of the truth values of the
individual logical variables.

Example:

R  (R)

((P  Q)  (P)  (Q))

The negation of any tautology is a contradiction, and the negation of any contradiction is
a tautology.

Logical Equivalence

 Two proposition forms are called logically equivalent if and only if they have identical truth
values for each possible substitution of propositions for their proposition variable.

The logical equivalence of proposition forms P and Q is written

P≡Q

Equivalence of Two Compound Propositions

1. Construct the truth table for P.

2. Construct the truth table for Q using the same proposition variables for identical component
propositions.

3. Check each combination of truth values of the proposition variables to see whether the
truth value of P is the same as the truth value of Q.

DISCRETE STRUCTURES 1 17
Logic

Equivalence Check

1. If in each row the truth value of P is the same as the truth value of Q, then P and Q are
logically equivalent.

2. If in some row P has a different truth value from Q, then P and Q are not logically equivalent.

Example:

Prove that ¬ (¬p) ≡ p

Solution:

The corresponding truth values of p and ¬ (¬p) are same, hence equivalence is justified.

Exercise

Show that the proposition forms ¬(p  q) and ¬p  ¬q are NOT logically equivalent.

De Morgan’s laws

 De Morgan’s laws state that: The negation of a proposition is logically equivalent to the
proposition in which each component is negated.

Symbolically (De Morgan’s Laws)

¬(p  q) ≡ ¬p ¬q

¬(p  q) ≡ ¬p  ¬q

Example:

Negate the following compound propositions:

John is six feet tall and he weights at least 200 pounds.

The bus was late or Tom’s watch was slow.

Solution:

John is not six feet tall or he weighs less than 200 pounds.

The bus was not late and Tom’s watch was not slow.

DISCRETE STRUCTURES 1 18
Logic

Inequalities and De Morgan’s Laws

Example:

Use De Morgan’s laws to write the negation of

-1< x ≤ 4

Solution:

The given proposition is equivalent to

-1< x and x ≤ 4

By De Morgan’s laws, the negation is

-1 ≥ x or x > 4.

Tautology

 A tautology is a proposition form that is always true regardless of the truth values of the
individual propositions substituted for its proposition variables.
 A proposition whose form is a tautology is called a tautological proposition.

Contradiction

 A contradiction is a proposition form that is always false regardless of the truth values of the
individual propositions substituted for its proposition variables.
 A proposition whose form is a contradiction is called a contradictory proposition.

Example:

Show that the proposition form p U ¬p is a tautology and the proposition form p ∩ ¬p is a
contradiction.

Exercise

Show that the proposition form r  s ≡ r is a tautology and the proposition form r  s ≡ s is a
contradiction.

Laws of Logic

 T denotes the compound proposition that is always


true and F denotes the compound proposition that
is always false

DISCRETE STRUCTURES 1 19
Logic

Simplification of Compound Propositions

Example:

prove that ⌐(⌐p  q)  (p  q) ≡ p

Solution:

⌐(⌐p  q)  (p  q) ≡ (⌐(⌐p)  ⌐q)  (p  q) De Morgan’s Laws

(⌐(⌐p)  ⌐q)  (p  q) ≡ (p  ⌐q)  (p  q) Double Negation Law

(p  ⌐q)  (p  q) ≡ p  (⌐q  q) Distributive Law

p  (⌐q  q) ≡ p  (q  ⌐q) Commutative Law

p  (q  ⌐q) ≡ p  F Negation Law

pF≡p Identity Law

Exercise

Prove that

¬(p  (¬p  q)) ≡ ¬p ¬(¬p  q)

DISCRETE STRUCTURES 1 20
Logic

References:

1. Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition. McGrawHill, 2012
2. Gary Weiss Damian Lyons, et al., Fundamentals of Discrete Structures, 2nd edition, Pearson
Learning Solutions, 2012.
3. Susanna S. Epp, Discrete Mathematics with Applications, Brooks Cole; 4th edition, 2011.
4. James L. Hein, Discrete Structures, Logic, and Computability, 3rd edition, Jones & Bartlett
Publishers, 3rd edition, 2009.
5. Kolman, B., Busby, R. C., Ross, S. C. Discrete Mathematical Structures, 6th Edition. Prentice Hall,
2008.

DISCRETE STRUCTURES 1 21

You might also like