You are on page 1of 25

BAMS1623

Discrete Mathematics
Chapter 2 Logic

Content
 Statements Calculus: logical connectives
and compound statements
 Truth table, tautology, contradiction and
contingency
 Normal forms
 Predicate calculus: quantifiers, universes

1
Introduction
Logic
- the discipline that deals with the methods
of reasoning.
- on elementary level, logic provides rules
and techniques for determining whether a
given argument is valid.

Statement (Proposition)
Statement or Proposition is a declarative sentence that
is either true or false, but not both.

Example:

The temperature on the surface of the planet Venus is 800 oF

The sun will come out tomorrow

2
Logical Connectives and
Compound Statement

 In mathematics, letters x, y, z denote variables that can


be replaced by real numbers.

 In logic, letters p,q,r,…denote propositional variables that


can be replaced by statements.

 The truth value of a compound statement depends on


the truth values of the statements being combined and
on the types of connectives being used.

Negation
 If p is a statement, the negation of p is the statement
not p, denoted by ~p.

 ~p is the statement “it is not the case that p.”

 If p is true, then ~p is false and if p is false then ~p is


true.

 The truth value of ~p relative to p is given as follows:

A table giving the truth values in terms of its component parts, is


called a truth table

3
Worked example: Negation

a) ~p: 2+3 ≤ 1

Conjunction

 If p and q are statements, the conjunction of p and q is the


compound statement “p and q”, denoted by p  q. The
connective “and” is denoted by  .

 The compound statement p  q is true when both p and q


are true; otherwise it is false.

 The truth values of p and q is given as follows:

4
Worked Example: Conjunction

Form the conjunction of p and q for

a) p:2 < 3 q:-5 > -8


b) p: it is snowing q: 3 < 5

Solution :

a) p  q : 2 < 3 and -5 > -8


b) p  q : it is snowing and 3 < 5

Disjunction

 If p and q are statements, the disjunction of p and q is the


compound statement “p or q”, denoted by p  q. The
connective “or ” is denoted by  .

 The compound statement p  q is true if at least one of the


p and q is true; it is false when both p and q are false.

 The truth values of p  q is given as follows:

5
Worked example: Disjunction
Solution:

pvq

Example: Truth table

p q r

T T
T F
F T
F F

6
Conditional Statement
 If p and q are statements, the compound statement “if p
then q”, denoted by p  q , is called a conditional
statement or implication. The statement p is called the
antecedent or hypothesis, and the statement q is called
the consequent or conclusion.
 The connective “if…then…” is denoted by the symbol 
 p is a sufficient condition for q; q is a necessary condition
for p.
 p  q is false only if p is true and q is false

Implication of p  q

converse of p  q : q  p

contrapositive of p  q : ~ q  ~p
inverse of p  q : ~ p  ~ q

Example: Give the converse and the contrapositive of


the implication “If it is raining, then I get wet.”

Solution:

7
Biconditional

 If p and q are statements, the compound statements


are p if and only if q, denoted by p  q , is called a
biconditional.
 The connective if and only if is denoted by the symbol .
 p  q is true only when both p and q are true or when
both are false.
 p  q can also be stated as p is a necessary and
sufficient condition for q.

Worked Example:
Example 1:

Solution: Let p be the statement 3 > 2 and q be the statement 0 < 3 – 2.


Since both p and q are true, we conclude that p  q is true.

Example2:

Solution:

8
Tautology, Contradiction, Contingency

Tautology
A statement that is true for all possible values of its
propositional variables.

Contradiction (Absurdity)
A statement that is always false.

Contingency
A statement that can be either true or false

Worked Example

9
Equivalent

Example: Show that

shows the statement is tautology, hence

Another way is to compare the column of each statement if they are


identical

Worked Example

Alternatively, the question will ask in this way “ Show that ( p  q)  (~ p)  q

10
Important Tautologies

Theorem 3

Properties of the operations of Propositions


Theorem 1

10 and 11 DeMorgan’s Law

Negation Properties
p ~ p  t; p  ~ p  c

Identity Properties
p  t  p; p  c  p
Domination Law
p  t  t; p  c  c

11
Properties of Implication Operation
Theorem 2
Proved in slide 20
Proved in slide 16

Alternative way – truth table

Normal Form

12
Normal Form (disjunctive and
conjunctive)

Normal Form (disjunctive and


conjunctive) (Con’t)

PCNF E = ~PDNF ~E

PCNF ~ E = ~PDNF E

13
Example
DNF E = ( P  Q )  ( P  ~ Q )  (~ P  Q )

DNF ~E =

CNF E= ~DNF~E

CNF ~E =

Worked Example: DNF and CNF

Theorem 2

Theorem 2

Distributive Law

Negation Law

Identity Law

( P  Q  R)  ( P  ~ Q)  (~ P  Q) DNF ?

14
Worked Example: DNF and CNF (Con’t)

Find CNF of E

From the previous slide,


De Morgan’s Law

Worked Example: DNF and CNF (Using


truth table)

Let E= (~ P ~ Q)  ( P  ~ Q)

15
Exercise

~PDNF (~A)

~PDNF (A)

Worked Example(Validity of argument)

Solution

* Critical row

16
Example 1
Show that the conclusion c: r follows from the
Premises H1: p v q H2: p  r H3: q  r
Solution
H1 H2 H3
p q r pvq p -> r q -> r Conclusion
T T T T T T T
T T F T F F F
T F T T T T T
T F F T F T F
F T T T T T T
F T F T T F F
F F T F T T T
F F F F T T F

valid

Exercise
Check the validity of the following statements:
(i) [~q˄(p→q)] =>~p p q ~q  p->q => ~p
T T F F T T F
T F T F F T F
F T F F T T T
F F T T T T T

(ii) [(p→q)˅(q→r)]=>(p→r)  [~q˄(p→q)] =>~p is valid

p q r p->q  q->r => p->r


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

 [(p→q)˅(q→r)]=>(p→r) is invalid

17
Predicates and Quantifiers

 In grammar, the word “ predicate” refers to the part of a sentence that


gives information about the subject.
 E.g. “ James is a student at TAR college.” The word James is the
subject and the phrase is a student at TAR college is the predicate.
Hence, the predicate is the part of the sentence from which the
subject has been removed.

 In logic, predicates can be obtained by removing some or all of the


nouns from a statement.
 E.g. Let P stand for “is a student at TAR college” and let Q stand for
“is a student at.” Then both P and Q are predicate symbols. The
sentences “ x is a student at TAR college.” and “x is a student at
y” are symbolized by P(x) and Q(x, y) respectively, where x and y
are predicate variables that take values in appropriate sets.

Predicates and Quantifiers (Con’t)

For simplicity, we define a predicate to be a predicate symbol


together with suitable predicate variables. For example, P(x), Q(y),
R(s,t)
E.g. Let A = {x ı x is an integer < 8}
P(x) is the sentence x is an integer < 8. Thus P(x) is the
predicate and if x = 1, P(1) is a statement which happens
to be true.

Definition
A predicate is a sentence that contains a finite number of
variables and becomes a statement when specific values are
substituted for the variables. The domain of a predicate
variable is the set of all values that may be substituted in place
of the variable.

18
The Universe of Discourse

 Variables which are quantified stand for only those


objects which are members of a particular set.
 Such set is called the Universe of discourse
(Domain/Universe)
 The universe may be numbers, or some other
objects and the truth value of a statement depends
upon the universe.
 E.g.: Let P(x) be the predicate “x2 > x” with the domain
(universe) which is the set of R of all real numbers

Quantification

Quantification

Universal Existential
• A statement “ For all values of x , • A statement “There exists a
P(x) is true.” value of x for P(x) is true.”
• Can also be stated as “ for every • Can be read “there is an x,”
x,” “every x” or “ for any x.” “there is some x,” “there exists
an x,” or “there is at least one
• is denoted by x P ( x )
x.”
•symbol  is universal quantifier
• is denoted by x P ( x )
• symbol 

19
Universal Quantification
Definition – The universal quantification of P(x) is the proposition
“P(x) is true for all values of x in the universe of
discourse”

 When all the elements in the universe can be listed – say, x1,x2,…xn
– it follows that the universe quantification x P( x ) is the same as
the conjunction P(x1)˄P(x2)˄P(x3)˄…˄P(xn), since this conjunction is
true if and only if P(x1),P(x2),P(x3),…,P(xn) are all true.

 To disprove a statement, we need only show a counterexample.

Example:

Let Q(x): x + 1 < 4 and let universe be R.

x Q( x )

Existential Quantification

Definition – The existential quantification of P(x) is the proposition


“There exists an element in x in the universe of discourse
such that P(x) is true.”

 When all the elements in the universe can be listed – say, x1,x2,…xn
– it follows that the existential quantification x P( x ) is the same as
the disjunction P(x1)˅P(x2) ˅P(x3) ˅… ˅ P(xn), since this disjunction
is true if and only if at least one of P(x1),P(x2),P(x3),… P(xn) is true.

20
Worked Example: Existential Quantification

Example1:

True statement, because Q(2) is true

Example2:

Scope of Quantifier

21
Worked Example

Show the scope of each quantifier in the following expression:

(x)( P ( x, y )  (y )Q ( x, y ))

Is the given expression a statement? If not, state which variable is


a free variable.

Scope for  

Scope for  

22
Exercise
 Determine the truth value for each of the following
statements. If it is false, give a counterexample.
(i) x  Z  , y  Z  such that x  y  1.

x  R, y  R such that xy  1.

Exercise
 Let S = {-17,-9,-1,1,4,16,20,31,36,42}. Determine which of the
following statements are true and which are false. Provide
counterexample for those statements that are false.

x  S , if x is less than 0, then x is odd.


x  S , if x is even, then x  0.
x  S , if x is odd , then x  0.
x  S , if the ones digit of x is 2, then the tens digit is 2 or 3.
x  S , if the ones digit of x is 6, then the tens digit is 2 or 4.

23
Exercise
Let A={1,2,3} and B={6,7,8}. Consider the quantified
statement (x  A)(y  B )( x  y  12)

(i) Eliminate the quantified statement in (x  A)(y  B )( x  y  12) 6m

Exercise
(i) Show the scope of quantifier in the following
expression (y )( P( x, y )  (x)Q( x, y ))

Determine whether the given expression is a


statement or not. If not, state the reason
(ii) Negate the following expression:
(x)(y )(~ P ( x, y )  Q( y ))

24
Exercise
Consider A = (p  q)  ((p v ~q)  (p ˄ q))
(i) Construct the truth table for A
(ii) Determine if A is tautology, contradiction or contingency.
(iii) Write down the PDNF of A and PCNF of ~A from the truth table.
(iv) Use the rules of logic to simplify A to ( p ˅ q). (13 marks)

p q ~q (p→ q) → (p v ~ q) → (p ˄ q)
T T F T T T T T
T F T F T T F F
F T F T T F T F
F F T T F T F F

(ii) Contingency (iii)PDNF of A = ( p ˄ q) ˅ ( p ˄ ~q) ˅ ( ~p ˄ q)


A = (p  q)  ((p v ~q)  (p ˄ q)) PCNF of ~A = (~p ˅ ~q) ˄ (~p ˅ q) ˄ (p ˅ ~q)
= ~ (~p v q) v (~ (p v ~q) v (p ˄ q))
= (p ˄ ~q) v ((~p ˄ q) v (p ˄ q))
= (p ˄ ~q) v ((~p v p) ˄ q)
= (p ˄ ~q) v q
= (p ˅ q) ˄ (q ˅~q)
= (p ˅ q) ˄ t
= (p ˅ q)

Exercise
Given expression A = p ˄(q →~r).
(i) Construct a truth table for A. Determine
whether the expression is a tautology,
contradiction or contingency.
(ii) Obtain the PDNF and PCNF for A and ~A.

Continegency

PDNF of A = (p˄q˄~r)˅ (p˄~q˄r) ˅ (p˄~q˄~r)


PDNF of ~A = (p˄q˄r)˅ (~p˄q˄r) ˅ (~p˄q˄~r) ˅ (~p˄~q˄r) ˅ (~p˄~q˄~r)

PCNF of A = (~p˅~q˅~r) ˄ (p˅~q˅~r) ˄ (p˅~q˅r) ˄ (p˅q˅~r) ˄ (p˅q˅r)


PCNF of ~A = (~p˅~q˅r) ˄ (~p˅q˅~r) ˄ (~p˅q˅r)

25

You might also like