23
Discrete Structures Abdur Rehman Usmani 03419019922

Intro to disceret structure

Embed Size (px)

Citation preview

Page 1: Intro to disceret structure

Discrete

Structures

Abdur Rehman Usmani

03419019922

Page 2: Intro to disceret structure

Why is ito“Discrete” (≠ “discreet”!) - Composed of distinct, separable parts.

o“Structures” - objects built up from simpler objects according to a definite pattern.

Page 3: Intro to disceret structure

Why it is importanto Provides mathematical foundation for computer science courses such as

o data structures, algorithms, relational database theory, automata theory and

o formal languages, compiler design, and cryptography,

o mathematics courses such as linear and abstract algebra, probability, logic and set theory, and number theory.

Page 4: Intro to disceret structure

What it doeso Describes processes that consist of a sequence of individual steps.

o Helps students to develop the ability to think abstractly.

Page 5: Intro to disceret structure

BooksDiscrete Mathematics and Its Applications

by Kenneth H. Rosen.

6th edition, McGraw Hill Publisher.

Discrete Mathematics with Applications by Susanna S.Epp

4th edition, McGraw Hill Publisher.

Page 6: Intro to disceret structure

ESSENTIAL TOPICS TO BE COVERED:o Functions, relations and sets

o Basic logic

o Proof techniques

o Basics of counting

o Graphs and trees

o Recursion

Page 7: Intro to disceret structure

LogicoCrucial for mathematical reasoning

oImportant for program design

oUsed for designing electronic circuitry

o(Propositional )Logic is a system based on propositions.

oA proposition is a (declarative) statement that is either true or false (not both).

oWe say that the truth value of a proposition is either true (T) or false (F).

oCorresponds to 1 and 0 in digital circuits

Page 8: Intro to disceret structure

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

Page 9: Intro to disceret structure

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

Page 10: Intro to disceret structure

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.

Page 11: Intro to disceret structure

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

Page 12: Intro to disceret structure

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.

Page 13: Intro to disceret structure

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

Page 14: Intro to disceret structure

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.

Page 15: Intro to disceret structure

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.

Page 16: Intro to disceret structure

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.

Page 17: Intro to disceret structure

Negation (NOT)

Unary Operator, Symbol:

P P

true (T) false (F)

false (F) true (T)

Page 18: Intro to disceret structure

Conjunction (AND)

Binary Operator, Symbol:

P Q P Q

T T T

T F F

F T F

F F F

Page 19: Intro to disceret structure

Disjunction (OR)

Binary Operator, Symbol:

P Q P Q

T T T

T F T

F T T

F F F

Page 20: Intro to disceret structure

ConnectivesLet 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 = “It didn’t rain last night.”

r ∧ ¬p =“The lawn was wet this morning,

and it didn’t rain last night.”

¬ r ∨ p ∨ q =“Either the lawn wasn’t wet this morning, or it rained last night, or the sprinklers came on last night.”

Page 21: Intro to disceret structure

ConnectivesLet p= “It is hot”

q=““It is sunny”

1. It is not hot but it is sunny.

2. It is neither hot nor sunny.

Solution

1. ⌐p∧q

2. ⌐p∧ ⌐q

Page 22: Intro to disceret structure

Exclusive Or (XOR)

Binary Operator, Symbol:

P Q PQ

T T F

T F T

F T T

F F F

• p = “I will earn an A in this course,”• q = “I will drop this course,”• p ⊕ q = “I will either earn an A in this

course, or I will drop it (but not both!)”• True when exactly one of p and q is

true and is false otherwise.

Page 23: Intro to disceret structure