Sunteți pe pagina 1din 102

Ma 124, SemI, 2011-2012 Logic

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


Letters are used to represent propositions. Conventional
letters are p, q, r, s,
The truth value of a proposition is denoted by T, if it is
true, or F, if it is false.
Compound propositions are formed from existing
propositions using logical operators.
Remarks
Ma 124, SemI, 2011-2012 Logic
Let p be a proposition. The statement
It is not the case that p.
is another proposition, called the negation of p. The negation
of p is denoted by p, read not p.
Definition
To study all the possible values of the negation of a
proposition, a truth table is used.
Truth Table
p p
T F
F T
Ma 124, SemI, 2011-2012 Logic
Let p be the proposition There is a quiz on Wednesday.
Write the negation of p.
Example 2
Ma 124, SemI, 2011-2012 Logic
Let p and q be propositions. The proposition p and q,
denoted by p q, is the proposition that is true when both p
and q are true and is false otherwise. The proposition p q is
called the conjunction of p and q.
Definition
Truth Table
p q p q
T T T
T F F
F T F
F F F
Ma 124, SemI, 2011-2012 Logic
Let p be the proposition Today is Monday and q be the
proposition It is scorching hot today. Write the conjunction
of p and q.
Example 3
Ma 124, SemI, 2011-2012 Logic
Let p and q be propositions. The proposition p or q, denoted
by p q, is the proposition that is false when both p and q are
false and is true otherwise. The proposition p q is called the
disjunction of p and q.
Definition
Truth Table
p q p q
T T T
T F T
F T T
F F F
Ma 124, SemI, 2011-2012 Logic
Let p be the proposition Today is Monday and q be the
proposition It is scorching hot today. Write the disjunction
of p and q.
Example 4
Ma 124, SemI, 2011-2012 Logic
The statement in a fastfood selection says that The meal
comes with a slice of cake or a scoop of ice cream. Is the or
in this statement interpreted using definition 3?
Example 5
Ma 124, SemI, 2011-2012 Logic
Let p and q be propositions. The exclusive or of p and q,
denoted by p q, is the proposition that is true when exactly
one of p and q is true and is false otherwise.
Definition
Truth Table
p q p q
T T F
T F T
F T T
F F F
Ma 124, SemI, 2011-2012 Logic
Let p and q be propositions. The implication p q is the
proposition that is false when p is true and q is false and is
true otherwise. Here, p is called the hypothesis (or premise)
and q is called the conclusion.
Definition
Truth Table
p q p q
T T T
T F F
F T T
F F T
Ma 124, SemI, 2011-2012 Logic
Let p be the proposition I get elected president and q be the
proposition The Philippines will become a first-world
country. Write the implication p q.
Example 6
Ma 124, SemI, 2011-2012 Logic
True or false?
a. If today is Friday, then 2 + 3 = 5.
b. If today is Friday, then 2 + 3 = 6.
Example 7
Ma 124, SemI, 2011-2012 Logic
Other common ways to express p q are
if p, then q
p implies q
if p, q
q if p
q whenever p
p is sufficient for q
q is necessary for p
p only if q
Remark
Ma 124, SemI, 2011-2012 Logic
Write the statement You can enter the school only if you
have an ID in symbol form. Let p be You can enter the
school and q be You have an ID.
Example 8
Ma 124, SemI, 2011-2012 Logic
The proposition q p is the converse of p q.
The proposition q p is the contrapositive of p q.
Definition
Ma 124, SemI, 2011-2012 Logic
Consider the implication If today is a Monday, then I have a
test today.
The converse of the statement is If I have a test today,
then today is a Monday.
The contrapositive of the statement is If I do not have a
test today, then today is not a Monday.
Example 9
Ma 124, SemI, 2011-2012 Logic
Let p and q be propositions. The biconditional p q is the
proposition that is true when p and q have the same truth
values and is false otherwise.
Definition
Truth Table
p q p q
T T T
T F F
F T F
F F T
Ma 124, SemI, 2011-2012 Logic
The biconditional p q is true precisely when both p
q and q p are true. Because of this, p q is read as p
if and only if q.
Other common ways to express p q are
p is necessary and sufficient for q
if p then q, and conversely
Remarks
Ma 124, SemI, 2011-2012 Logic
Write the following statements in symbols.
a. You cannot ride the roller coaster if you are under 4 feet
tall unless you are older than 16 years old.
b. You can access the Internet from campus only if you are
a computer science major or you are not a freshman.
Example 10
Ma 124, SemI, 2011-2012 Logic
Use truth tables to determine the possible truth values of the
following propositions.
a. (p q) (p q)
b. (q r) p
c. p (q r)
d. (p q) (p r)
Example 11
Ma 124, SemI, 2011-2012 Logic
Section 1.2
Logical Equivalences
Ma 124, SemI, 2011-2012 Logic
A compound proposition that is always true, no matter what
the truth values of the propositions that occur in it, is called a
tautology. A compound proposition that is always false is
called a contradiction. A compound proposition that is
neither a tautology nor a contradiction is called a
contingency.
Definition
Ma 124, SemI, 2011-2012 Logic
Show that
a. p p is a tautology.
b. p p is a contradiction.
Example 1
Ma 124, SemI, 2011-2012 Logic
The compound propositions p and q are called logically
equivalent if p q is a tautology. The notation p q (or p
q) denotes that p and q are logically equivalent.
Definition
Ma 124, SemI, 2011-2012 Logic
or is not a logical connective but rather is the
statement p q is a tautology.
The compound propositions p and q are equivalent if and
only if the columns giving their truth values (in a truth
table) agree.
Remarks
Ma 124, SemI, 2011-2012 Logic
Determine if the following propositions are logically
equivalent.
a. p q ; q p (contrapositive)
b. p q ; q p (converse)
Example 2
Ma 124, SemI, 2011-2012 Logic
Common Logical Equivalences
Ma 124, SemI, 2011-2012 Logic
Common Logical Equivalences
Ma 124, SemI, 2011-2012 Logic
Without using a truth table, showthat
p p q
anu
p q
are logically equivalent.
Example 3
Ma 124, SemI, 2011-2012 Logic
Without using a truth table, showthat
p q p q
is a tautology
Example 4
Ma 124, SemI, 2011-2012 Logic
Without using a truth table, showthat
p (q r
anu
q (p r)
are logically equivalent.
Example 5
Ma 124, SemI, 2011-2012 Logic
Without using a truth table, showthat
p q
anu
p q
are logically equivalent.
Example 6
Ma 124, SemI, 2011-2012 Logic
Section 1.3
Predicates and Quantifiers
Ma 124, SemI, 2011-2012 Logic
There are statements that involve variables such as
"x > 0" "x + 1 = 3" "x
2
+ y
2
= z
2
"
x loves the Philippines.
These statements are not propositions unless all variables
are assigned particular values.
Statements with variables
Ma 124, SemI, 2011-2012 Logic
Statements involving variable/s can be divided into two
parts. The first part is the set of variables, which is called the
subject. The second part of the statement is the predicate, a
certain property or characteristic that the subject can have.
Definition
Ma 124, SemI, 2011-2012 Logic
In the statement x > 0, the subject is x and the predicate
is >0 or the property of being positive.
In the statement x loves the Philippines, x is the subject
while loves [being loving of] the Philippines is the
predicate.
There can also be multiple subjects as in the case of x
2
+
y
2
= z
2
. Here, x, y and z are the subjects while the predicate
is the property that x
2
+ y
2
= z
2
.
Example 1
Ma 124, SemI, 2011-2012 Logic
A statement that involves a variable, say x, can be
represented as P(x) where P is called a propositional
function. P(x), the function value of P at x, can be interpreted
as the statement obtained by replacing the variable with a
particular value x.
Definition
Ma 124, SemI, 2011-2012 Logic
Let P(x) be the statement x > 0.
P(4) = 4 > 0 which is T.
Similarly, P(3) = 3 > 0 which is F.
Example 2
Ma 124, SemI, 2011-2012 Logic
The function values of a propositional function are
propositions.
A propositional function can involve more than one
variable. In this case, the propositional function is written
as P(x
1
, x
2
, , x
n
) where n is the number of variables
involved.
For example, the statement x
2
+ y
2
= z
2
can be denoted
by F(x, y, z). In this case, F(3, 4, 5) = 3
2
+ 4
2
= 5
2
which
has truth value T.
Remarks
Ma 124, SemI, 2011-2012 Logic
The domain of discourse or the universe of discourse (or
simply the domain) is the set of all possible values of the
variable x in the propositional function P(x).
Definition
Ma 124, SemI, 2011-2012 Logic
A quantifier specifies the set of values of x to be considered
for a propositional function P(x). Common quantifiers are all,
some, and none.
Definition
Ma 124, SemI, 2011-2012 Logic
The propositional function P(x) = x
2
0 can be quantified
using the quantifier for all real numbers . Using this, the
statement becomes a true proposition.
Example 3
Ma 124, SemI, 2011-2012 Logic
Quantification is a way of making a proposition from a
propositional function.
As such, a quantification of a propositional function is a
proposition; thereby, it has a truth value.
Remarks
Ma 124, SemI, 2011-2012 Logic
The universal quantification of P(x) is the statement
P(x) for all values of x in the domain.
The notation x P(x) denotes the universal quantification of
P(x). Here is called the universal quantifier and is read as
for all, for every, or for each.
Definition
Ma 124, SemI, 2011-2012 Logic
x P(x) is
true when P(x) is true for every x.
false when there is an x for which P(x) is false.
An element for which P(x) is false is called a
counterexample of x P(x).
When the domain is empty, x P(x) is true for any
propositional function P(x) because there are no
elements x in the domain for which P(x) is false.
Remarks
Ma 124, SemI, 2011-2012 Logic
Let P(x) be the statement |sin x| 1. What is the truth
value of the quantification x P(x) where the domain is all
real numbers?
Example 4
Ma 124, SemI, 2011-2012 Logic
Let P(a) be the statement
What is the truth value of the quantification a P(a) where
the domain is all real numbers?
Example 5
lim
x a
x a


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)

S-ar putea să vă placă și