0% found this document useful (0 votes)
1 views

Predicate_Calculus__Chapter4_

Predicate Calculus
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Predicate_Calculus__Chapter4_

Predicate Calculus
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 45

Discrete Mathematical

Structures
Course Code: MA 201
Instructor: Divya.Jain

Chapter 4
Mathematical Logic
Mathematical Logic

Propositional Calculus Predicate Calculus


CHAPTER 4.
ments and Logical Operators
ements
ntroduction: (Propositional Calc
calculus is a generic name for any area of
ics that concerns itself with calculating.
ple, arithmetic could be called the calculus
rs. Propositional calculus is then the
ns of propositions.

:
tion or statement, is any declarative
which is either true (T) or false (F).
T or F as the truth value of the statement.
Example 1 Propositions
The sentence "2+2 = 4" is a statement,
since it can be either true or false.

Since it happens to be a true statement, its truth

value is T.

The sentence "1 = 0" is also a statement, but its

truth value is F.

"It will rain tomorrow" is a proposition. Although,

for truth value we shall have to wait for tomorrow,

yet we can determine if it is true or false.


Take two aspirins: It is not a statement; it is a command.
Do you know how to speak English?:
It is a question, so it is not a statement.
3-x = 5: It is declarative sentence, but not a statement as
it is true or false depending on the value of x.
The temperature on the surface of the planet Venus is
800 degree F: It is a declarative sentence whose truth
value we do not know at present, but we can in principle
determine it.
The truth value of a statement often depends upon its
context, which is generally unstated but nonetheless
understood. Our interest is in the only fact that it has a
truth value even it may not be in consonance with the
actual truth value.
$ 2. BASIC LOGICAL OPERATIONS:
There are some key words and phrases which are used
to form new propositions from given propositions as for
example “and” “ or”,”not”,“ if …then…” and “if and only if”.
These are called logical operators or logical connectives.
A proposition which contains some
Logical connectives is called a “ compound proposition”
Or “molecular statement” and a statement containing no
logical connectives is called a simple statement or
“atomic statement”.
Examples of compound propositions:
1. A triangle is a plane figure and is bounded by three lines.
2. Any real number is rational or irrational.
3. This year is not a leap year.
Basic logical operators:
(i) Conjunction, p  q

(ii) Disjunction, p q

(iii) Negation , p

(I) Conjunction: A statement obtained by joining two statements


by using the operator “ and “ is called the conjunction of the two
statements and will be denoted by p  q ( read as p and q).
Let p : JUET is a university.
q : No. of students in a batch is 30.
then compound statement
p  q: JUET is a university and no. of students in a batch is 30.

Truth functional rule for conjunction:


p  q is true if and only if both the statements p, q are true.
Truth Table for Conjunction:
The following table gives the truth values of p  q for
all possible truth values of p and q :
p q p q The conjunction symbol “^ " is an
example of a binary logical
T T T
Operator (the term "binary"
T F F indicates that the operator acts on
F T F a pair of propositions).
F F F There are many ways of expressing a conjunction in English

For example, if p: “ Suraj drives a fast car" and


q: “ Mahesh drives a slow car,"
the following are all ways of saying p  q:
Suraj drives a fast car and Mahesh drives a slow car.
Suraj drives a fast car, but Mahesh drives a slow car.
Although Suraj drives a fast car, yet Mahesh drives a slow car.

Though Suraj drives a fast car, Mahesh drives a slow car.


(ii) Disjunction : A statement obtained by joining two
statements p, q by the logical operator “ or” is called the
disjunction of the two statements and will be denoted by
p  q( read as p or q).
For example:
If p: "I am clever”, q: "You are strong," we can form the
statement "I am clever or you are strong,"
which we write symbolically as p  q, read "p or q."

Its TRUTH TABLE is defined by the following table:

p q p  q So, p  q is true when p is true or


T T T q is true or both are true. In other words:
T F T p  q is false if both p, q are false.
F T T
F F F
(iii) Negation: A statement which has a truth value opposite
To that of a statement p is called the negation of p and is denoted
By ¬p or ~p.
Negation of an atomic sentence is obtained by using the
connective not at proper place.
As for example :
Let p : The water is cold. Then ¬p : The water is not cold.

Its TRUTH TABLE is defined by the following table:


The negation symbol "¬" is an example of a
p ¬p
unary logical operator (the term "unary"
T F indicates
F T that the operator acts on a single proposition).

Find the negations of the following propositions.


(a) p: "2+2 = 4“
(b)q: "1 = 0“
(c) r: "Diamonds are a pearl's best friend.“
Notice that ~p is false, because p is true. However, ~q is
true, because q is false. A statement of the form ~q can very
well be true; it is a common mistake to think it must be false.

To say that diamonds are not a pearl's best friend is not


to say that diamonds are a pearl's worst enemy. The
negation is not the polar opposite, but whatever would deny
the truth of the original statement. Similarly, saying that not
all politicians are crooks is not the same as saying that no
politicians are crooks, but is the same as saying that some
politicians are not crooks. Negations of statements involving
the quantifiers "all" or "some" are tricky. We'll study
quantifiers in more depth when we discuss the predicate
calculus.
$3. Logical Equivalence, Tautologies, and
Contradictions
$.3.1. Constructing a Truth Table
Let P( p, q,……) denote an expression constructed from logical
variables p, q,….which take on the value TRUE (T) or FALSE(F)
and the logical connectives.
Such an expression P (p, q,……) will also be a proposition.
Construct the truth table for ~( p  q).
Solution:
Whenever we encounter a complex formula like this, we work
from the inside out, Thus, we start with the p and q columns,

p q p  q 
¬(p q)

T T T F
T F F T
F T F T
F F F T
Example: Construct the truth table for ¬(p q)  (¬r)
Solution:
Here, there are three variables: p, q and r. Thus we start with
three initial columns showing all eight possibilities:

p q r p q ¬(p  q) ¬r ¬(p q)  (¬r)


T T T T F F F
T T F T F T F
T F T F T F F
T F F F T T T
F T T F T F F
F T F F T T T
F F T F T F F
F F F F T T T
$3.2. Tautology and Contradiction
Definitions:
A compound statement or a proposition P(p,q,…….) is called

Tautology Contradiction

If the truth value of P If the truth value of P


is always TRUE is always FALSE ,
irrespective of the regardless of the truth
truth values of its values of its variables.
variables.
Example: (a) P : p  (¬p) . Truth table for P is given below showing the P is Tautology.
p ~p p  (~p)
T
F
F
T
T
T
} All T
NOTE:
When a statement is a tautology, we also say that the statement
is tautological. In common usage this sometimes means simply
that the statement is convincing. We are using it for something
stronger : the statement is always true, under all circumstances.
In contrast, a contradiction, or contradictory statement, is never
true, under any circumstances.
Example 9
Show that the statement (p  q)  [(~p)  (~q)] is a contradiction.
Solution
Its truth table is the following:

p q ~p ~q p  q (~p)  (~q)  q) 
(p [( ~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
OK
Remarks:
1. 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. For example, the
statements p q and (~p)  (~q) are contradictory, since
we've just shown that their conjunction is a contradiction. In
other words, no matter what the truth values of p and q, it is
never true that both p  q and (~p)  (~q) are true at the
same time.
2. Note that most statements are neither tautologies nor
contradictions, as in the first three examples in this section.
Sometimes we can "recognize" a tautology or contradiction
immediately. Roughly speaking, tautologies are statements
that are "obviously true" while contradictions are "obviously
false".
$3.3 LOGICAL EQUIVALENCE
Definition: Two propositions P(p,q,…..) and Q(p,q,…..) are
said to be logically or tautologically equivalent or simply
equivalent or equal, denoted by
P(p,q,…………..)
If they have identical truth tables.
 Q(p,q,…………..)

For Example:
Consider P(p,q,……) = ¬( p q) and Q(p,q,……..) = (¬p) (¬q)
then verify that truth table for P and truth table for Q are same.

Truth table for P Truth Table for Q


p q p  q ¬(p  q) p q ¬p ¬q 
(¬p) (¬q)

T T T F
T T F F F
T F T F
T F F T F
F T T F
F T T F F
F F F T
Showing that P  Q, which is DeMorgan’s law.
F F T T T
$. 4.Other logical Operators:
4.1. Implication or Conditional Statement:
Definition: A conditional statement is obtained by using the
connective “ If ……..then …….” which is called an implication.
Example: Let p and q are two given propositions.
By using the above connective we get “ If p then q”
which can be denoted by p  q. (read as p implies q).
In the implication p  q, p is called hypothesis or antecedent
and q is called the conclusion or consequent.

Truth functional Rule for Implication:


p  q is false if p is true and q is false; otherwise it is true.

p q p q
T T T
T F F
F T T
F F T
4.2. Double Implication or Biconditional statements:

Definition: A biconditional statement is obtained by using the


connective “ if and only if “ (briefly written as iff) between two
statements p and q is called a double implication and is
written as “ p iff q “ or p  q. (read as implies and implied by q)
p  q is true only when both p and q are true or both False.

p q p q q p p q i.e. (p q)  (q p)



T T T T T
T F F T F
F T T F F
F F T T T
Note 1. We can easily show that the negation of p  q is
p  (¬q). i. e. ¬(p  q) 
p  (¬q).
or
or
(p  q)
(p  q)

¬ [p  (¬q)]
[¬p  q] (Verify this!)

Note 2. If p: The sun revolves about the earth,


q : The year consists of 400 days.
Then the statement “ p  q” i.e.” The sun revolves about the
Earth iff the year consists of 400 days” is true though p and q
are both false.

Also verify the following:

¬(p  q)  (p  ¬q)  (q  ¬p)


Back
The contrapositive of the implication “ p  q” is the
Implication “(¬q)  (¬p)”
For example, the contrapositive of
“ If 2 is an even number, then 4 is an even number” is
“ If 4 is an odd number, then 2 is an odd number”
$.5. ARGUMENTS
The proof of a theorem involves drawing conclusions from some
given information i. e. a proof demonstrates that if an initial
collection of statements - called premises or hypothesis—are all
true, then the conclusion of the theorem is also true.
Definition: An argument is a finite collection of statements
P1, P2,…………Pn called premises (or hypothesis), which yields
another proposition Q, called the conclusion. Such an argument is
Denoted by P1,P2,………..,Pn |─ Q.

An argument P1,P2,………..,Pn |─ Q is said to be


valid if Q is true whenever all the premises are true.

An argument which is not valid is called a fallacy.


Example1. Show that the argument
p  ¬q, r  q, r |─ ¬p is valid.
Solution:
We construct a truth table.
p q r ¬q  ¬q
p q
r ¬p
T T T F F T F
T T F F F T F
T F T T T F F
F T T F T T T *
T F F T T T F
F T F F T T T
F F T T T F T
F F F T T T T
Observe that row -4 marked with the * - is the only row where
the premises are all marked true and the conclusion is also
true. Thus the argument is valid.
NOTE:
In the last example we were bit fortunate because there was
only one row where all the premises were marked T.
In general, in order to assert that an argument is valid when
there are several rows with all premises marked T, it is
necessary to check that the conclusion is also T in every
such row.

Consider the following arguments:


(i) p, p  q |─ q
(ii) p  q ,q |─ p (i) Is valid argument because p and
TRUTH TABLE: p  q are true simultaneously only
in case(row)1 and in this case q is true.
p q p q
(ii) Is a fallacy for p  q , q are both true
T T T
in case(row)3 in the truth table but in
T F F this case conclusion p is false.
F T T
F F T
Predicate Calculus
* Ram is a student
* Sam is a student
* x is a student
* ‘ is a student ‘ - Predicate

e.g. “2x + 3y = 4z”

Definition- A part of a declarative sentence describing


the properties of an object or relation among objects is
called a predicate.
Predicate Calculus

* Let A be a given set . A propositional function(or an open


sentence or conditional) defined on A is an expression p(x)
which has property that p(a) is true or false for each
a  A.
A - domain of p (x)
Tp - all elements of A for which p(a) is true is called the
truth set of p(x)
Tp = {x:x  A, p(x) is true} or Tp = {x: p (x) is true}
Example. Find the truth set of each propositional
function p (x) defined on the set N of positive integers.
(a) Let p(x) be “x+2 > 7”
(b) Let p(x) be “x+5 < 3”
(c) Let p(x) be “x+5 >1”
(a) {x:xN, x+2 >7 } = {6,7,8,.......},
(b) {x:xN, x+5<3} = 
(c) {x:xN, x+5>1} = N
Remarks: This example shows that if p (x) is a
propositional function defined on a set A, then p (x)
can be true for all x є A, for some x є A, or no x є A.
So next we shall discuss quantifier
Related to such propositional functions.
Predicate Calculus

Definition - For a declarative sentence involving a predicate


, the universe of discourse , or simply the universe, is the
set of all possible values which can be assigned to variables.

e.g. -1. For p(x): “x is a student “ the universe of discourse


is the set of all human names.
e.g. - E(n): “n is an even integer” the universe of
discourse is the set of even integer.
Logic - Quantifiers
• Let p (x) be a propositional function defined on a
set A. Then the notation  x P(x) shows the
universal quantification of P(x), with the upside-
down A as the universal quantifier.
– It says, FOR ALL x, P (x) is true or FOR
EVERY x, P (x) is true.  is called
universal quantifier.
Let p (x) be a propositional function defined on a
set A. Then Tp = {x: xєA, p (x)}= A
If {x: xєA, p (x)}= A, then 
x p (x) is true,
Otherwise it s false
Examples:
(a) The proposition (  n є N) (n+4>3) is true since
{n: n+4>3} = {1, 2,…….} = N.
(b) The proposition (  n є N) (n+2 >8) is false since
{n: (n+2 >8)}= {7, 8,………} is not equal to N.
(c) The symbol  can be used to define the intersection of an
indexed collection { Ai : i є I} of sets Ai as follows

 ( Ai : i  I ) {x : i  I , x  Ai }
Logic - Quantifiers
– Existential Quantification of a proposition:
– If there exists an element x in the universe of discourse
such that P(x) is true i.e. there is AN x, or at least ONE
x, such that P(x) is true,  x P(x) is true and
  is called Existential Quantifier
– If P(x) is a propositional function defined on a set, then
Tp {x : x  A, p( x)} 
If {x : p ( x)} thenxp( x)istrue
otherwise it is false
• For example, if P(x) was the statement x > 89, and your
data set included test scores of 65, 72, 85, 88, and 95 what
would be the existential quantification of P(x)?
– TRUE!
Predicate calculus

• also has rules which deal with quantifiers


existential quantifier 
universal quantifier 
• statements include variables
Example

“For all x there is a y such that x is


greater than y and less than y+1”.

In the universe of rational numbers, with


the usual interpretation of “+” and “<“,
this sentence is true.

In the universe of integers, this sentence


is false.
Relations between negation,
universal and existential quantifiers

~X p(X) = X ~p(X)


~ X p(X) = X ~ p(X)
X p(X) = Y p(Y)
X q(X) = Y q(Y)
X (p(X)  q(X)) = X p(X)  Y q(Y)
X (p(X)  q(X)) = X p(X)  Y q(Y)
Negation of Quantified Statements
“All math majors are male”
“It is not the case that all math majors are male” or
“There exists at least one math major who is not male”

M- the set of math majors


( x M)(x is a male)  (x M)(x is not male)

( x M)p(x)  (x M) p(x)


or   x p(x)  x p (x)
De Morgans Law
 (xA)p(x)  (  xA)  p(x)

 (  xA) p(x)  (xA)  p(x)


(a) The following statements are negative each other
“For all positive integers n we have n+2 >8”
“There exists a positive integer n such that n+2not>8”
(b) The following statements are also negatives to
each other:
“There exists a (living) person who is 150 years old”
“ Every living person is not 150 years”
Note: Previously,  was used as operation on statements;
here  is used as an operation on propositional functions.
Counterexample:
De Morgan’s law tells us that to show that the proposition x p (x) is
false, it is equivalent to show that  x  p (x) is true, in other words,
that there is an element x0(say) such that p (x0) is false. Such an
element x0 is called a counter example to the statement x p (x).
Examples:

(a) Consider the statement x є R, |x| 0. The statement is false since
0 is a counterexample i.e. |0|  0 is not true.
2
(b) Consider the statement x є R, x The statement is not as ½ is
x
counterexample.
(c) Consider the statement (b) when R is replaced by N, then the
statement is i.e. there does not exist a positive integer n for
2
which  nn
Propositional Functions with more
than one variables
• A propositional function of n variables defined on a product
set A = A1xA2…..xAn is an expression
p (x1,x2,……xn) which has the property that
p(a1,a2, ……,an) is true or false for any n-tuple
(a1,a2, ……,an) in A. e.g. x + 2y + 3z < 18 is a propositional
function
3 on
N N N N Such a proposition function has no
truth value. However, a proposition preceded by a quantifier
for each variable has a truth value e.g.
xy, p ( x, y )orxx, p ( x, y )
denotes a statement and has a truth
value.
Example: Let B = {1, 2, 3,………., 9}and let p (x, y)
denotes “x + y = 10”.
Then p (x, y) is a propositional function on A = B x B.
Then
(a) xy, p( x, y ) is a statement and it is true, since for
every x there exists a y such that “x + y = 10”.
(b) yx, p( x, y ) is also statement and it is false, since
there exists no y such that for every x, we have
“ x + y = 10”
Note: In statements (a) and (b) the order of the
quantifiers is different. Thus a different ordering of
the quantifiers may yield a different statement.
By definition, the statement xy, p( x, y ) is false if there is at least
one x and at least one y in D such that P (x, y) is false.

Consider the statement xy (( x  0)  y  0)  ( x  y  0)).


With Universe of discourse R, this statement is true because, for
every real x and for every real y, the conditional proposition is
true. In other words, for every real number x and for every real
number y, if x and y are positive, their sum is positive.

Consider the statement xy (( x 0)  ( y 0)  ( x  y 0)),


with universe of discourse R. this statement is false, because if
X = 1 and y = -1, the conditional proposition is false.
We say that the pair x=1 and y =-1 is a counterexample.
Quantified propositions can be
negated by successively applying De
Morgan’s laws.
[(x y z, p(x,y,z)]  x [y z, p(x,y,z)]
 x y [ z, p(x,y,z)]
 x y  z,  p(x,y,z)]
a2
End of chapter 4.

You might also like