0% found this document useful (0 votes)
119 views36 pages

Introduction to Mathematical Logic

This document provides an introduction to mathematical logic and predicate calculus. It discusses how logic uses symbolic language to precisely express principles and definitions. Predicate calculus generalizes propositional calculus and is important for computer science as it provides the logical foundation for logic programming languages like Prolog. The document then covers statement calculus and truth tables for evaluating compound statements formed by connecting atomic statements with logical connectives like negation, disjunction, conjunction, conditionals and biconditionals. Examples are provided to illustrate how to write symbolic logical expressions and construct truth tables.

Uploaded by

Imthiaz Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views36 pages

Introduction to Mathematical Logic

This document provides an introduction to mathematical logic and predicate calculus. It discusses how logic uses symbolic language to precisely express principles and definitions. Predicate calculus generalizes propositional calculus and is important for computer science as it provides the logical foundation for logic programming languages like Prolog. The document then covers statement calculus and truth tables for evaluating compound statements formed by connecting atomic statements with logical connectives like negation, disjunction, conjunction, conditionals and biconditionals. Examples are provided to illustrate how to write symbolic logical expressions and construct truth tables.

Uploaded by

Imthiaz Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unit – 1

Mathematical Logic
Introduction
Logic is the science dealing with the
methods of reasoning.
Logic which uses a symbolic language to
express its principles in precise and
unambiguous terms is known as
mathematical logic.
Mathematical logic has become an
accepted part of discrete mathematics.

Predicate calculus is the generalization of


prepositional calculus.
For the computer scientists, predicate
calculus is important for several reasons.
First it gives the logical underpinning to the
language of logic programming such as
Prolog.

Prepared by Dr. [Link], Professor, DoM 1


Second, predicate calculus is increasingly
used for specifying the requirement of
computer applications.
In the area of proving correctness,
predicate calculus allows one to precisely
state under which conditions a program
gives the correct output.
The main aim of the logic is to provide
certain rules for the arguments, they may be
legal arguments or mathematical proof or
scientific theory.
Rules of logic are used to provide proofs of
theorems in Mathematics, to verify the
correctness of computer programs and to
draw conclusions from scientific
experiments.
We can determine if any particular
argument or reasoning is correct or not,
based on the set of hypothesis.
A declarative sentence (or assertion)
which can assign only one of the truth
Prepared by Dr. [Link], Professor, DoM 2
values “True” or “False” is called a
proposition (or statement).
Sentences which are exclamatory,
interrogative or imperative are not
propositions.
1.1 Statement Calculus
In this section, we introduce certain basic
units of the language called atomic
(primitive, primary) statement, a sentence
which cannot be further broken down or
split into simpler sentences is called atomic
statement.
The atomic statements have only two
possible values, called “Truth value”.
The two truth values are ‘True’ and ‘False’
and are denoted by the symbol ‘T’ and ‘F’
(sometimes 1 and 0) respectively.
Consider the following examples
[Link] is in India.
[Link] is the capital of Tamilnadu.

Prepared by Dr. [Link], Professor, DoM 3


Obviously the statement (1) is True, and
(2) is False.
Therefore (1) is said to has the truth value
‘T’ and (2) has the truth value ‘F’. So, we
assign truth values to the atomic statements.
1.2 Standard Connectives
It is possible to construct complicated
statements called “molecular” or
“compound” statements by using certain
connecting words or expressions.
Thus the primary statements do not have
any connectives, but the compound
statements may have many connectives.
Truth Table
We use a table to find the possible truth
values of the compound statement (in all
possibilities). This is called the ‘Truth
Table’ for that statement.
If the compound statement have n variables
(n atomic statements), then the truth value

Prepared by Dr. [Link], Professor, DoM 4


will have 2n possibilities.
For example: If the compound statement
have two variables P and Q (atomic
statements), then the possible truth values
are given in the following truth table.
P Q
T T
T F
F T
F F
If the compound statement has 3 variables
P, Q and R, then the possible truth values

P T T T T F F F F
Q T T F F T T F F
R T F T F T F T F
Here, we study some of the connectives.

Prepared by Dr. [Link], Professor, DoM 5


Negation ( ) 
If P denotes a statement, then the negation
of P is written as 
P (also denoted as ~P,
NOT P, P ) and is read as “not P”. If P has
truth value T , then P has truth value F 
and if P has truth value F, then P has 
truth value T .
Consider the statement
P : Chennai is a city
Then 
P : Chennai is not a city
That is, P
means it is not the case that
Chennai is a city.

Truth Table for Negation


P P
T F
F T

Prepared by Dr. [Link], Professor, DoM 6


Disjunction (  )
The disjunction of two statements P and Q
is the statement P  Q and is read as “P or
Q”. The statement P  Q has the truth value
F, if both P and Q has the truth value F
otherwise it has the truth value T.
Truth Table for Disjunction
P Q P Q
T TT
F TT
T TF
F FF
For example, consider the following
statements:
P : There are ten birds
Q : There are five birds
Then P  Q : There are ten or five birds.
This is to say either of them is true.

Prepared by Dr. [Link], Professor, DoM 7


Conjunction (  )
The conjunction of two statements P and Q
is the statement P  Q, which is read as “P
and Q”. The statement P  Q has truth value
T if both P and Q have truth value T;
otherwise it has the truth value F.
For example, consider the following
statements:
P : Today is Monday
Q : This is the month of March
Then P  Q : Today is Monday and this is
the month of March.
It is to say that both P and Q are true.
Truth Table for Conjunction
P Q P Q
T T T
T F F
F T F
F F F

Prepared by Dr. [Link], Professor, DoM 8


Conditional Statements
If P and Q are any two statements, then the
statement ‘P  Q’ which is read as
“ If P, then Q” is called a ‘conditional’
statement.
The statement P  Q has truth value F if P
has truth value T and Q has truth value F;
otherwise it has the truth value T.

Truth Table for Conditional Statemen


P Q P Q
T T T
T F F
F T T
F F T
For example, consider the following
statements:
P : It is raining Today
Q : Today is a Holiday

Prepared by Dr. [Link], Professor, DoM 9


Then P  Q : If it is raining today, then
today is a holiday.

Biconditional Statements
If P and Q are any two statements, then the
statement “P  Q” which is read as ‘ P if
and only if Q’ (or P implies and is implied
by Q) is called ‘biconditional statement’,
which is abbreviated as ‘P iff Q’.
The statement P  Q has truth value T
only if both P and Q has the same truth
value; otherwise it has the truth value F.

Truth Table for Biconditional Statement


P Q P Q
T T T
T F F
F T F
F F T

Prepared by Dr. [Link], Professor, DoM 10


Note that, the truth values of (P  Q)
 (Q  P) and the truth values of P  Q
are identical, that is, the biconditional
statement is the statement obtained from the
conditional statements by using a
conjunction between P  Q and Q  P.
1.2.1 Well formed formula
If we connect three or more primary
statements at a time, an order should be
maintained in finding the truth values of the
compound statement.
When we connect two primary statements,
there must be parenthesis. One can note that
the statements P and Q are well ordered. The
statement formula, in which the order of
finding the truth values are indicated by
using parenthesis is called a well formed
formula (wff).

Prepared by Dr. [Link], Professor, DoM 11


Consider the following statements
1. P  Q is a wff.
2. (P  Q)  R is a wff.
3. P  Q  R is not a wff, while
P  (Q  R) is a wff (or) (P  Q) 
R is a wff.
4. (P  Q is not a wff, since one
parenthesis in the right is missing,
while (P  Q) (or) P  Q are wff.

Example 1: Let P : It is below freezing,


Q : It is snowing.
Write the symbolic form of the following:
(i) It is below freezing and snowing.
(ii) It is below freezing but not snowing.
(iii) It is not below freezing and it is not
snowing.
(iv) It is either snowing or below freezing.
(v) If it is below freezing, it is also
snowing.
Prepared by Dr. [Link], Professor, DoM 12
(vi) That it is below freezing is necessary
and sufficient for it to be snowing
Solution: (i) P  Q, (ii) P  Q,
(iii)  P  Q, (iv) P  Q, (v) P  Q,
(vi) P  Q.

Example 2: Construct the truth table for


P   P, P  P, P  P,  P.
Solution:

P P P   P P P PP
T F F T T T
F T F F F F

P P P P P P  P
T T T T F T
F F F F T F

Prepared by Dr. [Link], Professor, DoM 13


Example 3: Construct the truth table for
the following statements:
P  Q, P  Q, and T   P.
Solution: Since there are two variables,
therefore there are 22 possible truth values.

In T  P, the variable T will give only the


truth value T. (Note that F will give F
alone).

P Q P  P  Q P  Q T T  P
T T F T F T T
T F F F F T T
F T T T T T T
F F T T F T T

Example 4: Construct the truth table for


(P  (P  Q ))  Q.

Prepared by Dr. [Link], Professor, DoM 14


Solution:
P Q PQ P  (P  Q) (P  (P  Q))  Q
T T T T T
T F F F T
F T T F T
F F T F T

Example 5: Construct the truth table for


the following statement
P  ( Q  R)
Solution: There are 3 variables; hence
there exists 23 possible truth values.

Prepared by Dr. [Link], Professor, DoM 15


P Q R Q  Q  R P  ( Q  R)
T T T F F T
T T F F F T
T F T T T T
T F F T F T
F T T F F F
F T F F F F
F F T T T T
F F F T F F

Example 6: Construct the truth table for


(P  Q)  P.
Solution: There are 2 variables. Then we
have 4 possible truth values.

P Q P  Q (P  Q)  P
T T T T
T F F F

Prepared by Dr. [Link], Professor, DoM 16


F T F T
F F F T

1.2.2 Tautologies and Contradictions


Definition: A logical expression is said to
be a tautology if it is True under all possible
assignments.
That is, the statement which is True for all
possible truth values of the variables in the
statement is called a tautology (or
universally valid statement).
We can observe that, a tautological
statement is independent of the variable and
will always give ‘True’.

Prepared by Dr. [Link], Professor, DoM 17


For example:

P P P  P
T F T
F T T
Therefore P  P is a tautology.
Definition: A logical expression is said to
be a contradiction if it is False under all
possible assignments.
That is, the statement which is False for all
possible truth values of the variables in the
statement is called a contradiction (or
identically False statement or absurdity). It
is independent of the variable and will
always give ‘False’.
For example: P P P  P
T F F
F T F
Therefore P  P is a contradiction.

Prepared by Dr. [Link], Professor, DoM 18


Definition: A logical expression that is
neither a tautology nor a contradiction is
called a contingent.
For example: P Q P  Q
T T T
T F F
F T T
F F T
Therefore P  Q is a contingent.

1.2.3 Equivalence of Formulae


The two statement formulae are said to be
equivalent if and only if the truth values of
the two statements are identically same.
In other words, the two statement
formulae A and B are said to have
equivalence if and only if A  B is a
tautology.
We can represent the equivalence of two
formulae A and B by “A  B”, which is
Prepared by Dr. [Link], Professor, DoM 19
read as “A is equivalent to B”.
That is, “A  B” if and only if A  B is
tautology.
For example:
P P P P   P
T F T T
F T F T
P   P is a tautology. Hence
P   P.
We observe that ‘A is equivalent to B’ iff
the truth columns of A and B are identical.
Therefore, it is enough to check the truth
values of the column in the truth table.
Note that, if P  Q, then Q  P is trivial.
One can verify that
PP  P
P Q  Q P
(P  Q)  (Q  P)  P  Q

Prepared by Dr. [Link], Professor, DoM 20


Equivalences Formulae
P P  P Idempotent laws
PP  P
P  (Q  R)  (P  Q)  R Associative laws
P  (Q  R)  (P  Q)  R
P Q  Q P Commutative laws
P Q  QP
P  (Q  R)  (P  Q)  (P  R)Distributive
laws
P  (Q  R)  (P  Q)  (P  R)
 ( P)  P Double negative law
P F  P Identity laws
P T  P
P T T Domination laws
PF  F
 (P  Q)  P  Q De Morgan’s laws
 (P  Q)  P  Q

Prepared by Dr. [Link], Professor, DoM 21


P   P T Tautology law
P  P F Contradiction law
P  (P  Q)  P Absorption laws
P  (P  Q)  P

Example 1: Prove (P  Q)  ( P  Q)
and P  Q  (P  Q).
Solution: To construct a truth table for (P
 Q)  ( P  Q)
Now,

P Q P P  Q  P Q (P  Q)
 ( P  Q)

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

Prepared by Dr. [Link], Professor, DoM 22


Since (P  Q)  ( P  Q) is a tautology, P
 Q)  ( P  Q)
It is clear that, P  Q)  ( P  Q)
Hence( P  Q)  ( P  Q)
 PQ

Example 2: Prove that P  (Q  R)  P


 ( Q  R)  (P  Q)  R.
Solution: From the above example, Q 
R  ( Q  R) .
P  (Q  R)  P  ( Q  R)
 P  ( Q  R)
 ( P  Q )  R(Associative law)
 (P  Q)  R(De Morgan’s law)
 (P  Q)  R (since A  B  A  B )

Example 3: Show that ( P  ( Q  R))


 (Q  R)  (P  R)  R.
Solution:
( P  ( Q  R))  (Q  R)  (P  R)
Prepared by Dr. [Link], Professor, DoM 23
 ( P  ( Q  R))  ((Q  P)  R))
(Distributive law)
 (( P  Q)  R)  ((Q  P)  R))
(Associative law)
 (  (P  Q)  R)  ((P  Q)  R)) (De
Morgan’s law)
 (  (P  Q)  (P  Q))  R (since A
 A T)
T  R
R

Example 4: Show that P  (Q  R)  (P


 Q)  (P  R).
Solution: (P  Q)  (P  R)
 ( P  Q)  ( P  R)
 ( P   P)  (Q  R)
 P  (Q  R)
 P  (Q  R)

Prepared by Dr. [Link], Professor, DoM 24


Example 5: Show that  (P  Q)  (P
 Q)  (P  Q).
Solution:  (P  Q)   ((P  Q)  (Q
 P))
  (( P  Q)  ( Q  P))
  ( P  Q)   ( Q  P) (De
Morgan’s law)
 (P  Q)  (Q  P)
 ((P  Q)  Q)  ((P  Q)   P)
 (P  Q)  ( Q  Q)  (P  P) 
( Q  P)
 (P  Q)  T  T   (Q  P)
 (P  Q)   (P  Q)

Example 6: Show that (P  Q)  (R  Q)


 (P  R)  Q.
Solution:
(P  Q)  (R  Q)  ( P  Q)  ( R  Q)
 ( P   R)  Q
  (P  R)  Q
Prepared by Dr. [Link], Professor, DoM 25
 (P  R)  Q

Example 7: Show that


((P  Q)   ( P  ( Q   R)))  ( P
 Q)  ( P  R) is a tautology.
Solution:
((P  Q)   ( P  ( Q  R)))  ( P
 Q)  ( P  R)
 ((P  Q)   ( P  (Q  R)))  ( P 
( Q  R))
 ((P  Q)  (P  (Q  R)))  ( P   (Q
 R))
 ((P  Q)  (P  Q )  (P  R ))   (P 
(Q  R))
 ((P  Q)  (P  R))   (P  (Q  R))
 (P  (Q  R))  (P  (Q  R))(sinceA  
A  T)
T
The resultant is ‘T’. Then the given
statement is a tautology.

Prepared by Dr. [Link], Professor, DoM 26


Note that, if the resultant is F, then the
given statement is a contradiction.

Example 8: Show that Q  (P  Q) 


( P  Q) is a tautology.
Solution:
Q  (P  Q)  ( P   Q)
 Q  ((P   P)  Q)
 Q  (T   Q)
Q   Q
T
Hence the given formula is a tautology.

Example 9: Show that P  Q  Q


 P.
Solution: P  Q  P  Q
 Q  P
 Q  P(since A  B  A
 B)

Prepared by Dr. [Link], Professor, DoM 27


Example 10: Show that P  (Q  P) 
 P  (P  Q).
Solution:
Now, P  (Q  P)   P  (Q  P)
  P  (  Q  P)
 (  P  P)   Q
 (P  P)  Q
 T  Q
T
and  P  (P  Q)    P  (P  Q)
 P  (  P  Q)
 (P  P)  Q
T  Q
T
Hence P  (Q  P)  T  P  (P  Q).
1.2.4 Tautological Implications
A statement A is said to ‘tautologically
imply’ to a statement B if and only if ‘A 
B’ is a tautology.

Prepared by Dr. [Link], Professor, DoM 28


We denote it as ‘A  B’, which is read as
“A implies B”.
Note that, A  B means a two way
implication, while A  B means a one way
implication.
For example, consider the statement (P 
Q)  P.
P Q P  Q (P  Q)  P
T T T T
T F F T
F T F T
F F F T
Since (P  Q)  P is a tautology, therefore
(P  Q)  P.
In the same manner, one can verify that
(P  Q)  Q.
Implication Formulae
P  Q P Simplifications
P  Q Q

Prepared by Dr. [Link], Professor, DoM 29


P P  Q Additions
Q Q  P
P  P  Q
Q  P Q
 (P  Q)  P
 (P  Q)  Q
P  (P  Q)  Q Modus ponens
 Q  (P  Q)  P Modus tollens
 P  (P  Q)  Q Disjunctive
Syllogism
(P  Q)  (Q  R) P  R Hypothetical
Syllogism
(P  Q)  (P  R)  (Q  R)  R
Dilemma
Theorem 1:
If H1, H2 ...., Hm and P implies Q, then
H1, H2 ...., Hm implies P  Q.
Solution: Given that

Prepared by Dr. [Link], Professor, DoM 30


(H1  H2  ....  Hm  P)  Q
i.e., (H1  H2  ....  Hm  P)  Q is a
tautology
We know that in the equivalence
P  (Q  R)  (P  Q)  R
(H1  H2  ....  Hm  P)  Q  (H1  H2
 ....  Hm )  (P  Q)
Since (H1  H2  ....  Hm  P)  Q is a
tautology,
(H1  H2  ....  Hm)  (P  Q) is also a
tautology.
Hence (H1  H2  ...  Hm) implies (P  Q)

1.2.5 Duality Law and Dual Statements


Two statements A and A* are said to be
‘dual’ of each other if either one can be
obtained from the other by replacing  by  ,
 by  , F by T, and T by F.
The connectives  and  are called ‘dual’

Prepared by Dr. [Link], Professor, DoM 31


of each other. Already we know that F and T
are duals of each other.
For example the duals of
(a) (P  Q)  R, (b) (T   P)  Q,
(c) (P  Q)  (R  F) are
(a) (P  Q)  R, (b) (F  P)  Q,
(c) Since (P  Q)  (R  F)  ( P  Q)
 (R  F),the dual is ( P  Q)  (R  T).
Theorem 2: (Duality Principle Theorem)
If A(P1, P2, ....., Pn) and A* (P1, P2, .....,
Pn) are dual formulas, where P1, P2, ..... Pn
are atomic variables (primary statements)
that occur in A and A*, then A (P1, P2,
....., Pn)  A* ( P1, P2, ....., Pn).
That is, the negation of a formula is
equivalent to its dual in which every
variable is replaced by its negation.
Consequently we can have
A* ( P1, P2, .....,  Pn)  A(P1, P2,

Prepared by Dr. [Link], Professor, DoM 32


....., Pn) (or)
A* ( P1, P2, ....., Pn)  A(P1, P2,
....., Pn).

1.2.6 The Other Connectives


We have studied some of the connectives
in the statement calculus. For example,
 ,  , ,  and  . Here we will study some
other connectives.

Exclusive OR (  )
Let P and Q be any two formulas. Then “ P
exclusive OR Q” is written as P  Q and
defined as the statement P  Q has truth value
T if P and Q have different truth values; and
it has truth value F if P and Q have same
truth value.

Prepared by Dr. [Link], Professor, DoM 33


Truth table for Exclusive OR
P Q P Q
T T F
T F T
F T T
F F F

One can verify that


1. P  Q  Q  P(symmetric)
2. (P  Q)  R  P  (Q  R)
(associative)
3. P  (Q  R)  (P  Q)  (P  R)
(distributive)
4. (P  Q)  (P  Q)  ( P  Q)
5. (P  Q)   (P  Q)
NOR (  )
Let P and Q be any two statements
formulas. Then “P NOR Q” is denoted by “P
 Q” and is defined as P  Q   (P  Q).

Prepared by Dr. [Link], Professor, DoM 34


Some properties of NOR
1. P  Q  Q  P (commutative)
since P  Q   (P  Q)
 (Q  P)  Q  P
2. is not associative since
P  (Q  R)  P   (Q  R)
 (P   (Q  R))
 P  (Q  R) and
(P Q)  R  (P  Q)  R
 (  (P  Q)  R)  (P  Q)  R
NAND (  )
Let P and Q be any two statement
formulas. Then “P NAND Q” is denoted by
“P  Q”, and is defined as P  Q  (P 
Q)
One can verify that
1. P  Q  Q  P (commutative)
2.  is not associative.

Prepared by Dr. [Link], Professor, DoM 35


Functionally complete set of connectives
A set of connectives in which every
formula can be expressed in terms of an
equivalent formula containing the
connectives from this set is called a
“functionally complete set” of connectives.
Consider the following
P  Q  (P  Q)  (Q  P)
 ( P  Q)  ( Q  P)
This above equivalent suggests that the
biconditional and conditional can be
replaced by  ,  and .

Prepared by Dr. [Link], Professor, DoM 36

You might also like