Professional Documents
Culture Documents
by
Dr. RAJENDRA KUMAR KONA
MATHEMATICAL LOGIC
Module -1
Couse outcomes
1. Write English sentences for logical expressions and vice-
versa. Use standard notations of propositional logic.
2. Complete and use truth tables for expressions involving the
following logical connectives: negation, conjunction,
disjunction, conditional, and biconditional.
3. Define and use the terms: proposition (statement), converse,
inverse, contrapositive, tautology, and contradiction.
4. Apply standard logical equivalences. Be able to prove that
two logical expressions are or are not logically equivalent.
5. Determine if a logical argument is valid or invalid. Apply
standard rules of inference including (but not limited to)
Modus Ponens, Modus Tollens, Transitivity, and Elimination.
Recognize fallacies such as the Converse Error and the
Inverse Error.
October 15, 2020 Dr. KRK 2
• What is logic
• Applications of Logic
P Q P^Q
T T T
T F F
F T F
F F F
October 15, 2020 Dr. KRK 12
Example
• Let p and q be the propositions
• p : It is below freezing. q : It is snowing.
• Write these propositions using p and q and
logical connectives (including negations).
• a) It is below freezing and snowing.
• b) It is below freezing but not snowing.
• c) It is not below freezing and it is not
snowing.
• Ans: a ) p ꓥ q. b) pꓥ ┐q. c) ┐pꓥ ┐q.
• P: Jack went up the hill Q: Jill went up the hill
October 15, 2020 Dr. KRK 13
disjunction
• The disjunction of p and q, denoted by p ∨ q,
is the proposition “p or q.” The disjunction
p ∨ q is false when both p and q are false and is
true otherwise.
P Q PꓦQ
•
T T T
T F T
F T T
F F F
October 15, 2020 Dr. KRK 14
Example
• P: The earth is flat
• Q: 3+5=8
• P ∨ Q: The earth is flat or 3+5=8.
• The connective “∨” is not always the same as
the word “or” because it can be
• 1) Inclusive OR
Example: (P: buy a car, Q: buy a computer)
• 2) Exclusive OR
• Example: P: cse in engg. Q: Mech in engg.
• In logic we use Inclusive OR
October 15, 2020 Dr. KRK 15
exclusive OR
• The exclusive or of p and q, denoted by
(p ⊕ q), is the proposition that is true when
exactly one of p and q is true and is false otherwise.
p q p⊕ q
T T F
T F T
F T T
F F F
• P: There is flood
• Q: crop will be destroyed
• P → Q : If there is flood then the crop will be
destroyed.
• P: Rajesh will pass the exam
• Q: Rajesh works hard
• Q → P : If rajesh works hard then he will
pass the exam.
• Ans: Contrapositive
• The inverse of (p → q ) is (˥ p → ˥ q ) .
• Therefore the converse of (˥ p → ˥ q ) is
(˥q → ˥p), which is contrapositive of (p → q )
.
Answers: Inverse
Contrapositive
Inverse
Converse
October 15, 2020 Dr. KRK 25
BICONDITIONALS
• The bi-conditional statement p ↔ q is the
proposition “p if and only if q.”
• The bi-conditional statement p ↔ q is true
when p and q have the same truth values,
and is false otherwise.
• Truth table P Q P↔Q
T T T
T F F
F T F
F F T
October 15, 2020 Dr. KRK 26
Biconditional
• Bi-conditional statements are also called
bi-implications.
• the bi-conditional statement p ↔ q uses the
abbreviation “iff” for “if and only if.”
• Note that p ↔ q has exactly the same truth value
as (p → q) ∧ (q → p).
• That is p ↔ q ⇔ (p → q) ∧ (q → p).
• Example: P : You can take the flight.
• Q : You buy a ticket.
• Then P ↔ Q is the statement.
• “You can take the flight iff you buy a ticket”.
October 15, 2020 Dr. KRK 27
Construct the truth tables
• Construct a truth table for each of these
compound propositions.
• a) (p ∧ ˥ p) b) (p ∨ ˥ p) c) (p ∨ ˥ q) → q
• d) (p ∨ q) → (p ∧ q) p ˥p p∧˥p
• e) (p → q) ↔ (˥ q → ˥ p)
T F F
• f ) (p → q) → (q → p).
F T F
• Ans: a) F F b) T T c) T F T F d) T F F T
• e) T T T T f) T T F T
October 15, 2020 Dr. KRK 28
Truthtables
• Construct truth tables for (P→Q), (˥Pꓦ Q)
T T F T T
T F F F F
F T T T T
F F T T T
P Q R Q→R P→(Q → R)
• 2) P→(Q → R) T T T T T
T T F F F
• Sol: T F T T T
T F F T T
F T T T T
F T F F T
F F T T T
F F F T T
October 15, 2020 Dr. KRK 29
Construct a truth table for each of these compound
propositions.
• 1) p → (˥ q ∨ r)
p q r ˥q ˥q ∨ r p → (˥q ∨ r)
T T T F T T
T T F F F F
T F T T T T
T F F T T T
F T T F T T
F T F F F T
F F T T T T
F F F T T T
October 15, 2020 Dr. KRK 30
2) ˥ p → (q → r)
p q r ˥p q → r ˥p → ( q →r)
T T T F T T
T T F F F T
T F T F T T
T F F F T T
F T T T T T
F T F T F F
F F T T T T
F F F T T T
October 15, 2020 Dr. KRK 31
practice
• Construct truth tables for:
• 1) (pꓦq) ꓦ ˥ p
• 2) ˥(˥ p ꓦ ˥ q) 3) ˥(˥ p ꓥ ˥ q)
• 4) (p ꓥ q)ꓦ(q ꓥ r)ꓦ(r ꓥ p)
• 5) (p→q) ꓥ (┐p→q) 6) p→(┐q ꓦ r)
• 7) [(pꓦ q) ꓥ (┐r)]↔ (q→ r)
T F F T T
F T T T T
F F T F T
October 15, 2020 Dr. KRK 33
7. [(pꓦ q) ꓥ (┐r)]↔ (q→ r)=A
P q r ┐r (pꓦ q) [(pꓦ q) ꓥ (q→ r) A
(┐r)]
T T T F T F T F
T T F T T T F F
T F T F T F T F
T F F T T T T T
F T T F T F T F
F T F T T T F F
F F T F F F T F
F F F T F F T F
October 15, 2020 Dr. KRK 34
Construct the truth table for
(p ꓥ q)ꓦ(q ꓥ r)ꓦ(r ꓥ p)
P q r pꓥq qꓥ rꓥ (p ꓥ q)ꓦ(q ꓥ (p ꓥ q)ꓦ(q ꓥ r)ꓦ(r ꓥ p)
r p r)
T T T T T T T T
T T F T F F T T
T F T F F T F T
T F F F F F F F
F T T F T F T T
F T F F F F F F
F F T F F F F F
F F F F F F F F
October 15, 2020 Dr. KRK 35
Tautology and contradiction
• Tautology: A statement formula which is true
regardless of the truth values of the statements
which replace the variables in it is called a
universally valid formula or a Tautology.
Example: (p ꓦ ˥ p) .
p ˥p pꓦ˥p
T F T
F T T
October 15, 2020 Dr. KRK 36
Tautology and contradiction(contd..)
T T T T T
T F F T T
F T F T T
F F F F T
• Therefore (p ꓥ q) → (p ꓦ q) is a Tautology.
• 2) (p ꓦ q) ꓥ(˥ p ∧ ˥ q)
• Sol: 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 F
October 15, 2020 Dr. KRK 39
Determine whether each of the following form is a
tautology or a contradiction or neither :
• 3) ˥P →(P →Q)
• Sol : P Q ˥P P →Q ˥P →(P →Q)
T T F T T
T F F F T
F T T T T
F F T T T
T T F T T T
T F F F F T
F T T T T T
F F T T T T
October 15, 2020 Dr. KRK 41
p ↔ q ⇔ (p → q) ∧ (q → p)
p q (p → q) (q → p) (p → q) ∧ (q → p) p↔q (p ↔ q ) ↔
p → q) ∧ (q → p)
T T T T T T T
T F F T F F T
F T T F F F T
F F T T T T T
P Q ˥P Pꓥ˥ (P ꓥ ˥ P ) ꓦ Q (P ꓥ ˥ P ) ꓦ Q ↔Q
• Sol: P
T T F F T T
T F F F F T
F T T F T T
F F T F F T
T T F F T F F T
T F F T F T T T
F T T F F T T T
F F T T F T T T
P q r (p →q) (p → r) (p →q) ꓥ (p → r) (q ꓥ p → (q ꓥ r) A
r)
T T T T T T T T T
T T F T F F F F T
T F T F T F F F T
T F F F F F F F T
F T T T T T T T T
F T F T T T F T T
F F T T T T F T T
F F F T T T F T T
October 15, 2020 Dr. KRK 46
Logical Equivalences
Equivalence Name
p∧T⇔ p Identity laws
p∨F⇔ p
p∨T⇔T Domination laws
p∧F⇔F
p∨p⇔p Idempotent laws
p∧p⇔p
˥( ˥p) ⇔ p Double negation law
p∨q⇔q∨p Commutative laws
p ∧ q ⇔q ∧ p
(p ∨ q) ∨ r ⇔ p ∨ (q ∨ r) Associative laws
(p ∧ q) ∧ r ⇔ p ∧ (q ∧ r)
p ∨ (q ∧ r) ⇔ (p ∨ q) ∧ (p ∨ r) Distributive aws
p ∧ (q ∨ r) ⇔ (p ∧ q) ∨ (p ∧ r)
p ∨ (p ∧ q) ⇔ p Absorption laws
p ∧ (p ∨ q) ⇔ p
p ↔ q ⇔ (p → q) ∧ (q → p)
p ↔ q ⇔ ˥p ↔˥q
p ↔ q ⇔ (p ∧ q) ∨ (˥p ∧˥q)
˥(p ↔ q) ⇔ p ↔˥q
October 15, 2020 Dr. KRK 50
Substitution Instance
• A formula A is called a substitution instance of another
formula B if A can be obtained form B by substituting
formulas for some variables of B, with the condition that the
same formula is substituted for the same variable each time
it occurs.
• Example: Let B : P → (J ∧ P ).
• Substitute R↔S for P in B, we get
• : (R ↔ S) → (J ∧ (R ↔ S))
• Then A is a substitution instance of B.
• Note that (R ↔ S) → (J ∧P) is not a substitution instance of
B because the variables
• P in J ∧ P was not replaced by R ↔ S.
T T F F T T T
T F F T F F T
F T T F T T T
F F T T T T T
• Therefore ˥(P→Q ) ⇒ P. T T T
T F F
•
F T T
F F T
T T T T T T T F F
T T F F T T T F F
T F T T T T F T T
T F F F F T F T F
F T T F T T T F F
F T F F T F F T T
F F T F F T F T F
F F F F F F F T F
P Q R (P ∧ Q) (P ∧ Q) ∨ R (P → R) A
T T T T T T T
T T F T T F F
T F T F T T T
T F F F F F F
F T T F T T T
F T F F F T F
F F T F T T T
F F F F F T F
T T F F T F F F
T F F T F T F F
F T T F F F T F
F F T T F F F T
October 15, 2020 Dr. KRK 80
•Principal disjunctive normal form(PDNF):
. An equivalent formula consisting of disjunctions of min terms
. only is known as its principal disjunctive normal form
. (sum-of-products form) or simply PDNF.
• Obtain the PDNF of P→ Q
• Sol: The truth table of P→ Q is
P Q P→ Q Minterm
T T T PꓥQ
T F F P ꓥ ˥Q
F T T ˥P ꓥ Q
F F T ˥P ꓥ˥Q
T T F P ꓥ Q ꓥ ˥R PꓦQꓦ˥R
T F T P ꓥ ˥Q ꓥ R Pꓦ˥QꓦR
T F F P ꓥ ˥Q ꓥ ˥R Pꓦ˥Qꓦ˥R
F T T ˥P ꓥ Q ꓥ R ˥PꓦQꓦR
F T F ˥P ꓥ Q ꓥ ˥R ˥PꓦQꓦ˥R
F F T ˥P ꓥ ˥Q ꓥ R ˥Pꓦ˥QꓦR
F F F ˥P ꓥ ˥Q ꓥ ˥R ˥Pꓦ˥Qꓦ˥R
p
2
• 3 p
(p1 ∧ p2 ∧ · · · ∧ pn) → q is a tautology,ie p --→(*)
n
−−−
q
October 15, 2020 Dr. KRK 94
Theory of inference using truth table
• Sol:
• [1] (1) (C ꓦ D) Rule P
• [2] (2) (C ꓦ D) → ˥H Rule P
• [1,2] (3) ˥H Rule T
• [4] (4) ˥H →(A ∧ ˥ B) Rule P
• [1,2,4] (5) (A ∧ ˥ B) Rule T
• [6] (6) (A ∧˥ B) →(R ꓦ S) Rule P
• [1,2,4,6] (7) (R ꓦ S) Rule T
• Hence (R ꓦ S) follows logically from the premises.
October 15, 2020 Dr. KRK 105
Show that (R ꓦ S) follows logically from the premises
(C ꓦ D), (C ꓦ D) → ˥H, ˥H →(A ∧ ˥ B) and (A ∧˥ B) →(R ꓦ S)
• Sol:
• [1] (1) (C ꓦ D) → ˥H Rule P
• [2] (2) ˥H →(A ∧˥B) Rule P
• [1,2] (3) (C ꓦ D) → (A ∧˥B) Rule T,(Syllogism)
• [4] (4) (A ∧˥B) →(R ꓦ S) Rule P
• [1,2,4] (5) (C ꓦ D) → (R ꓦ S) Rule T,(Syllogism)
• [6] (6) (C ꓦ D) Rule P
• [1,2,4,6] (7) (R ꓦ S) Rule
T ,(addition)
• Hence (R ꓦ S) follows logically from the premises.
• Solution:
Let p: “It is sunny this afternoon.”
q: “It is colder than yesterday.”
r: “We will go swimming.”
s: “We will take a jolly trip.”
t: “We will be home by sunset.”
• Symbolically:
p q, r → p, r → s, s → t t
• Sol: [1] (1) ˥Pꓥq Rule P
• [1] (2) ˥p Rule T
• [1] (3) q Rule T,
• [4] (4) r→p Rule P [(P → Q)⇔ (˥P ꓦ Q)]
• [1,4] (5) ˥r Rule T, (Modus Tollens)
• [6] (6) ˥r →s Rule P
• [1,4,6] (7) s Rule T,
• [8] (8) s →t Rule P (Modus Ponens)
• [1,4,6,8] (9) t Rule T.