DS Lecture01
DS Lecture01
RECOMMENDED BOOKS
1
INTRODUCTION
What is Discrete Mathematics?
LOGIC
Logic is the study of the principles and methods that distinguishes between
a valid and an invalid argument.
Now what do we mean by the valid and invalid argument, we will study in
our next Lectures.
SIMPLE STATEMENT
A statement is a declarative sentence that is either true or false but not both.
A statement is also referred to as a proposition. So when we say a
statement or Proposition this must be clear to you that these are the same.
2
If a proposition is true, we say that it has a truth value of "true”.
If a proposition is false, its truth value is "false".
The truth values “true” and “false” are, respectively, denoted by the
letters T and F.
EXAMPLES OF STATEMENTS OR PROPOSITIONS:
1. Grass is green.
Grass is green is a statement (or proposition) because the sentence is
true and its truth value is T.( Because everyone knows that grass is
green)
2. 4+2=6
4 + 2 = 6 is also a statement and its truth value is T.(Because 4+2 is 6)
3. 4+2=7
4 + 2 = 7 is also a statement and its truth value is F. ( Because we
know that 4+2 is 6 not 7).Here you should note that both 2 and 3 are
statements although 4+2=7 is mathematically wrong.
4. There are four fingers in a hand.
There are four fingers in a hand is also a statement and its truth value
is false.
5. Washington, D.C, is the capital of the United States of America.
The above statement is also a proposition and its truth value is T.
6. Karachi is the capital of Pakistan. Karachi is the capital of Pakistan is
also a statement and its truth value is F.
7. Pervaiz Musharaf is the president of America.
The above sentence is a statement and its Truth value is false.
3
REMARK: Every sentence is not a statement.
EXAMPLES OF SENTENCES WHICH ARE NOT PROPOSITIONS:
RULE
If the sentence is preceded by other sentences that make the pronoun or
variable reference clear, then the sentence is a statement.
4
EXAMPLES
x=1 is a sentence which gives us the information about the variable
which is in the below sentence. .
x > 2 now using the value above we can see that our sentence takes the
form 1 > 2 now we can talk about its truth value . So
x > 2 is a statement with truth-value FALSE.
Similarly in the next example
Bill Gates is an American
He is very rich.
He is very rich is a statement with truth-value TRUE.
UNDERSTANDING STATEMENTS
1. x + 2 is positive.
The above sentence is not a statement because it is true for some
value of x and false for some values of x. We can say that the
truth value of the statement is vague
2. May I come in?
The above sentence is permission and hence we can't talk about its
truth values so it is also not a statement.
3. Logic is interesting.
Logic is interesting is a statement because logic is interesting and
its truth value is T.
4. It is hot today.
It is hot today is also a statement because whenever we say this
sentence then that day either hot or not so we can assign a truth
value to this sentence.
5. -1 > 0 is also a statement with truth value F
5
• x + y = 12 is not a statement.
COMPOUND STATEMENT
Simple statements could be used to build a compound statement.
EXAMPLES
1. “3 + 2 = 5” and “Lahore is a city in Pakistan”
Here 3 + 2 = 5 is a statement and Lahore is a city in Pakistan is
another statement we combine these two statements by using
and to form another statement and you can talk about its truth
value. Similarly in the next example we combine two statements
by using or to form another statement.
2. “The grass is green” or “ It is hot today”
SYMBOLIC REPRESENTATION
EXAMPLES
p = “Islamabad is the capital of Pakistan”
q = “17 is divisible by 3”
6
LOGICAL CONNECTIVES
Disjunction or Vel
EXAMPLES
p = “Islamabad is the capital of Pakistan”
q = “17 is divisible by 3”
p q = “Islamabad is the capital of Pakistan and 17 is divisible by 3”
p q = “Islamabad is the capital of Pakistan or 17 is divisible by 3”
~p = “It is not the case that Islamabad is the capital of Pakistan” or simply
“Islamabad is not the capital of Pakistan”
TRANSLATING FROM ENGLISH TO SYMBOLS
Let p = “It is hot”, and q = “ It is sunny”
SENTENCE SYMBOLIC FORM
1. It is not hot. ~p
2. It is hot and sunny. p q
3. It is hot or sunny. pq
4. It is not hot but sunny. ~ p q
7
5. It is neither hot nor sunny. ~p~q
EXAMPLE
p ~p
T F
F T 9
CONJUNCTION ()
If p and q are statements, then the conjunction of p and q is “p and q”,
denoted as “p q”.
It is true when, and only when, both p and q are true. If either p or q is false,
or if both are false, pq is false.
p q pq
T T T
T F F
F T F
F F F
Note that in the table T is only in that row where both p and q have T
and all other values are F. Thus for finding out the truth values for the
conjunction of two statements we will only first search out where the
both statements are true and write down the T in the corresponding row
in the column of p q and in all other rows we will write F in the
column of p q.
DISJUNCTION () or INCLUSIVE OR
SUMMARY
1. What is a statement?
2. How a compound statement is formed.
3. Logical connectives (negation, conjunction, disjunction).
4. How to construct a truth table for a statement form.
11
LECTURE # 1B
STATEMENT FORM
12
EXAMPLE
Write truth table for the statement form ~ p q
p q ~p ~pq
T T F F
T F F F
F T T T
F F T F
Here in order to complete this table we first fill the column for ~p
and from the definition of negation you know that it is false where p is true
and false where p is true.
Then we fill the column for ~ p q and you know that conjunction of two
statements is true omly when both the statements are true. So ~ p q is true
only where ~ p and q both have truth values T,which is third row . Hence we
have T in the column of ~ p q in the third row and write down F in all other
entries.
EXAMPLE
Construct truth table for ~ p (q ~ r)
p q r ~r q~r ~p ~ p (q ~ r)
T T T F T F F
T T F T T F F
T F T F F F F
T F F T T F F
F T T F T T T
F T F T T T T
F F T F F T F 13
F F F T T T T
EXAMPLE
LOGICAL EQUIVALENCE
Two statement forms are called logically equivalent if, and only if, they
have identical truth values for all possible truth values for their statement
variables.
The logical equivalence of statement forms P and Q is denoted by writing
P Q.
EXAMPLE
Double Negative Property ~(~p) p
p ~p ~(~p)
T F T
F T F
EXAMPLE
p q ~p ~q pq ~(pq) ~p ~q
T T F F T F F
T F F T F T F
F T T F F T F
F F T T F T T
Note that the entries in the last two columns are the same . Hence
the statements forms are logically equivalent that is
~(pq) and ~p ~q are not logically equivalent
15
DE MORGAN’S LAWS
~(p q) ~p ~q
p q ~p ~q pq ~(p q) ~p ~q
T T F F T F F
T F F T T F F
F T T F T F F
F F T T F T T
APPLYING
DE MORGAN’S LAWS
p q r pq qr (p q) r p (q r)
T T T T T T T
T T F T F F F
T F T F F F F
T F F F F F F
F T T F T F F
F T F F F F F
F F T F F F F
F F F F F F F
Since the last two column have the same entries in the columns so we have
their corresponding statement forms are equivalent. That is
(p q) r p (q r )
Which is known as the Associative Law for Conjunction.
17
EXERCISE
p q r pq (p q) r (q r) p (q r)
T T T T T T T
T T F T T T T
T F T F T T T
T F F F F F F
F T T F T T F
F T F F F T F
F F T F T T F
F F F F F F F
Now it is clear from above table that the entries of the given
statement forms are not identical so the statement forms are not
logically equivalent.
TAUTOLOGY
A tautology is a statement form that is always true regardless of the truth
values of the statement variables.
A tautology is represented by the symbol “t”.
So if we have to prove that a given statement form is TAUTOLOGY we
will make the truth table for the statement from and if in the column of the
given statement form all the entries are T ,then we say that statement form is
18
tautology.
EXAMPLE: The statement form p ~ p is tautology.
p ~p p~p
T F T
F T T
CONTRADICTION
p ~p p~p
T F F
F T F
Since in the last column in the truth table we have F in all the entries
so is a contradiction p ~p c
19
REMARKS
1. Show that p t p
p t pt
T T T
F T F
Since in the above table the entries in the first and last columns are
identical so we have the corresponding statement forms are Logically
equivalent that is
ptp
20
LOGICAL EQUIVALENCE INVOLVING CONTRADICTION
p c pc
T F F
F F F
F F F T T F T T
21
Hence (p q) (~p (p ~q)) t
EXERCISE
T T T T F F
T F T F T T
F T T F T T
F F F F T F
Note:
Basically
p q ≡ (p q)~p q)
≡ [p ~q) ~p] [(p ~q) q]
≡ (p q) p q)
≡ (p q) p ~q)
23
REASONING EXERCISES
24