Logic and Set Theory
Logic and Set Theory
Logic and Set Theory
CvSU Vision Republic of the Philippines Cavite State University shall provide
The premier university in excellent, equitable and relevant educational
historic Cavite recognized for CAVITE STATE UNIVERSITY opportunities in the arts, science and technology
through quality instruction and relevant research and
excellence in the development
of globally competitive and
Cavite City Campus development activities.
morally upright individuals. Brgy. 8, Pulo II, Dalahican, Cavite City morally
It shall produce professional, skilled and
upright individuals for global
competitiveness.
CHAPTER 1
FUNDAMENTALS OF LOGIC
Objectives:
After the completion of the chapter, students should be able to:
It is not easy to summarize in a few paragraphs the subject matter known as logic. For lawyers and
judges, it is the science of correct reasoning. They often use logic to communicate more effectively,
construct valid arguments, analyze legal contracts, and make decisions.
Many other professions make extensive use of logic. For instance, programmers use logic to design
computer software, electrical engineers use logic to design circuits for smartphones, and mathematicians
use logic to solve problems and construct mathematical proofs.
Logic is the discipline that studies the distinction of correct reasoning from incorrect reasoning by
determining the conditions under which the truth of certain beliefs leads naturally to the truth of some other
belief, and by drawing attention to the ways in which we may be led to believe something without respect
for its truth. In other words, logic is the study of language and reasoning. It shows relationships among
statements enforcing critical thinking. The purpose of logic is to enable the logician to construct valid
arguments which satisfies the basic principles.
Why do mathematicians require proofs? How are you supposed to read and understand a proof? If
you have to prove something yourself, how do you know where to start? How do you know when you’re
finished? Perhaps most importantly, what is a proof?
Historical Notes
George Boole was born in 1815 in Lincoln, England. He was raised in poverty but he was very industrious and had
learned Latin and Greek by the age of 12. Later he mastered German, French, and Italian. His first profession, at the
young age of 16, was that of an assistant school teacher. At the age of 20, he started his own school.
In 1849, Boole was appointed the chairperson of mathematics at Queens College in Cork, Ireland.
Many of Boole’s mathematical ideas, such as Boolean Algebra, have applications in the areas of computer
programming and the design of electric circuits.
Gottfried Wilhelm Leibniz (1646 – 1716) tried to advance the study of logic from a merely philosophical subject to a
formal mathematical subject. Leibniz never really completed this goal; however several mathematicians, such as
Augustus de Morgan (1806-1871) and George Boole (1815-1864), contributed to the advancement of symbolic logic
as mathematical discipline.
Examples:
1. Corazon Aquino is the first female president of the Republic of the Philippines.
2. For every positive integer n, there is a prime number larger than n.
We will use uppercase letters, frequently P or Q, to stand for variable propositions in much the same way
that you might use x or y to represent variable numbers in algebra.
2. ~𝑠 ⇒ (𝑝 ∧ ~𝑞 )
3. 𝑡 ⇔ (~𝑟 ∧ ~𝑝)
5. Taylor swift is a singer or a songwriter, if and only if she plays the piano or the guitar.
The table above indicates that when P and Q are both true, P ∧ Q is true; when P is true and Q is
false, P ∧ Q is false; etc. Note that in this case there are four rows in the table. For a proposition made up of
n elementary propositions, there will be 2 n rows in the truth table because there are two possible truth values
for each of the elementary propositions. This makes it cumbersome to construct truth tables for very
complicated propositions. Nevertheless, we will find them to be a convenient tool.
1.2.2 DISJUNCTION
We next consider propositions of the form P or Q. We have to be a bit more careful defining what we mean
in this case, because the word or can be ambiguous in English.
In the first of these sentences we mean that at least one of the two conditions must be met, it’s Tuesday or
it’s raining. If it’s raining on a Tuesday, this proposition is still true. In this case or is inclusive in the sense that it
includes the possibility that both conditions are met.
In the second sentence, we presume that only one of the two options is possible. This use of the word or is
exclusive since it excludes the possibility of both conditions being true at the same time. In normal discourse
this kind of ambiguity doesn’t usually cause any difficulty because we can determine the meaning from the
context. We do not want to allow this kind of ambiguity in logical propositions, so we always use the word or
in the inclusive sense.
The disjunction of P and Q is the proposition P or Q, denoted P ∨ Q, which is true whenever at least one of P
or Q is true. Here is a truth table for the proposition P ∨ Q
P Q 𝑷∨𝑸
T T T
T F T
F T T
F F F
1.2.3 IMPLICATION
Most mathematical propositions have the form If P, then Q. Of course, either of P or Q might be propositions
made of several other propositions.
Let’s consider an example: If the student is on the basketball team, then she won’t be in class on Friday.
The proposition If P, then Q is called an implication and is denoted P ⇒ Q. The proposition P is the hypothesis
of the implication and Q is the conclusion. The implication is false only when P is true and Q is false. Here is a
truth table for P ⇒ Q.
P Q 𝑷⇒𝑸
T T T
T F F
F T T
F F T
As a student of mathematics, it is absolutely essential that you understand what an implication means and
what it doesn’t mean. To say that P ⇒ Q is true does not mean that P is true or that Q is true, it does mean
that there is a relationship between the truth values of these two propositions. The implication P ⇒ Q is false
when P is true and Q is false; it is true when either P is false or Q is true. There are several related implications
related to the implication P ⇒ Q that we will occasionally find these useful. Be aware that these are not all
equivalent.
P Q 𝑷⇔𝑸
T T T
T F F
F T F
F F T
1.2.5 NEGATION
The negation of P, denoted ¬P and sometimes read “not P,” is the proposition whose truth value is always
opposite that of P.
Note that negation is not actually a connective since it applies to a single proposition rather than
connecting two propositions.
P ¬P
T F
F T
Step 1: Negate p.
p q ~𝒑
T T F
T F F
F T T
F F T
Step 2: Perform ~𝒑 ∨ 𝒒 by comparing the highlighted columns.
p q ~𝒑 ~𝒑 ∨ 𝒒
T T F T
T F F F
F T T T
F F T T
Step 3: Negate (~𝒑 ∨ 𝒒).
p q ~𝒑 ~𝒑 ∨ 𝒒 ~(~𝒑 ∨ 𝒒)
T T F T F
T F F F T
F T T T F
F F T T F
p q ~𝒑 ~𝒑 ∨ 𝒒 ~(~𝒑 ∨ 𝒒) ~(~𝒑 ∨ 𝒒) ∨ 𝒒
T T F T F T
T F F F T T
F T T T F T
F F T T F F
Alternative Procedure
STEPS 4 2 3 1 5 1
p q ~ (~𝒑 ∨ 𝒒) ∨ 𝒒
T T F F T T T T
T F T F F F T F
F T F T T T T T
F F F T T F F F
4. Use the truth table from number 3 to determine the truth value of (𝑝 ∧ 𝑞 ) ∧ (~𝑟 ∨ 𝑞 ), given that p is
true, q is true, and r is false.
p q 𝒓 𝒑 ∧ 𝒒 ~𝒓 ~𝒓 ∨ 𝒒 (𝒑 ∧ 𝒒) ∧ (~𝒓 ∨ 𝒒).
T T T T F T T
T T F T T T T
T F T F F F F
T F F F T T F
F T T F F T F
F T F F T T F
F F T F F F F
F F F F T T F
Alternative Solution:
Determine the truth value of (𝑝 ∧ 𝑞 ) ∧ (~𝑟 ∨ 𝑞 ), given that p is true, q is true, and r is false.
Given:
𝑝=𝑇 𝑞=𝑇 𝑟=𝐹
p q
T T
T F
F T
F F
2. 𝑝 ∨ [~(𝑝 ∨ 𝑞 )]
p q
T T
T F
F T
F F
p q 𝒓
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
Therefore, 𝑃 ⇒ (𝑃 ∨ 𝑄) is a tautology.
3. (P ⇒ Q) ⇔ (¬Q ⇒ ¬P)
𝑷 𝑸 (𝑷 ⟹ 𝑸) ⟺ (~Q ⟹ ~P)
T T T T F T F
T F T F T F F
F T T T F T T
F F F F T T T
Therefore, (𝑃 ⇒ 𝑄) ⟺ (~𝑄 ⟹ ~𝑃) is NOT a tautology.
2. (𝑃 ∧ (𝑃 ⇒ 𝑄)) ⇒ 𝑄
3. (𝑃 ⇒ 𝑄) ⇔ (𝑄 ⇒ 𝑃)
4. ((𝑃 ⇒ 𝑄) ∧ (𝑄 ⇒ 𝑅)) ⇒ (𝑃 ⇒ 𝑅)
1.3.1 INSTANTATION
Instantiation means choosing a particular value for the variable(s). Consider this example: Let x = 2, then x +
3 = 12. In this case the sentence is a proposition with truth value F.
The following sentences are universally quantified propositions. Only the second is true.
• For every real number x, x + 3 = 12.
• The square of x is nonnegative for all real x.
• The square of x is nonnegative for all complex x
The following sentences are existentially quantified. All three of these are true.
• There is a real number x so that x + 3 = 12.
• The square of x is nonnegative for some real x.
• The square of x is nonnegative for some complex x.
This is a valid syllogism. If we assume that the premises are true, then the conclusion must follow.
One tool we can use to help think about syllogisms is a Venn diagram, which in its simplest form is a
collection of circles that represent the various categories in the premises. In this case we will have one circle
representing mortals and another representing man. Since one of our premises is that all men are mortal,
the circle representing men is completely contained inside the circle representing mortals:
Examples:
Determine whether each of the following syllogisms is valid.
1. Some students are freshmen. Pat is a student. Hence Pat is a freshman.
The circle for students should overlap the circle for freshmen, but
need not be contained within it since our assumption is that only
some students are freshmen.
Note that Pat may be in the student circle without being inside
the freshmen
circle, so the syllogism is not valid.
In this case, the circle for cats should be completely outside the
circle for dogs since no cats are dogs.
Since Jade must be within the cats circle, Jade cannot be within
the dogs circle, so the syllogism is valid.
Since Jawa must be in the cats circle, but may or may not be
within the psychopaths circle, this syllogism is not valid.
This requires a slightly more complicated Venn diagram, and we must be very careful about what is
absolutely necessary. This syllogism is not valid
We consider the predicate P(x, y) given by x + y = 0. Throughout, we will assume that the universe for both x
and y is the set of real numbers. Without redefining the universe every time, variables could be universally
quantified, both could be existentially quantified, or one could be universally quantified and the other
existentially quantified. We are particularly interested in determining when each proposition will be true and
whether the order of the quantifiers matters.
• ∀𝑥 ∀𝑦 𝑃(𝑥, 𝑦): This proposition can be read as for all (real) x and for all (real) y, x + y = 0, which says
the sum of any two real numbers is 0. Clearly this is false.
• ∀𝑦 ∀𝑥 𝑃(𝑥, 𝑦): Restating this as we did above, it is not difficult to see that this proposition is equivalent
to the first one.
• ∃𝑥 ∃𝑦 𝑃(𝑥, 𝑦): We can read this as there is an x so that there is a y so that x + y = 0, which says that
there are real numbers x and y such that x + y = 0. This is true. Once again, reversing the order of the
quantifiers doesn’t matter.
• ∀𝑥 ∃𝑦 𝑃(𝑥, 𝑦): This proposition says that for every x there is a y such that x + y = 0, in other words every
real number has an additive inverse, which is certainly true.
• ∃𝑦 ∀𝑥 𝑃(𝑥, 𝑦): The variables here are quantified the same, but the order is changed. Does that
matter? The proposition this time says there is a y so that for all x, x + y = 0. In other words, there is
some real number y so that adding any real number to y yields a sum of 0, which is certainly false!
The moral of the last example is that you must be careful to quantify variables in the correct order when
some variables are universally quantified and some are existentially quantified
3. 4.
5. 6.
7. 8.
9. 10.
To see that this theorem is true, we first make sure that we understand what it is saying. The variables in this
case are actually propositions P and Q, both of which are universally quantified. The theorem asserts that
the compound proposition ¬(𝑃 ⇒ 𝑄) ⇔ (𝑃 ∧ ¬𝑄) is always true, so we must demonstrate that no matter
what the truth values of P and Q are, the statement in the theorem is a tautology.
The truth of the next theorem can be established in a similar fashion, which we leave to the exercises.
Example:
Find the negation of each of the following propositions.
1. 𝑃 ∧ (𝑄 ⇒ 𝑅)
2. (𝑃 ∨ 𝑄) ∧ (𝑃 ∨ 𝑅)
3. ~(𝑄 ∨ ~𝑅) ∧ (𝑃 ∧ 𝑅)