You are on page 1of 52

LECTURE 2: LOGIC II

LEARNING OBJECTIVES

The students be able to identify the predicate


logic
The students be able to understand the
universal and existential quantification.
The students be able to determine modus
ponens and modus tollens
BASIC NOTATION

 The set of all integers


 Z = {…, -2, -1, 0, 1, 2, …}
 Z is the first letter of German word for integer, Zahlen

Countably infinite
or
 The set of all rational numbers Countable
 Q (quotients of integers or “fractions”)

 The set of all nonnegative integers


 N = {1, 2, 3, …} (often used)
 N = {0, 1, 2, 3, …} (in Maurer & Ralston)
Uncountably infinite or Uncountable
 The set of all real numbers, R.
PREDICATES AND QUANTIFIED STATEMENTS I
PREDICATES
 A predicate is a sentence that contains a finite number of
variables, and becomes a statement when 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.
DOMAINS OF PREDICATE VARIABLES

 If P(x) is a predicate and x has domain D, the truth


set of P(x) is the set of all elements of D that make
P(x) true when they are substituted for x.
 The truth set of P(x) is denoted by {
Example:
Let P(x) be the predicate “x is factor of 8”. Find the truth set of
P(x) if,
a. the domain of x is the set Z+ of all positive integer.
b. the domain of x is the set Z of all integers.
QUANTIFIER

 Quantifiers are words that refer to quantities such as “some”


or “all” and tell for how many elements a given predicate is
true.
THE UNIVERSAL QUANTIFIER: 
 The symbol for universal quantifier is “”
 The statement
x  D, P(x)
means “For all x in D, P(x)”
 Example, the sentence “All boys are clever” can be
written as “ boys x, x is clever” or “For all x in
the set of all boys, x is clever”
 Other expressions instead of for all are for every, for
arbitrary, for any, for each, and given any.
THE UNIVERSAL QUANTIFIER: 
 The statement is true if and only if, P(x) is true for every x
in D.
 The statement is false if and only if, P(x) is false for at least
one x in D.
 A value for x for which P(x) is false is called
“counterexample”.
EXAMPLES
Determine the truth of the statements below:
a. Let , and consider the statement .
 Check that is true for each individual in

 Hence, is true.

b. Consider this statement .


 Check that is true for each value in
 Let say ,
 Hence, is false.
EXERCISES OF UNIVERSAL STATEMENTS
TRUE OR FALSE?

 x  {1, …, 10}, x2 > 0.


 x  {1, …, 10}, x2 > 100.
 x  R, x3 – x  0.
 x  R, y  R, x2 + xy + y2  0.
 x  Z, x is even.
THE EXISTENTIAL QUANTIFIER: 
 The symbol  is the existential quantifier.
 The statement
x  D, P(x)
means “There exists x in D such that P(x)”.
 For example, the sentence “There is a student in ITS66204” can
be written as “ a person p such that p is a student in ITS66204”
or “p P such that p is a student in ITS66204” .
 Other expression, there is a, we can find a, there is at
least one, for some, and for at least one.
THE EXISTENTIAL QUANTIFIER: 

 The statement is true if P(x) is true for at least one


x in D.
 The statement is false if P(x) is false for all x in D.
EXAMPLE

 Consider the statement such that . Show that this statement is true.
 Observe that . Therefore, is true for at least one integer .

 Let and consider the statement such that . Show that this statement is
false.
 Note that is not true for any integers from 5 through 8:
,,,
Thus, such that is false.
EXERCISES OF EXISTENTIAL STATEMENTS
TRUE OR FALSE?

 x  {1, …, 10}, x2 > 0.


 x  {1, …, 10}, x2 > 100.
 x  R, x3 – x  0.
 x  R, y  R, x2 + xy + y2  0.
TRANSLATING FROM FORMAL TO INFORMAL
LANGUAGE

 .
 All real numbers have nonnegative square.
 Every real number has a nonnegative square.
 The square of each real number is nonnegative.

 There is a positive integer whose square is equal to itself.


 We can find at least one positive integer equal to its own square.
 Some positive integer equals its own square.
TRANSLATING FROM INFORMAL TO FORMAL
LANGUAGE

 All triangles have three sides.


 triangles , has three sides.
 has three sides (where is the set of all triangles).

 Some programs are structured.


 a program such that is structured.
 such that is structured. (where is the set of all programs).
PREDICATES AND QUANTIFIED
STATEMENTS II
NEGATIONS OF UNIVERSAL STATEMENTS

 The negation of a statement of the form

x  D, Q(x)
is logically equivalent to a statement of the form
x  D such that Q(x)
Symbolically,
x  D such that Q(x)

 The negation of a universal statement (“all are”) is logically


equivalent to an existential statement (“some are not” or “there is at
least one that is not”).
NEGATIONS OF EXISTENTIAL STATEMENTS

 The negation of a statement of the form

x  D such that Q(x)


is logically equivalent to a statement of the form
x  D, Q(x)
Symbolically,
x  D, Q(x)

 The negation of a existential statement (“some are”) is logically


equivalent to an universal statement (“none are” or “all are not”).
EXAMPLE : NEGATING QUANTIFIED STATEMENTS

  prime is odd.
 a prime such that is not odd.

  a triangle such that the sum of the angles of equals .


 triangles , the sum of the angles of does not equal .
UNIVERSAL CONDITIONAL
STATEMENTS
x, if P(x), then Q(x)
Example:
a. Formal to Informal
x  , if then
 If a real number is greater than 2 then its square is greater than 4.

a. Informal to Formal
If a real number is an integer, then it is a rational number.
x  , if x  then x 
real numbers x, if x is an integer, then x is a rational number.
NEGATIONS OF UNIVERSAL
CONDITIONAL STATEMENTS
x such that P(x) and Q(x)

𝒑 → 𝒒 ≡ p ∨𝑞 ( 𝒑˅ 𝒒)≡ 𝒑˄ 𝒒
 people p, if p is blonde, then p has blue eyes.
  a person p such that p is blonde and p does not has blue
eyes.

 If a computer program has more than 100,000 lines, then it contains


a bug.
 There is at least one computer program that has more than
100,000 lines and does not contain a bug.
NEGATION OF UNIVERSAL CONDITIONAL
STATEMENTS
 Negate the statement

x  R, x < 10  x2 < 100


(x  R, x < 10  x2 < 100)
 x  R, (x < 10  x2 < 100) Negation Law
 x  R, ((x < 10) (x2 < 100)) Implication rule
 x  R, (x < 10) ~(x2 < 100) De Morgan’s law
 x  R, (x < 10) (x2  100) Double negation

( 𝒑˅ 𝒒)≡ 𝒑˄ 𝒒
VARIANTS OF UNIVERSAL CONDITIONAL
STATEMENTS
 A universal conditional statement is of the form
x  D, P(x)  Q(x).
 The converse is
x  D, Q(x)  P(x).
 The inverse is
x  D, P(x)  Q(x).
 The contrapositive is
x  D, Q(x)  P(x).
EXAMPLE

 Write the formal and informal contrapositive, converse


and inverse for the following statement.
If the real number is greater than 2, then its square is
greater than 4.

Contrapositive

 If the square of a real number is less than or equal


to 4, then the number is less than or equal to 2.
Converse

 If the square of a real number is greater than 4, then the


number is greater than 2.

Inverse

 If a real number is less than or equal to 2, then the square


of the number is less than or equal to 4.
NECESSARY AND SUFFICIENT CONDITION, ONLY IF
OF UNIVERSAL CONDITIONAL STATEMENTS
EXAMPLE

 Squareness is a sufficient condition for rectangularity.


 if is a square, then is a rectangle.

 Being at least 35 years old is a necessary condition for


being a manager.
 people , if is younger than 35 years old, then cannot be a
manager.
 people , if is a manager, then is at least 35 years old.
MULTIPLY-QUANTIFIED
STATEMENTS
MULTIPLY-QUANTIFIED STATEMENTS

 A multiply-quantified statement is a statement that


contains more than one quantifier.
 Multiply-quantified universal statements
 x  D, y  E, P(x, y)
 P(x, y) true for all x, y pairs.
 Multiply-quantified existential statements
 x  D, y  E, P(x, y)
 P(x, y) true for at least one x, y pairs.
MULTIPLE QUANTIFIED STATEMENTS

Mixed universal and existential statements


 x  D, y  E such that P(x, y)
 To allow someone else to pick whatever element x
in D they wish and then you must find an element
y in E that “works” for that particular x.
 Note that because you do not have to specify the y
until after the other person has specified the x,
you are allowed to find a different value of y for
each different x you are given.
MULTIPLE QUANTIFIED STATEMENTS

Mixed existential and universal statements


 x  D such that y  E, P(x, y)
 Find one particular x in D that will “work” no
matter what y in E anyone might choose to
challenge you with.
 You are not allowed to change your x once you
have specified it initially.
MULTIPLE QUANTIFIED STATEMENTS

Compare. Which statement is true and false?


 x  Z, y  Z such that x < y .
 y  Z, such that x  Z, x < y.

The order does matter!


1. x  Z, y  Z such that x < y

2. y  Z, such that x  Z, x < y.


SUMMARY OF MULTIPLY-QUANTIFIED
EXAMPLE

 Suppose P(x, y) means x ≥ y.


 Let D be the set N = {1, 2, 3, …}.

 The discussion is in the following slides.


xy P( x, y )

 For all x and (for all) y, P(x, y) is true.

 This says that no matter which numbers x and y we choose from N


(natural number) it will always happen that x ≥ y.

 Is this true?

 No. For example, x = 1 and y = 2.


 Counterexample: x<y
xy P( x, y )

 There exists x and there exists y such that x ≥ y.


 Is this true?

 Yes. For example, take x = 2 and y = 1.


xy P ( x, y )

 For every x there exists y such that x ≥ y.


 A different choice of x may lead to a different value of y.
 Is this true?

 Yes.
 For example, given x we can take y = x. Then x ≥ y.
xy P ( x, y )

 There exists x such that for every y, x ≥ y.


 This says that x is a constant, and every choice of y makes x ≥ y.

 Is this true?
 No.
 x=2, y=4, so it will make x y
yx P( x, y )

 For all y there exists x such that x ≥ y.

 This says that for every choice of y it’s possible to find an x which is ≥ y.

 Is this true?

 Yes. For example, put x = y + 1 (or take x = y)


yx P ( x, y )

 There exists y such that for all x, x ≥ y.

 This says that there is a constant y which is less than or equal to all
values of x.

 Is this true?

 Yes: y = 1 has this property. It’s the smallest element of the set.
Combining Quantifiers
A predicate can have numerous variables, each of which may
be quantified.
Example x, y, z , P ( x, y, z )
Negation ~ [x, y, z , P( x, y, z )]  x, y, z , ~ P( x, y, z )

It can be difficult to interpret expressions involving 3 or


more quantifiers.
NEGATION OF MULTIPLY QUANTIFIED
STATEMENTS

 Negate the statement

x  R, y  R, z  R, x + y + z = 0.
 (x  R, y  R, z  R, x + y + z = 0)

 x  R, (y  R, z  R, x + y + z = 0)
 x  R, y  R, (z  R, x + y + z = 0)
 x  R, y  R, z  R, (x + y + z = 0)
 x  R, y  R, z  R, x + y + z  0
THE GENERALIZED DE MORGAN
LAWS

 What happens if we negate an expression involving predicates and


quantifiers?

 The Generalized de Morgan Laws

~ [x, P ( x)]  x, ~ P ( x)


~ [x, P( x)]  x, ~ P( x)

 Examples:
1. “It’s not true that all food is delicious” is the same as “there exists some food
which is not delicious.”
2. “It’s not true that some dogs bite” is the same as “there aren’t any dogs who
bite” or equivalently “all dogs don’t bite”.
UNIVERSAL MODUS PONENS

 The rule of universal instantiation can be combined with modus


If p then
ponens to obtain the valid form of argument called q. modus
universal
p
ponens.
q
EXAMPLE:

If an integer is even, then its square is even.


k is a particular integer that is even.
is even.

Let E(x) = “x is an even integer”


S(x) = “ is even”

x, if E(x) then S(x)


E(k), for a particular k,
S(k).
UNIVERSAL MODUS TOLLENS

 The rule of universal instantiation can be combined with modus


tollens to obtain the valid form of argument called universal modus
tollens.
EXAMPLE:

All human beings are mortal.


Zeus is not mortal.
Zeus is not human.
Let H(x) = “ is human”
M(x) = “ is mortal”
Z stands for Zeus

x, if H(x) then M(x)


~M(Z)
~H(Z).

You might also like