Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Discrete Structures

Lecture 1: Introduction and Logic


based on slides by Jan Stelovsky
based on slides by Dr. Baek and Dr. Still
Originals by Dr. M. P. Frank and Dr. J.L. Gross
Provided by McGraw-Hill

Muhammad Adeel Zahid


Department of Computer Science
Government College University
Faisalabad
What is Discrete Structures?

• Discrete refers to something distinct or separable (or countable) as


opposed to continuous
• Real numbers are continuous
• Set of integers is discrete
• Structures are objects composed of simple objects
• Trees
• Graphs
• So discrete structures is the study of objects are concepts made of
discrete or countable objects
• Countable does not necessarily means finite

2
Why Discrete Structures

• Rational Thinking
• To verify the validity of an argument
• Digital information is basically the manipulation of discrete objects in
computer memory
• In computer science the concepts of discrete structures are used in
• Analysis of Algorithms
• Theory of Automata
• Cryptography
• Networks and Operating Systems
• Database and Computer Architecture
• Apart from that, Discrete structures has its applications in
engineering, mathematics and science

3
Major Topics in Discrete Structures

• Propositions • Relations
• Predicates • Graphs
• Proofs • Trees
• Sets • Boolean Functions
• Functions
• Automata
• Algorithms
• Summation and Sequences
• Combinatorics
• Probability

4
Propositional Logic

• Logic
• Study of reasoning
• Not confined to mathematics or science only
• We use logic in our everyday conversation
• Presents a framework for reasoning for validating arguments
• Propositional Logic
• Logic concerned with statements or compound statements connected with
Boolean connectors
• Statement is often called a proposition (definition appears shortly)

5
Proposition

• Definition: A proposition is a declarative sentence or statement with


an associated Truth value (True or False)
• A proposition can be represented with symbol p, q, … just like variables
• At a given time, the proposition can either be True or False but not both
• It is however possible that someone is not aware of the Truth value of the
proposition
• Examples:
• It is ranining
• 2+2=5
• Pakistan was created in 1947
• 11213 is prime
• There exists an odd perfect number

6
Proposition

• Statements that are not Propositions


• How old are you?
• Where do you live?
• Bring me a glass of water
• 1+2
• x+2 = 5

7
Logical Operators or Connectors

• Just like arithmetic operators (+, -, x, /), we have logical operators or


connectors
• Like arithmetic operators, logical operators can be unary or binary

Operator Name Informal Name Arity Symbol


Negation Operator NOT Unary ¬
Conjunction Operator AND Binary 
Disjunction Operator OR Binary 
Exclusive OR Operator XOR Binary 
Implication Operator IMPLIES, IF Binary 
Biconditional Operator IFF, IF AND ONLY Binary

IF

8
Negation Operator

• The unary negation operator transforms a proposition into its logical


negation
• For instance, if p = “It is raining”
then ¬ p = “It is not the case that it is raining”
or “it is not raining”
• Truth Table

p ¬p
T F
F T

9
Conjunction Operator

• The logical AND or conjunction operator combines two propositions


to form their logical conjunction
• Conjunction is only True when both propositions involved in the
conjunction are True
• For instance, p = “It is raining” and
q = “It is sunny”
then p  q = “It is raining and it is sunny”
• When is this conjunction True?

10
Conjunction Operator: Truth Table

p q pq

T T T

T F F

F T F

F F F

11
The Disjunction Operator

• The disjunction operator combines two propositions using logical OR


operator to form their disjunction
• The disjunction yields TRUE if any one or both of the propositions are TRUE
• It is only FALSE when both the propositions are FALSE
• For example, p = “Door of my room is open” and
q = “Window of my room is open”
• Then p  q = “Door of my room is open or window of my room is
open”

12
Disjunction Operator: Truth Table

p q pq

T T T

T F T

F T T

F F F

• Also called Inclusive OR

13
Exclusive OR Operator

• Binary exclusive OR operator combines two propositions to form their


logical “exclusive OR”
• The “exclusive OR” of two propositions is only TRUE when both propositions
have different truth values i.e first is TRUE and second is FALSE or vice versa
• For Example, p = “I will take an A in this course” and
q = “I will drop this course”
• Then, p  q = “I will either take an A in this course or I will
drop this course”

14
Exclusive OR: Truth Table

p q p q

T T F

T F T

F T T

F F F

15
Ambiguity of Natural Language

• Consider someone saying: “I will do a job at Google or I will do my


own Business”
• Now, let p = I will do a job at Google” and q = “I will do my own
Business”
• How will you convert the compound proposition into mathematical
symbols
• pq
• pq
• Both of the above conversions yield in different meanings. This
happens due to ambiguity of natural language
• You need context to decide what conversion is correct

16
The implication Operator

• The conditional statement or implication p  q states that p implies q


• That is, q is TRUE when p is TRUE but if p is not TRUE then q can
either be TRUE or FALSE
• For instance, let p = “you have a degree in CS” and
q = “You will get a good job”
• Then p  q = “If you have a degree in CS then you will get a good job”
• p is hypothesis, antecedent or premise
• q is conclusion or consequence
• Implication can also be written as “if p then q”, “q if p”, “q when p”
etc.

17
The Implication Operator: Truth Table

p q p q

T T T

T F F

F T T

F F T

• p q does not require q to be TRUE when p is F


• For instance, “(1=0)  elephant can fly” is TRUE

18

You might also like