Professional Documents
Culture Documents
CMP-212
1 STRUCTURES
Lecture 1
2 Contact Information
Email: ayesha.raana@gcwus.edu.pk
Office: Faculty Room, IT BLOCK
Student Hours: Confirmation Only via Email
ayesha.raana@gcwus.edu.pk
3 Quick Overview
Discrete Structures is essentially that branch
of mathematics that does not depend on
limits; in this sense, it is the anti-thesis of
Calculus. As computers are discrete object
operating one jumpy, discontinuous step at a
time, Discrete Structures is the right
framework for describing precisely Computer
Science concepts. Lecture 1
4 Quick Overview
Lecture 1
5 Quick Overview
Lecture 1
6 Quick Overview - Topics
Logic and Sets
Make notions you’re already used to from programming a little
more rigorous (operators)
Fundamental to all mathematical disciplines
Useful for digital circuits, hardware design
Elementary Number Theory
Get to rediscover the old reliable number and find out some
surprising facts
Very useful in crypto-systems
Lecture 1
7 Quick Overview - Topics
Lecture 1
8 Quick Overview - Topics
Graph Theory
Many clever data-structures for organizing
information and making programs highly
efficient are based on graph theory
Very useful in describing problems in
Databases
Operating Systems
Networks
EVERY CS DISCIPLINE!!!!
Lecture 1
9 Objectives
Lecture 1
11 Statements: (Proposition)
Lecture 1
12 Propositions: Examples
Earth is round.
I can speak English
x<98
5+1=6
What time is it?
Each of these proposition has a truth value,
True or False but not both.
Lecture 1
13 Propositions:
9*10=9
You are studying Discrete Structures
Sky is blue
Computers have feelings
Lecture 1
14 Propositional Variable
Lecture 1
15 Propositional Logic
Lecture 1
16 Propositional Logic
Lecture 1
17 False, True, Statements
Axiom: False is the opposite to Truth.
Examples of statements:
I’m 31 years old.
Lecture 1
19 False, True, Statements
Neither: I’m lying to you. (If viewed on its
own)
HUH? Well suppose that
S = “I” am lying to you.”
were true. In particular, I am actually
lying, so S is false. So it’s both true and
false, impossible by the Axiom.
Okay, so I guess S must be false. But then I
must not be lying to you. So the
statement is true. Again it’s both true
and false.
In both cases we get the opposite of our
assumption, so S is neither true nor false.
Lecture 1
20 Propositions
To avoid painful head-aches, we ban such silly
non-sense and avoid the most general type of
statements limiting ourselves to statements
with valid truth-values instead:
Lecture 1
21 Propositions
Propositional Logic is a static discipline of statements
which lack semantic content.
Clinton.”
Lecture 1
22 Propositions
Lecture 1
24 Logical Connectives
Operator Symbol Usage Java
Negation not !
Conjunction and &&
Disjunction or ||
Exclusive or xor (p||q)&&(!p||!q)
Lecture 1
25 Compound Propositions:
Examples
p = “Cruise ships only go on big rivers.”
q = “Cruise ships go on the River
Ravi.” r = “The Ravi is a big river.”
r = “The Ravi is not a big river.”
pq = “Cruise ships only go on big rivers and
go on the Ravi.”
pq r = “If cruise ships only go on big rivers
and go on the Ravi, then the Ravi is a big river.”
Lecture 1
26 Negation
This just turns a false proposition to true and the
opposite for a true proposition.
EG: p = “23 = 15 +7”
Lecture 1
27 Negation
Lecture 1
28 Truth Table
Lecture 1
29 Negation – truth table
p p
F T
T F
Lecture 1
30 Conjunction
Lecture 1
31 Conjunction
Lecture 1
32 Conjunction
Lecture 1
33 Conjunction – truth table
p q p q
T T T
T F F
F T F
F F F
Lecture 1
34 Disjunction – truth table
p q p q
T T T
T F T
F T T
Lecture 1
F F F
Activity Time
1. Which of the following statement is a proposition?
Let P: This is a great website, Q: You should not come back here.
Then ‘This is a great website and you should come back here.’ is
best represented by?
a) ~P V ~Q
b) P ∧ ~Q
c) P V Q
d) P ∧ Q
37 Disjunction – caveat
soup or salad.
Lecture 1
39 Exclusive-Or – truth table
p q p q
T T F
T F T
F T T
F F F
Lecture 1
40 Conditional (Implication)
is false.
p q p q
T T T
T F F
F T T
F F T
Lecture 1
Conditional
42
Lecture 1
Conditional
43
Lecture 1
44 Conditional: why FF is True
Lecture 1
45 Conditional: why FF is True
Lecture 1
46 Conditional: why FF is True
Lecture 1
47 Conditional: why FF is True
Lecture 1
48 Conditional: why FF is True
Lecture 1
49 Conditional: why FF is True
Lecture 1
50 An equivalent for implication
Is there an expression that is equivalent to p → q but uses
only the operators ¬, Λ, V?
Implication
p q p→q
F F T
F T T
Consider the
T F F
proposition ¬p V q
T T T
p q ¬p ¬p V q
F F T T
F T T T
T F F F
T T F T
50
51
p q pq
Lecture 1
52 Conditional: why FF is True
Lecture 1
53 Conditional: synonyms
There are many ways to express the conditional
statement p q :
If p then q. p implies q. If
p, q. p only if q. p
is sufficient for q.
Some of the ways reverse the order of p and q but have
the same connotation:
q if p. q whenever p. q is necessary for p.
To aid in remembering these, I suggest inserting “is true”
after every variable:
EG: “p is true only if q is true”
Lecture 1
54 Bi-Conditional -- truth table
For p to be true, p and q must have
q
the same truth value. Else, p q is
false: p q pq
T T T
T F F
F T F
Q : WhichF operator is
F the opposite
T of?
Lecture 1
55 Bi-Conditional
A: has exactly the opposite truth table
as .
This means that we could have defined the
bi-conditional in terms of other previously
defined symbols, so it is redundant. In
fact, only really need negation and
disjunction to define everything else.
Extra operators are for convenience.
Q: Could we define all other logical operations
using only negation and exclusive or?
Lecture 1
56 Bi-Conditional
Lecture 1
57 Precedence of Logical Operators
Lecture 1
Home Work
Give a shot to first 14 question that are under the section of 1.1
(Exercise 1.1)