Lec 5 Truth Tables

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

1-Logic

Set of Integers:
• • • • • •
3 -2 -1 0 1 2

Set of Real Numbers:

• • • • • • •
-3 -2 -1 0 1 2 3

What is Discrete Mathematics?

Discrete Mathematics concerns processes that consist of a sequence of individual steps.

LOGIC:

Logic is the study of the principles and methods that distinguish between a
valid and an invalid argument.

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

EXAMPLES:

a. 2+2 = 4,
b. It is Sunday today

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:
Propositions Not Propositions
1) Grass is green. 1) Close the door.
2) 4 + 2 = 6 2) x is greater than 2.
3) 4 + 2 = 7 3) He is very rich
4) There are four fingers in a hand.

Rule:
If the sentence is preceded by other sentences that make the pronoun or variable reference
clear, then the sentence is a statement.
Example
Example:
x=1 Bill Gates is an American
x>2 He is very rich
“x > 2” is a statement with truth-value “He is very rich” is a statement with truth-
FALSE. value TRUE.

4
1-Logic

UNDERSTANDING STATEMENTS
1) x + 2 is positive. Not a statement
2) May I come in? Not a statement
3) Logic is interesting. A statement
4) It is hot today. A statement
5) -1 > 0 A statement
6) x + y = 12 Not a statement

COMPOUND STATEMENT:
Simple statements could be used to build a compound statement.

LOGICAL CONNECTIVES

EXAMPLES:

1. “3 + 2 = 5” and “Lahore is a city in Pakistan”


2. “The grass is green” or “ It is hot today”
3. “Discrete Mathematics is not difficult to me”

AND, OR, NOT are called LOGICAL CONNECTIVES.

SYMBOLIC REPRESENTATION
Statements are symbolically represented by letters such as p, q, r,...

EXAMPLES:

p = “Islamabad is the capital of Pakistan”


q = “17 is divisible by 3”

CONNECTIVE MEANINGS SYMBOLS CALLED

Negation not ~ Tilde

Conjunction and ∧ Hat

Disjunction or ∨ Vel

Conditional if…then… → Arrow

Biconditional if and only if ↔ Double arrow

5
1-Logic

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. p∨q
4.It is not hot but sunny. ~ p ∧q
5.It is neither hot nor sunny. ~p∧~q

EXAMPLE

Let h = “Zia is healthy”


w = “Zia is wealthy”
s = “Zia is wise”
Translate the compound statements to symbolic form:
1) Zia is healthy and wealthy but not wise. (h ∧ w) ∧ (~ s)
2) Zia is not wealthy but he is healthy and wise. ~ w ∧ (h ∧ s)
3) Zia is neither healthy, wealthy nor wise. ~h∧~w∧~s

TRANSLATING FROM SYMBOLS TO ENGLISH:


Let m = “Ali is good in Mathematics”
c = “Ali is a Computer Science student”

Translate the following statement forms into plain English:

1) ~ c Ali is not a Computer Science student


2) c∨ m Ali is a Computer Science student or good in Maths.
3) m ∧ ~ c Ali is good in Maths but not a Computer Science student

A convenient method for analyzing a compound statement is to make a truth


table for it.

Truth Table
A truth table specifies the truth value of a compound proposition for all
possible truth values of its constituent propositions.

6
1-Logic

NEGATION (~):
If p is a statement variable, then negation of p, “not p”, is denoted as “~p”
It has opposite truth value from p i.e., if p is true, then ~ p is false; if p is false, then ~ p is
true.

TRUTH TABLE FOR ~ p

p ~p

T F

F T

CONJUNCTION (∧):
If p and q are statements, then the conjunction of p and q is “p and q”, denoted as
“p ∧ q”.

Remarks
o p ∧ q is true only when both p and q are true.
o If either p or q is false, or both are false, then p ∧ q is false.

TRUTH TABLE FOR p ∧ q

p q p∧q

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

DISJUNCTION (∨) or INCLUSIVE OR

If p & q are statements, then the disjunction of p and q is “p or q”, denoted as


“p ∨ q”.

Remarks:
o p ∨ q is true when at least one of p or q is true.
o p ∨ q is false only when both p and q are false.

7
1-Logic

TRUTH TABLE FOR p ∨ q

p q p∨q

T T T

T F T
F T T

F F F

Note it that in the table F is only in that row where both p and q have F and all other
values are T. Thus for finding out the truth values for the disjunction of two statements
we will only first search out where the both statements are false and write down the F in
the corresponding row in the column of p ∨ q and in all other rows we will write T in the
column of p ∨ q.

Remark:
Note that for Conjunction of two statements we find the T in both the
statements, But in disjunction we find F in both the statements. In other words, we will
fill T in the first row of conjunction and F in the last row of disjunction.

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.

8
2-Truth Tables

Truth Tables

Truth Tables for:

1. ~p∧q
2. ~ p ∧ (q ∨ ~ r)
3. (p∨q) ∧ ~ (p∧q)

Truth table for the statement form ~ p ∧ q

p q ~p ~p∧q
T T F F
T F F F
F T T T
F F T F

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
F F F T T T T
Truth table for (p∨q) ∧ ~ (p∧q)

p q p∨q p∧q ~ (p∧q) (p∨q) ∧ ~ (p∧q)


T T T T F F
T F T F T T
F T T F T T
F F F F T F
2-Truth Tables

USAGE OF “OR” IN ENGLISH


In English language the word OR is sometimes used in an inclusive sense (p or q or
both).

Example: I shall buy a pen or a book.


In the above statement, if you buy a pen or a book in both cases the statement is true and
if you buy both pen and book, then statement is again true. Thus we say in the above
statement we use or in inclusive sense.

The word OR is sometimes used in an exclusive sense (p or q but not both). As in the
below statement

Example: Tomorrow at 9, I’ll be in Lahore or Islamabad.


Now in above statement we are using OR in exclusive sense because if both the
statements are true, then we have F for the statement.

While defining a disjunction the word OR is used in its inclusive sense. Therefore, the
symbol ∨ means the “inclusive OR”

EXCLUSIVE OR:
When OR is used in its exclusive sense, The statement “p or q” means “p or q but not
both” or “p or q and not p and q” which translates into symbols as (p ∨ q) ∧ ~ (p ∧ q)
It is abbreviated as p ⊕ q or p XOR q

TRUTH TABLE FOR EXCLUSIVE OR:


p q p⊕q

T T F

T F T
F T T

F F F

TRUTH TABLE FOR (p∨q) ∧ ~ (p ∧ q)

p q p∨q p∧q ~ (p ∧ q) (p∨q) ∧ ~ (p ∧ q)

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

10
2-Truth Tables

Note: Basically
p ⊕ q ≡ (p ∧ ∼ q) ∨ (~ p ∧ q)
≡ [p ∧ ~ q) ∨ ~ p] ∧ [(p ∧ ~ q) ∨ q]
≡ (p ∨ q) ∧ ∼ (p ∧ q)
≡ (p ∨ q) ∧ (∼ p ∨ ~ q)

LOGICAL EQUIVALENCE
If two logical expressions have the same logical values in the truth table, then we say that
the two logical expressions are logically equivalent. In the following example, ~ (~ p ) is
logically equivalent p. So it is written as ~(~p) ≡ p

Double Negative Property ~(~p) ≡ p

p ~p ~(~p)
T F T
F T F

Example
Rewrite in a simpler form:
“It is not true that I am not happy.”
Solution:

Let p = “I am happy”
then ~ p = “I am not happy”
and ~ ( ~ p) = “It is not true that I am not happy”
Since ~ ( ~ p) ≡ p
Hence the given statement is equivalent to “I am happy”

Example
Show that ~ (p∧q) and ~ p ∧ ~ q are not logically equivalent
Solution:

p q ~p ~q p∧q ~(p∧q) ~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

Different truth values in row 2 and row 3

11
2-Truth Tables

DE MORGAN’S LAWS

1) The negation of an AND statement is logically equivalent to the OR statement in


which each component is negated.

Symbolically ~ (p ∧ q) ≡ ~ p ∨ ~ q

2) The negation of an OR statement is logically equivalent to the AND statement in


which each component is negated.

Symbolically ~ (p ∨ q) ≡ ~ p ∧ ~ q

Truth Table of ~ (p ∨ q) ≡ ~ p ∧ ~ q

p q ~p ~q p∨q ~(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

Same truth values


APPLICATION:

Give negations for each of the following statements:


a) The fan is slow or it is very hot.
b) Akram is unfit and Saleem is injured.

Solution:
a) The fan is not slow and it is not very hot.
b) Akram is not unfit or Saleem is not injured.

INEQUALITIES AND DEMORGAN’S LAWS:

Use DeMorgan’s Laws to write the negation of


-1 < x ≤ 4 for some particular real number x
Here, -1 < x ≤ 4 means x > –1 and x ≤ 4
The negation of ( x > –1 and x ≤ 4 ) is ( x ≤ –1 OR x > 4 ).

We can explain it as follows:


Suppose p : x > –1
q: x≤4
~ p : x ≤ –1
~q: x>4
The negation of x > –1 AND x ≤ 4
≡ ~(p∧q)

12
2-Truth Tables

≡ ~p ∨~q by DeMorgan’s Law,


≡ x ≤ –1 OR x > 4

EXERCISE:
1. Show that (p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
2. Are the statements ( p ∧ q ) ∨ r and p ∧ ( q ∨ r ) 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”.

EXAMPLE: The statement form p ∨ ~ p is tautology

p ~p p∨~p
T F T
F T T
p∨~p≡t

CONTRADICTION:
A contradiction is a statement form that is always false regardless of the truth values of
the statement variables. A contradiction is represented by the symbol “c”.

So if we have to prove that a given statement form is CONTRADICTION, we will make


the truth table for the statement form and if in the column of the given statement form all
the entries are F, then we say that statement form is contradiction.

EXAMPLE:
The statement form p ∧ ~ p is a 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 it is a
contradiction i.e. p ∧ ~ p ≡c

REMARKS:
– Most statements are neither tautologies nor contradictions.
– The negation of a tautology is a contradiction and vice versa.
– In common usage we sometimes say that two statement are contradictory.
By this we mean that their conjunction is a contradiction: they cannot both
be true.

13
2-Truth Tables

LOGICAL EQUIVALENCE INVOLVING TAUTOLOGY

1. Show that p ∧ t ≡ p

p t p∧t

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
p∧t≡p

LOGICAL EQUIVALENCE INVOLVING CONTRADICTION

Show that p ∧ c ≡ c

p c p∧c

T F F
F F F

There are same truth values in the indicated columns, so p ∧ c ≡ c

EXERCISE:
Use truth table to show that ( p ∧ q ) ∨ (~ p ∨ ( p ∧ ~q )) is a tautology.

SOLUTION:
Since we have to show that the given statement form is Tautology, so the
column of the above proposition in the truth table will have all entries as T. As clear from
the table below
p q p∧q ~p ~q p∧~q ~ p∨ (p ∧ ~q) (p ∧ q) ∨
(~p ∨ (p ∧ ~q))
T T T F F F F T
T F F F T T T T
F T F T F F T T

F F F T T F T T

Hence ( p ∧ q ) ∨(~ p ∨( p ∧ ~ q )) ≡ t

EXERCISE:
Use truth table to show that (p ∧ ~q) ∧(~p∨q) is a contradiction.

14
2-Truth Tables

SOLUTION:
Since we have to show that the given statement form is Contradiction, so its
column in the truth table will have all entries as F. As clear from the table below.
p q ~q p∧~q ~p ~p∨q ( p ∧ ~ q ) ∧( ~ p ∨ q )
T T F F F T F
T F T T F F F
F T F F T T F
F F T F T T F

LAWS OF LOGIC

1) Commutative Laws
p∧q ≡q∧ p
p∨q ≡q∨ p

2) Associative Laws
(p∧q ) ∧r ≡ p∧(q ∧r)
(p∨q ) ∨r ≡ p∨(q ∨r)

3) Distributive Laws
p∧(q∨r) ≡(p∧q ) ∨( p∧r)
p∨(q ∧r) ≡(p∨q ) ∧( p∨r)

4) Identity Laws
p∧t ≡p
p∨c≡p

5) Negation Laws
p ∨ ∼p ≡ t
p ∧ ∼p ≡ c

6) Double Negation Law


∼( ∼p) ≡ p

7) Idempotent Laws
p∧p≡p
p∨p≡p

8) DeMorgan’s Laws
~ ( p ∧ q ) ≡ ~p ∨ ∼q
~ ( p ∨ q ) ≡ ~p ∧ ∼q

9) Universal Bound Laws


p∨t≡t
p∧c ≡c

15
2-Truth Tables

10) Absorption Laws


p∨(p ∧q) ≡p
p∧(p ∨q) ≡p

11) Negation of t and c


~t≡c
~c≡t

16
FUNDAMENTALS OF MATHEMATICAL LOGIC

Review Problems
Problem 1.1
Indicate which of the following sentences are propositions.
a. 1,024 is the smallest four-digit number that is perfect square.
b. She is a mathematics major.
c. 128 = 26
d. x = 26 .

Problem 1.2
Consider the propositions:
p: Juan is a math major.
q: Juan is a computer science major.

Use symbolic connectives to represent the proposition ”Juan is a math major


but not a computer science major.”

Problem 1.3
In the following sentence is the word ”or” used in its inclusive or exclusive
sense? ”A team wins the playoffs if it wins two games in a row or a total of
three games.”

Problem 1.4
Write the truth table for the proposition: (p ∨ (∼ p ∨ q))∧ ∼ (q∧ ∼ r).

Problem 1.5
Let t be a tautology. Show that p ∨ t ≡ t.

Problem 1.6
Let c be a contradiction. Show that p ∨ c ≡ p.

Problem 1.7
Show that (r ∨ p) ∧ [(∼ r ∨ (p ∧ q)) ∧ (r ∨ q)] ≡ p ∧ q.

Problem 1.8
Use De Morgan’s laws to write the negation for the proposition:”This com-
puter program has a logical error in the first ten lines or it is being run with
an incomplete data set.”
1 PROPOSITIONS AND RELATED CONCEPTS

Problem 1.9
Use De Morgan’s laws to write the negation for the proposition:”The dollar
is at an all-time high and the stock market is at a record low.”

Problem 1.10
Assume x ∈ IR. Use De Morgan’s laws to write the negation for the proposition:0 ≥
x > −5.

Problem 1.11
Show that the proposition s = (p ∧ q) ∨ (∼ p ∨ (p∧ ∼ q)) is a tautology.

Problem 1.12
Show that the proposition s = (p∧ ∼ q) ∧ (∼ p ∨ q) is a contradiction.

Problem 1.13
a. Find simpler proposition forms that are logically equivalent to p ⊕ p and
p ⊕ (p ⊕ p).
b. Is (p ⊕ q) ⊕ r ≡ p ⊕ (q ⊕ r)? Justify your answer.
c. Is (p ⊕ q) ∧ r ≡ (p ∧ r) ⊕ (q ∧ r)? Justify your answer.

Problem 1.14
Show the following:
a. p ∧ t ≡ p, where t is a tautology.
b. p ∧ c ≡ c, where c is a contradiction.
c. ∼ t ≡ c and ∼ c ≡ t.
d. p ∨ p ≡ p and p ∧ p ≡ p.

You might also like