Download Chapter 2: The Logic of Quantified Statements

Document related concepts

Addition wikipedia , lookup

Big O notation wikipedia , lookup

Hyperreal number wikipedia , lookup

Theorem wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
Chapter 2: The Logic of Quantified
Statements
January 14, 2008
Outline
1 2.1 Introduction to Predicates and Quantified Statements I
2 2.2 Introduction to Predicates and Quantified Statements II
3 2.3 Statements Containing Multiple Quantifiers
Consider the following argument
∴
All students in Electrical Engineering have to take MTH314.
Tarik is a student in Electrical Engineering.
Tarik has to take MTH314.
This seems to be a valid argument from the point of view of
logic. However, we cannot show that using the methods of
Chapter 1, since the first statement cannot be translated using
only the symbols ∼, ∧, ∨, →, or ↔.
Basic Facts and Notation For Sets
• A set is some collection of objects, which we call elements
of the set. For example,
A = { blue , red , yellow }
and
B = {0, 2, 5, 13, −4}
are examples of sets.
• To write the fact that an object x is an element of a set A,
we write
x ∈A
while
x 6∈ A
will denote the fact that x is not an element of A.
• We will use the following notation for familiar sets of
numbers:
1
2
3
R for the set of all real numbers
Z for the set of all integers
Q for the set of all rational numbers (quotients of integers)
• By putting + or - in the superscript, we indicate the set of
positive or negative numbers; e.g
R+
will stand for all positive real numbers, etc.
• Instead of writing Z+ , the set of all positive integers is often
called the set of natural numbers and the notation for it is
N.
Predicates
• We have seen in Chapter 1, that a sentence
x2 + x > 2
is not a statement since its truth (or falsity) depends on
what value we assign to the variable x.
• Similarly, the sentence
She is a student at Ryerson.
is not a statement either, since we have to know who “she”
refers to in order to determine the truth value.
• Such sentences are called predicates. They are not
statements unless we interpret the variables in them as
particular elements of some prescribed set. After that, they
become true or false statements.
Definition
A predicate is a sentence that contains a finite number of
variables and becomes a statement once these variables are
assigned some specific values. The domain of a predicate
variable is the set of all values that can be substituted for the
variable.
• For example, for the predicate P(x)
x2 + x > 2
the domain can be any set of numbers (R, Z, . . . ) in which
its operations (+,·,. . . ) make sense.
• A predicate could involve any number of variables; e.g.
Q(x, y ) is the sentence
x is divisible by y 3
Example
Consider the predicate P(x)
x2 + x > 2
with the domain R. For what x ∈ R is this predicate true?
• For x = 2,
P(2) :
22 + 2 > 2,
true
• For x = − 13 ,
1
P(− ) :
3
1
1
(− )2 + (− ) > 1,
3
3
false
• It can be shown, using some basic facts about quadratic
equations that P(x) is true provided
x < −2
or
x >1
Definition
If P(x) is a predicate whose truth domain is D, the truth set of
P(x) is the set of all elements of D which make P(x) true when
they are substituted for x. We write the truth set for P(x) as
{x ∈ D|P(x)}
which we read as “the set of all x in D such that P(x) is true”.
Example
Consider the predicate Q(n) stating
n divides 5
(a) If the truth domain is Z, the truth set of this predicate is
{−5, −1, 1, 5}
(b) If the truth domain is the set of all positive integers Z+ ,
then the truth set will be
{1, 5}
• We see, based on this example, that for the same
predicate, the truth set may change when we change the
truth domain (the set of possible values of the variable)
Universal Quantifier
• One of the ways in which we can turn a predicate P(x) into
a statement is, for example, to state the following
For all x, P(x).
• We write that as
∀x, P(x)
• The symbol ∀ means “for all” (“for any”, “for each”) and is
called the universal quantifier.
• For example, the sentence
All students in Electrical Engineering must take MTH314.
can be written as
∀x ∈ E, P(x)
where E is the set of all students in Electrical Engineering,
and P(x) is the predicate “x must take MTH314”.
Definition
Suppose Q(x) is a predicate and D is the truth domain for x. A
universal statement is a statement of the form
∀x ∈ D, Q(x).
It is true if, and only if, Q(x) is true for every x in D. If there is
an x in D for which Q(x) is false, this universal statement will
be false.
The value of x for which Q(x) is false is called a
counterexample for the universal statement.
Example
Let D = {−5, 8, 9, 11} and consider the statement
∀x ∈ D, x 2 + x > 2
Show that this statement is true.
Solution: We check that
x2 + x > 2
is true for all x ∈ D. (This is called the method of exhaustion)
(−5)2 + (−5) > 2
82 + 8 > 2
92 + 9 > 2
112 + 11 > 2
∀x ∈ D, x 2 + x > 2
is true
Example
Now, show that
∀x ∈ R, x 2 + x > 2
is false.
Solution: It suffices to find one value of x ∈ R for which it is not
the case that
x2 + x > 2
In other words, we are looking for a counterexample in R.
One such counterexample is, e.g. x = −1 since
(−1)2 + (−1) 6> 2
Therefore,
∀x ∈ R, x 2 + x > 2
is false.
Existential Quantifier
• Another way to turn a predicate Q(x) into a sentence is to
assert that
“There exists x such that Q(x).”
• The notation for this is
∃x, Q(x)
• ∃ is the existential quantifier and its meaning is “there
exists”, “there is a”, “for some”, “there is at least one”, etc.
Definition
Let Q(x) be a predicate and D the truth domain of x. An
existential statement is a statement of the form
∃x ∈ D such that Q(x)
It is true if, and only if, Q(x) is true for at least one element x of
D. It will be false if, Q(x) is false for all x ∈ D.
Example
Show that the statement
∃n ∈ Z such that n2 = n
is true.
Solution: It suffices to find an integer n such that
n2 = n
Obviously, one such integer is
n = 1.
Example
Given the truth domain
A = {2, −7, 3, 5}
show that the existential statement
∃n ∈ A such that n2 = n
is false.
Solution: Clearly,
22 6= 2
(−7)2 6= −7
32 6= 3
52 6= 5
Since there is no element n ∈ A for which n2 = n, this
existential statement is false.
• Given a statement involving quantifiers, it is generally
possible to translate it into English using in a variety of
ways:
Example
∀x ∈ R, x 2 ≥ 0.
This can be translated as:
• Every real number has a non-negative square.
• x has a non-negative square, for any real number x.
• No real number can have a non-negative square, etc.
Examples
Translate the following statements into formal logic statements,
using quantifiers and variables:
(a) The sum of angles of every rectangle is 360◦ .
(b) Some integers are divisible by 6.
(c) No real number has -4 as its square.
Solution:
(a) ∀x ∈ R, sum of angles of x is 360◦ .
(R-set of all rectangles)
(b) ∃n ∈ Z such that n is divisible by 6.
(c) ∀x ∈ R, x 2 6= −4.
Universal Conditional Statements
• One of the most common types of universal statements
encountered in mathematics is the universal conditional
statement
∀x, if P(x) then Q(x).
Example
Consider the statement
∀x ∈ R, if x ≥ 3 then x 2 ≥ 9.
which can be translated as
If a real number is at least 3, then its square is at least 9.
or
The square of any real number, which is at least 3, is at least 9.
Examples
Rewrite each of the following statements as a universal
conditional statement:
(a) If an integer is divisible by 4, then it is divisible by 2.
(b) No bird is a mammal.
Solution:
(a) ∀n ∈ Z, if n is divisible by 4, then n is divisible by 2.
(b) ∀x, if x is a bird, then x is not a mammal.
Equivalent Forms of Quantified
Statements
• Consider the statement
∀x, if x ∈ Z, then x ∈ Q.
(Every integer is a rational number)
• This statement can be rewritten as
∀x ∈ Z, x ∈ Q
• What we did here was to restrict the truth domain to
integers.
• Conversely, if D is the truth domain for the predicate P(x),
the statement
∀x ∈ D, P(x)
can be rewritten as
∀x, if x ∈ D, then P(x)
Example
Rewrite the statement
The square of any even integer is even.
as a universal logical statement in two different ways.
Solution:
• ∀n, if n is even, then n2 is even.
• ∀ even n, n2 is even.
Example
A prime number is an integer greater than 1 whose only
positive factors are 1 and the integer itself.
Let Prime(n) stand for the predicate “n is prime”, and let
Even(n) denote the predicate “n is even”.
Consider the statement
There is an integer that is prime and even.
Rewrite this statement as an existential statement using the
predicates Prime(n) and Even(n).
Solution:
• ∃n such that Prime(n) ∧ Even(n).
• ∃ an even integer n such that Prime(n).
• ∃ a prime integer n such that Even(n).
Implicit Quantification
• It is quite common in mathematics that statements which
seemingly are not quantified contain quantifiers implicitly
Example
1
If x ≥ 3 then x 2 ≥ 9.
∀x ∈ R, x ≥ 3 → x 2 ≥ 9
2
12 is a product of an even and an odd integer.
∃ odd m and even n, such that 12 = m · n
• The statement
∀x ∈ R, x ≥ 3 → x 2 ≥ 9
can also be written in the following way (which is quite
common in mathematics):
x ≥ 3 =⇒ x 2 ≥ 9
Definition
If P(x) and Q(x) are predicates which have the same domain
D, the notation
P(x) =⇒ Q(x)
means that every element x ∈ D which is in the truth set for
P(x) is also in the truth set of Q(x). Equivalently,
∀x,
P(x) → Q(x)
The notation
P(x) ⇐⇒ Q(x)
means that the universal statement
∀x,
P(x) ↔ Q(x)
is true; i.e. that P(x) and Q(x) have the same truth sets.
Example
Suppose Q(n), R(n), and S(n) are the following predicates
Q(n):
R(n):
S(n):
“n is a factor of 8.”
“n is a factor of 4.”
“n < 5 and n 6= 3.”
whose domain is Z+ . use =⇒ and ⇐⇒ to find the relationship
between predicates Q(n), R(n) and S(n).
Solution: The truth sets in Z+ for these three statements are
Q(n) :{1, 2, 4, 8}
R(n) :{1, 2, 4}
S(n) :{1, 2, 4}
We see that:
R(n) ⇐⇒ S(n)
R(n) =⇒ Q(n)
S(n) =⇒ Q(n)
Negations of Quantified Statements
• Consider the following statement:
“All engineering students have to take MTH 314.”
• If we want to negate this statement, intuitively, we would
phrase it in the following way:
“There are some engineering students which do not have
to take MTH 314.”
• Note that we cannot negate the original statement by
saying:
“No engineering students have to take MTH 314.”
Theorem
(Negation of a Universal Statement) The negation of a
statement
∀x in D, P(x)
is logically equivalent to a statement of the form
∃x in D such that ∼ P(x)
We can write that as
∼ (∀x ∈ D, P(x)) ≡ ∃x ∈ D such that ∼ P(x)
• If we were to negate the existential statement
“Some birds are mammals.”
the correct logical reasoning would indicate that it should
say:
“No birds are mammals.”
instead of
“Some birds are not mammals.”
Theorem
(Negation of an Existential Statement) The negation of a
statement
∃x in D such that P(x)
is logically equivalent to a statement of the form
∀x in D, ∼ P(x)
We can write that as
∼ (∃x ∈ D such that P(x)) ≡ ∀x ∈ D, ∼ P(x)
Examples
Write the formal negations of the following statements:
(a) ∀ prime n, n is odd.
(b) ∃ a continuous function f on [a, b] such that
not exist.
Rb
a
f (x)dx does
(c) No integers are divisible by 6.
Solution:
(a) ∃ a prime n such that n is not odd.
Rb
(b) ∀ continuous function f on [a, b], a f (x)dx exists.
(c) This statement is equivalent to: “∀ integer n, n is not
divisible by 6.”
So, its negation is equivalent to: “∃ an integer n such that n
is divisible by 6.”
Negations of Universal Conditional
Statements
• Suppose we want to negate a universal conditional
statement
∀x, P(x) → Q(x)
• Then, based on what we have just seen about negations of
universal statements, we see that
∼ (∀x, P(x) → Q(x))
≡
∃x such that ∼ (P(x) → Q(x))
• However,
∼ (P(x) → Q(x))
≡
P(x)∧ ∼ Q(x)
• So,
∼ (∀x, P(x) → Q(x))
≡
∃x such that (P(x)∧ ∼ Q(x)).
• We have just proved the equivalence
∼ (∀x, P(x) → Q(x))
≡
∃x such that (P(x)∧ ∼ Q(x))
Examples
Write formal negations for the following statements:
(a) ∀ integer n, if n is even, then n is divisible by 4.
(b) If a computer program P compiles without any error
messages, then P is correct.
Solution:
(a) ∃ an integer n such that n is even and n is not divisible by 4.
(b) ∃ a computer program P such that P compiles without any
error messages and P is not correct.
Relation Among ∀, ∃, ∧, and ∨
• Suppose we are looking at quantified statements which
refer to a finite domain
D = {x1 , x2 , . . . , xn }
• Saying that the statement
∀x ∈ D, P(x)
is true, is equivalent to saying that P(x) is true for every
xi ∈ D:
P(x1 ) ∧ P(x2 ) ∧ . . . ∧ P(xn )
Example
Suppose
D = {1, −1}
and P(x) is the predicate x 2 = 1. Then
∀x ∈ D, P(x)
is true since
P(1) ∧ P(−1)
is true.
• On the other hand,
∃x ∈ D such that P(x)
is equivalent to the statement
P(x1 ) ∨ P(x2 ) ∨ . . . ∨ P(xn )
Example
In the same domain D = {1, −1} consider the predicate Q(x)
stating that x 2 = x. In that case,
∃x ∈ D such that Q(x)
is true since
Q(1) ∨ Q(−1)
• Remark: If we have a universal statement
∀x ∈ D, if P(x) then Q(x)
then this statement is vacuously true if, and only if, P(x) is
false for every x ∈ D.
Example
For instance, the statement
∀x ∈ R, if x 6= x then x > 0
is vacuously true, because the hypothesis of the predicate
x 6= x
is false for every x ∈ R.
Variants of Universal Conditional
Statements
Definition
Consider a universal conditional statement
∀x ∈ D, if P(x) then Q(x)
1
Its contrapositive is the statement
∀x ∈ D, if ∼ Q(x) then ∼ P(x)
2
Its converse is
∀x ∈ D, if Q(x) then P(x)
3
Its inverse is
∀x ∈ D, if ∼ P(x) then ∼ Q(x)
Example
Given the statement
∀x ∈ R, if x > 2, then 3x + 2 > 8
write its contrapositive, converse and inverse statements.
Solution:
• Contrapositive:
∀x ∈ R, if 3x + 2 6> 8, then x 6> 2
• Converse:
∀x ∈ R, if 3x + 2 > 8, then x > 2
• Inverse:
∀x ∈ R, if x 6> 2, then 3x + 2 6> 8.
• The usual equivalences (and non-equivalences) are also
true for universal conditional statements; namely:
conditional statement ≡ its contrapositive
conditional statement 6≡ its converse
conditional statement 6≡ its inverse
converse ≡ inverse
Necessary and Sufficient Conditions;
Only If
Definition
1. “∀x, P(x) is a sufficient condition for Q(x)” means
∀x, if P(x) then Q(x)
2. “∀x, P(x) is a necessary condition for Q(x)” means
∀x, if ∼ P(x) then ∼ Q(x)
or, equivalently,
∀x, if Q(x) then P(x)
Definition
(Only If) “∀x, P(x) only if Q(x)” means
∀x, if ∼ Q(x) then ∼ P(x)
or, equivalently,
∀x, if P(x) then Q(x)
Examples
Rewrite each of the following statements as a universal
conditional statement:
(a) Squareness is a sufficient condition for rectangularity.
(b) Being at least 18 years old is a necessary condition for
eligibility to vote in national elections.
(c) A product of two integers is odd only if both of them are
odd.
Solution:
(a) ∀x, if x is a square, then x is a rectangle.
(b) ∀ people x, if x is eligible to vote in national elections, then
x is at least 18 years old.
(c)
∀m, n ∈ Z, if mn is odd , then m, n are both odd
Statements Containing Multiple
Quantifiers
Consider the following two statements about real numbers:
(a)
∀x ∈ R, ∃y ∈ R, such that x < y
(b)
∃y ∈ R, such that ∀x ∈ R, x < y
These two statements say the following:
• For every real number x, there is a larger real number y
(True.)
• There exists a real number y such that it is larger than any
real number x. (False.)
Conclusion: We see that by reversing the order of quantifiers in
a statement which involves two or more quantifiers, the
statement may change considerably.
Question:Given a statement of the form
∀x ∈ D, ∃y ∈ E such that P(x, y )
or
∃x ∈ D such that ∀y ∈ E, P(x, y )
how do we verify whether such a statement is true or false?
Suppose we want to check the truth value of the statement
∀x ∈ D, ∃y ∈ E such that P(x, y )
We can think of it as a game we play with another player (The
Spoiler) which works in the following way:
1
The Spoiler picks an arbitrary element x in D.
2
You respond by trying to find an element y in E for which
P(x, y ) is true.
3
If you have no answer for The Spoiler’s move, the
statement is false; if you can match any choice of x in The
Spoiler’s move with a good choice of y , you win and the
statement is true.
Example
In the All Here Tilomino world, we want to check the truth value
of the statement:
For every circle x, there is a triangle y which is east of x.
Solution:
• If The Spoiler picks the unnamed circle, we pick either the
unnamed triangle in the same row or b.
• If The Spoiler picks g, we pick the triangle b.
• For The Spoiler’s choice of d, we can respond by choosing
b.
Since we have a winning strategy for the game, the statement
is true.
Suppose we want to check the truth value of the statement
∃x ∈ D, such that ∀y ∈ E, P(x, y )
We can think of it as a game we play with another player (The
Spoiler) which works in the following way:
1
We pick one fixed element x of D, which we are not
allowed to change until the end of the game.
2
The Spoiler tries to challenge our choice of x by listing all
possible choices of y from E and hoping that, for at least
one of them, he/she will show that P(x, y ) fails. (In the
meantime, we twiddle our thumbs and hope for the best...)
3
If the spoiler doesn’t succeed in challenging our choice of
x, we have won the game and the statement is true; if they
manage to find a y in E which will disprove P(x, y ), we
lose the game and the statement is false.
Example
Again, in the All here Tilomino world, we want to check the truth
value of the statement
There is a circle x such that, for all squares y , x is north of y .
Solution:
• Suppose we choose the circle in row 2 of the grid.
• The Spoiler lists e; it does not disprove the statement.
• The Spoiler then tries f ; still, our choice of the circle works.
• Finally, The Spoiler is left with the last square, a; our
choice is still a good one.
The Spoiler’s attempts to challenge our choice of x failed. So,
we have won the game and the statement is true in this
Tilomino world.
Example
The reciprocal of a real number a is a real number b such that
ab = 1.
The following two statements are true. Rewrite them using
quantifiers and variables.
(a) Every nonzero real number has a reciprocal.
(b) There is a real number with no reciprocal.
Solution:
(a) ∀ nonzero real number x, ∃ a real number y such that
xy = 1
(b) ∃ a real number z such that ∀ real numbers u, zu 6= 1.
Examples
(a) The statement
∃x ∈ Z+ such that ∀y ∈ Z+ , x ≤ y
is true since it expresses the fact that there is the smallest
positive integer (which is 1).
(b) Now, if we change the domains of x and y to R+ , positive
real numbers, we have
∃x ∈ R+ such that ∀y ∈ R+ , x ≤ y
which is false, since, no matter how small x is, there is a
smaller positive real number (e.g. x/2)
Negations of Statements with Multiple
Quantifiers
• Suppose we want to negate the statement
∀x ∈ D, ∃y ∈ E such that P(x, y )
• Then, using what we have already learned about negating
quantified statements, we have
∼ (∀x ∈ D, ∃y ∈ E such that P(x, y ))
≡ ∃x ∈ D such that ∼ (∃y ∈ E such that P(x, y ))
≡ ∃x ∈ D such that ∀y ∈ E, ∼ P(x, y )
• Similarly, we can show that the statement
∼ (∃x ∈ D such that ∀y ∈ E, P(x, y ))
is equivalent to the statement
∀x ∈ D, ∃y ∈ E such that ∼ P(x, y )
Example
In the All Here Tilomino world, write a negation for each of the
following statements and determine their truth values of these
negations:
(a) For all circles x, there is a square y such that x and y have
the same size.
(b) There is a square x such that, for every triangle y , x is
west of y .
Solution:
(a) There is a circle x such that, for every square y , x and y
are not of the same size. (This statement is false)
(b) For every square x, there exists a triangle y , so that x is
not west of y . (This statement is true)
Order of Quantifiers
• As we have seen earlier, the order of quantifiers matters.
E.g., the following two statements are not equivalent:
∀x ∈ R∃y ∈ R such that x ≤ y
and
∃y ∈ R such that ∀x ∈ R, x ≤ y
• However, if the quantifiers are identical, then the order is
irrelevant. For example,
∀x ∈ R and ∀y ∈ R, x · y = y · x
is logically equivalent to
∀y ∈ R and ∀x ∈ R, x · y = y · x.
• This equivalence is also true in the case when there are
two existential quantifiers.
Remarks: The following is also true
1
“∀x ∈ D, P(x)” can be written as
∀x(x ∈ D → P(x))
2
“∃x ∈ D such that P(x)” can be written as
∃x(x ∈ D ∧ P(x))