Documente Academic
Documente Profesional
Documente Cultură
Logic
Mark Tolentino
Mathematics Department
School of Science and Engineering
Ateneo de Manila University
15 June 08 July 2011
Ma 124, SemI, 2011-2012 Logic
Logic Puzzles
Ma 124, SemI, 2011-2012 Logic
There are three boxes. One is labeled "APPLES" another is
labeled "ORANGES". The last one is labeled "APPLES AND
ORANGES". You know that each is labeled incorrectly. You
may ask me to pick one fruit fromone box which you choose.
How can you label the boxes correctly?
Puzzle 1
Ma 124, SemI, 2011-2012 Logic
Puzzle2
1. The first question with B as
the correct answer is:
A. 1
B. 4
C. 3
D. 2
3. The correct answer to
Question 1 is:
A. D
B. C
C. B
D. A
2. The correct answer to
Question 4 is:
A. D
B. A
C. B
D. C
4. The number of questions
which have D as the correct
answer is:
A. 3
B. 2
C. 1
D. 0
5. The number of questions which have B answer is:
A. 0
B. 2
C. 3
D. 1
Ma 124, SemI, 2011-2012 Logic
Each inhabitant of a remote village always tells the truth or
always lies. A villager will only give a Yes or No response
to a question a tourist asks. Suppose you are a tourist visiting
this area. You come to a fork in the road. One branch leads to
the ruins you want to visit, the other branch leads deep into
the jungle. A villager is standing at the fork in the road. What
one question can you ask the villager to determine which
branch to take?
Puzzle 3
Logical reasoning is indispensable in discussions and/or
arguments in any field of study, research, or work.
The rules of logic give precise meaning to mathematical
statements. These rules are used to distinguish between
valid and invalid mathematical arguments.
Logic has numerous applications in computer science
such as design of computer circuits and construction of
computer programs.
Studying logic, like studying math itself, sharpens ones
mind that enables creative and critical thinking.
Why Study Logic?
Ma 124, SemI, 2011-2012 Logic
Ma 124, SemI, 2011-2012 Logic
Section 1.1
Propositional Logic
A proposition is a statement that is either true or false.
Definition
Ma 124, SemI, 2011-2012 Logic
Ma 124, SemI, 2011-2012 Logic
Determine which of the following are propositions.
a. PNoy is the president elect of the Philippines.
b. What time is it?
c. Take out one-half sheet of paper for a quiz.
d. There are classes on June 24, 2011.
e. 9
0
= 0.
f. e
x
= 9.
g. x
2
+ y
2
= z
2
.
h. a
Example 1
sin( )
If , then .
x x
x
- + +
Ma 124, SemI, 2011-2012 Logic
Suppose that the domain of a propositional function P(x)
is finite with n elements. Then, the elements of the
domain can be listed, say, as x
1
, x
2
, , x
n
.
In this case, the quantification x P(x) is the same as the
conjunction
P(x
1
) P(x
2
) P(x
n
).
Remarks
Ma 124, SemI, 2011-2012 Logic
What is the truth value of x P(x), where P(x) is the
statement x
2
< 10 and the domain consists of positive
integers not exceeding 4?
Example 6
Ma 124, SemI, 2011-2012 Logic
The existential quantification of P(x) is the statement
There exists an element x in the domain such that P(x).
The notation x P(x) denotes the existential quantification of
P(x). Here is called the existential quantifier and is read as
there exists or for some.
Definition
Ma 124, SemI, 2011-2012 Logic
x P(x) is
true when there is an x for which P(x) is true.
false when P(x) is false for every x.
When the domain is empty, x P(x) is false for any
propositional function P(x) because there can be no
element in the domain for which P(x) is true.
Remarks
Ma 124, SemI, 2011-2012 Logic
Let P(x) be the statement x
2
+ 4x + 4 = 0. What is the truth
value of the quantification x P(x) where the domain is all
real numbers?
Example 7
Ma 124, SemI, 2011-2012 Logic
Let P(a) be the statement |a| = 2/3. What is the truth
value of the quantification a P(a) where the domain is all
real numbers?
Example 8
Ma 124, SemI, 2011-2012 Logic
Suppose that the domain of a propositional function P(x)
is finite with n elements. Then, the elements of the
domain can be listed, say, as x
1
, x
2
, , x
n
.
In this case, the quantification x P(x) is the same as the
disjunction
P(x
1
) P(x
2
) P(x
n
)
Remarks
Ma 124, SemI, 2011-2012 Logic
What is the truth value of x P(x), where P(x) is the
statement x
2
> 10 and the domain consists of positive
integers not exceeding 4?
Example 9
Ma 124, SemI, 2011-2012 Logic
There is no limit to the number of quantifiers that can be
defined. Some examples are there are at least 100,
there are at most two, and there are exactly one
million.
Another important quantifier is the uniqueness
quantifier, denoted by ! or
1
. The notation !x P(x) or
1
x P(x) states that There exists a unique x such that
P(x) is true. The uniqueness quantification can also be
phrased as there is exactly one or there is one and only
one.
An example of a unique quantification is !x (x + 1) = 2.
This is a true proposition.
Other Quantifiers
Ma 124, SemI, 2011-2012 Logic
An abbreviated notation is often used to restrict the domain
of quantifiers.
Quantifiers with Restricted Domain
a. t < 0 (|t| = t)
b. z > 0 (z
2
> 0)
Example 10
Ma 124, SemI, 2011-2012 Logic
When a quantifier is used on a variable , is said to be
bound.
When a variable is not bound by a quantifier or is not
assigned a particular value, is said to be free.
The part of a logical expression to which a quantifier is
applied is called the scope of this quantifier.
Other Terms
Ma 124, SemI, 2011-2012 Logic
Statements involving predicates and quantifiers are logically
equivalent if and only if they have the same truth value no
matter which predicates are substituted into these
statements and which domain of discourse is used for the
variables in these propositional functions. The notation S T
is used to indicate that two statements (involving predicates
and quantifiers) S and T are logically equivalent.
Definition
Ma 124, SemI, 2011-2012 Logic
Show that x (P(x) Q(x)) and x P(x) x Q(x) are logically
equivalent (where the same domain is used throughout).
Example 11
Ma 124, SemI, 2011-2012 Logic
Show that x (P(x) Q(x)) and x P(x) x Q(x) are logically
equivalent (where the same domain is used throughout).
Example 12
Ma 124, SemI, 2011-2012 Logic
Negating Quantified Expressions
Ma 124, SemI, 2011-2012 Logic
Negate the statement Everybody student in this class loves
video games.
Example 13
Ma 124, SemI, 2011-2012 Logic
Negate the statement There is a student in this class who
loves math.
Example 14
Ma 124, SemI, 2011-2012 Logic
Section 1.4
Nested Quantifiers
Ma 124, SemI, 2011-2012 Logic
Nested Quantifiers
Ma 124, SemI, 2011-2012 Logic
Let Q(x, y) denote the statement x + y = 0. Let the domain of
both x and y be . What is the truth value of each of the
following?
a. xy Q(x, y)
b. xy Q(x, y)
c. xy Q(x, y)
d. xy Q(x, y)
Example 1
Ma 124, SemI, 2011-2012 Logic
Let Q(x, y, z) denote the statement x + y = z. Let the domain
of all variables be . What is the truth value of each of the
following?
a. xyz Q(x, y, z)
b. zxy Q(x, y, z)
c. xyz Q(x, y, z)
Example 2
Ma 124, SemI, 2011-2012 Logic
Which proposition is true?
xy ((x 0) (xy = 1))
or
yx ((x 0) (xy = 1))
Example 3
Ma 124, SemI, 2011-2012 Logic
Let F(x, y) = x and y are friends.
Translate the following statement to English.
xyz ((F(x, y) F(x, z) (y z)) F(y, z))
Example 4
Ma 124, SemI, 2011-2012 Logic
Write the statement Everyone has exactly one best friend
using predicates and quantifiers where the domain of
discourse is all human beings.
Example 5
Ma 124, SemI, 2011-2012 Logic
Recall the definition of limit fromcalculus.
(a) Write the definition of limit using predicates and
quantifiers. Let be the domain of all variables involved.
(b) Use predicates and quantifiers to express limit of f(x) as x
approaches a is not equal to L.
(c) Use predicates and quantifiers to express that limit of
f(x) as x approaches a does not exist.
Example 6
Ma 124, SemI, 2011-2012 Logic
Section 1.5
Rules of Inference
Ma 124, SemI, 2011-2012 Logic
The semester has just started, rumors are going around that
Our math teacher only gives an F, a C, or an A as final grade.
Motivation
Ma 124, SemI, 2011-2012 Logic
As the math teacher explains the syllabus, he says that A
student will not get an F if he passes all the exams.
Motivation
Ma 124, SemI, 2011-2012 Logic
Monica, scared of getting an F, studied hard for the entire
semester. Before the release of grades, her math teacher tells
her that You will not get an F.
Motivation
Ma 124, SemI, 2011-2012 Logic
Did Monica pass all the exams?
Question 1
Ma 124, SemI, 2011-2012 Logic
Monica knew that she would really not get an F because long
test scores are B+, B, A, B. She wanted to know her final grade
so she asked the math teacher.
Motivation
Ma 124, SemI, 2011-2012 Logic
The math teacher tells her You will not get an A if at least
two of your examscores are at most a B.
Motivation
Ma 124, SemI, 2011-2012 Logic
What is Monicas final grade?
Question 2
Ma 124, SemI, 2011-2012 Logic
An argument in propositional logic is a sequence of
propositions. All but the final proposition in the argument
are called premises and the final proposition is called the
conclusion. An argument is valid if the truth of all its
premises implies that the conclusion is true.
An argument form in propositional logic is a sequence of
compound propositions involving propositional variables. An
argument form is valid if no matter which particular
propositions are substituted for the propositional variables
in its premises, the conclusion is true if the premises are all
true.
Definition
Ma 124, SemI, 2011-2012 Logic
An argument formwith premises p
1
, p
2
, , p
n
and conclusion
q is valid when (p
1
p
2
p
n
) q is a tautology.
Remark
Ma 124, SemI, 2011-2012 Logic
Use the following true statements
If it does not rain or if it is not foggy, then the sailing race
will be held and the lifesaving demonstration will go on."
"If the sailing race is held, then the trophy will be
awarded."
"The trophy was not awarded."
to conclude that It rained.
Example 1
Ma 124, SemI, 2011-2012 Logic
Rules of Inference
Ma 124, SemI, 2011-2012 Logic
Rules of Inference
Ma 124, SemI, 2011-2012 Logic
Let
r It rained.
f It is foggy.
s The sailing race is held.
l The lifesaving demonstration goes on.
t The trophy is awarded.
Use rules of inference to show that the following
argument/argument formis valid.
Example 2
(r f) (s l)
s t
t
r
Ma 124, SemI, 2011-2012 Logic
Use rules of inference to show that the following
argument/argument formis valid.
Example 3
(p t) (r s)
q (u t)
u p
s
q
r
Ma 124, SemI, 2011-2012 Logic
Rules of Inference for Quantifies Statements
Ma 124, SemI, 2011-2012 Logic
Show that the following argument is valid by showing that its
argument form is valid using rules of inference.
Example 4
Everyone in this class has taken a course in calculus.
John is in this class.
John has taken calculus.
Ma 124, SemI, 2011-2012 Logic
Show that the following argument is valid by showing that its
argument form is valid using rules of inference.
Example 5
Every student can access the Internet.
Everyone has a laptop or can access the Internet.
Someone who is not a student has a laptop.
Ma 124, SemI, 2011-2012 Logic
Steps 5, 6 and 7 are common steps in logical reasoning.
That is why a combined rule called universal modus
tollens is defined as follows:
The similar rule called universal modus ponens is defined
as follows:
Remarks
x (P(x) Q(x))
Q(a) where a is a particular element in domain
P(a)
x (P(x) Q(x))
P(a) where a is a particular element in domain
Q(a)
Ma 124, SemI, 2011-2012 Logic
Show that the following argument form is valid using rules of
inference.
Example 6
x (P(x) (Q(x) S(x)))
x (P(x) R(x))
x (R(x) S(x))
Ma 124, SemI, 2011-2012 Logic
Show that the following argument form is valid using rules of
inference.
Example 7
x (P(x) Q(x))
x (Q(x) S(x))
x (R(x) S(x) )
x P(x)
x R(x)