Lecture1 1250496729597372
Lecture1 1250496729597372
The Foundations:
1 Logic and Proofs
1.1 Propositional
Logic
1.2 Applications of
T he rules of logic specify the meaning of mathematical statements. For instance, these
rules help us understand and reason with statements such as “There exists an integer
that is not the sum of two squares” and “For every positive integer n, the sum of the posi-
Propositional tive integers not exceeding n is n(n + 1)∕2.” Logic is the basis of all mathematical reasoning,
Logic and of all automated reasoning. It has practical applications to the design of computing ma-
chines, to the specification of systems, to artificial intelligence, to computer programming, to
1.3 Propositional programming languages, and to other areas of computer science, as well as to many other fields
Equivalences of study.
1.4 Predicates and To understand mathematics, we must understand what makes up a correct mathematical
Quantifiers argument, that is, a proof. Once we prove a mathematical statement is true, we call it a theorem.
A collection of theorems on a topic organize what we know about this topic. To learn a math-
1.5 Nested ematical topic, a person needs to actively construct mathematical arguments on this topic, and
Quantifiers not just read exposition. Moreover, knowing the proof of a theorem often makes it possible to
1.6 Rules of modify the result to fit new situations.
Inference Everyone knows that proofs are important throughout mathematics, but many people find
it surprising how important proofs are in computer science. In fact, proofs are used to verify
1.7 Introduction to that computer programs produce the correct output for all possible input values, to show that
Proofs algorithms always produce the correct result, to establish the security of a system, and to create
1.8 Proof Methods artificial intelligence. Furthermore, automated reasoning systems have been created to allow
and Strategy computers to construct their own proofs.
In this chapter, we will explain what makes up a correct mathematical argument and intro-
duce tools to construct these arguments. We will develop an arsenal of different proof methods
that will enable us to prove many different types of results. After introducing many different
methods of proof, we will introduce several strategies for constructing proofs. We will intro-
duce the notion of a conjecture and explain the process of developing mathematics by studying
conjectures.
1.1.2 Propositions
Our discussion begins with an introduction to the basic building blocks of logic—propositions.
A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either
true or false, but not both.
We use letters to denote propositional variables (or sentential variables), that is, variables
that represent propositions, just as letters are used to denote numerical variables. The conven-
tional letters used for propositional variables are p, q, r, s, … . The truth value of a proposition
Links
ARISTOTLE (384 B .C .E .–322 B .C .E .) Aristotle was born in Stagirus (Stagira) in northern Greece. His father
was the personal physician of the King of Macedonia. Because his father died when Aristotle was young,
Aristotle could not follow the custom of following his father’s profession. Aristotle became an orphan at a
young age when his mother also died. His guardian who raised him taught him poetry, rhetoric, and Greek.
At the age of 17, his guardian sent him to Athens to further his education. Aristotle joined Plato’s Academy,
where for 20 years he attended Plato’s lectures, later presenting his own lectures on rhetoric. When Plato died in
347 B.C.E., Aristotle was not chosen to succeed him because his views differed too much from those of Plato.
Instead, Aristotle joined the court of King Hermeas where he remained for three years, and married the niece
Source: National Library of of the King. When the Persians defeated Hermeas, Aristotle moved to Mytilene and, at the invitation of King
Medicine Philip of Macedonia, he tutored Alexander, Philip’s son, who later became Alexander the Great. Aristotle tutored
Alexander for five years and after the death of King Philip, he returned to Athens and set up his own school,
called the Lyceum.
Aristotle’s followers were called the peripatetics, which means “to walk about,” because Aristotle often walked around as he
discussed philosophical questions. Aristotle taught at the Lyceum for 13 years where he lectured to his advanced students in the
morning and gave popular lectures to a broad audience in the evening. When Alexander the Great died in 323 B.C.E., a backlash against
anything related to Alexander led to trumped-up charges of impiety against Aristotle. Aristotle fled to Chalcis to avoid prosecution.
He only lived one year in Chalcis, dying of a stomach ailment in 322 B.C.E.
Aristotle wrote three types of works: those written for a popular audience, compilations of scientific facts, and systematic
treatises. The systematic treatises included works on logic, philosophy, psychology, physics, and natural history. Aristotle’s writings
were preserved by a student and were hidden in a vault where a wealthy book collector discovered them about 200 years later. They
were taken to Rome, where they were studied by scholars and issued in new editions, preserving them for posterity.
1.1 Propositional Logic 3
is true, denoted by T, if it is a true proposition, and the truth value of a proposition is false, de-
noted by F, if it is a false proposition. Propositions that cannot be expressed in terms of simpler
propositions are called atomic propositions.
The area of logic that deals with propositions is called the propositional calculus or propo-
sitional logic. It was first developed systematically by the Greek philosopher Aristotle more than
2300 years ago.
Links
We now turn our attention to methods for producing new propositions from those that we
already have. These methods were discussed by the English mathematician George Boole in
1854 in his book The Laws of Thought. Many mathematical statements are constructed by com-
bining one or more propositions. New propositions, called compound propositions, are formed
from existing propositions using logical operators.
Definition 1 Let p be a proposition. The negation of p, denoted by ¬p (also denoted by p), is the statement
“It is not the case that p.”
The proposition ¬p is read “not p.” The truth value of the negation of p, ¬p, is the opposite
of the truth value of p.
Remark: The notation for the negation operator is not standardized. Although ¬p and p are the
most common notations used in mathematics to express the negation of p, other notations you
might see are ∼p, −p, p′ , Np, and !p.
Table 1 displays the truth table for the negation of a proposition p. This table has a row for
TABLE 1 The
Truth Table for each of the two possible truth values of p. Each row shows the truth value of ¬p corresponding
the Negation of a to the truth value of p for this row.
Proposition. The negation of a proposition can also be considered the result of the operation of the
negation operator on a proposition. The negation operator constructs a new proposition from
p ¬p
a single existing proposition. We will now introduce the logical operators that are used to form
T F new propositions from two or more existing propositions. These logical operators are also called
F T connectives.
Definition 2 Let p and q be propositions. The conjunction of p and q, denoted by p ∧ q, is the proposition
“p and q.” The conjunction p ∧ q is true when both p and q are true and is false otherwise.
Table 2 displays the truth table of p ∧ q. This table has a row for each of the four possible
combinations of truth values of p and q. The four rows correspond to the pairs of truth values
TT, TF, FT, and FF, where the first truth value in the pair is the truth value of p and the second
truth value is the truth value of q.
Note that in logic the word “but” sometimes is used instead of “and” in a conjunction. For
example, the statement “The sun is shining, but it is raining” is another way of saying “The sun
is shining and it is raining.” (In natural language, there is a subtle difference in meaning between
“and” and “but”; we will not be concerned with this nuance here.)
EXAMPLE 5 Find the conjunction of the propositions p and q where p is the proposition “Rebecca’s PC has
more than 16 GB free hard disk space” and q is the proposition “The processor in Rebecca’s PC
runs faster than 1 GHz.”
Definition 3 Let p and q be propositions. The disjunction of p and q, denoted by p ∨ q, is the proposition
“p or q.” The disjunction p ∨ q is false when both p and q are false and is true otherwise.
TABLE 2 The Truth Table for TABLE 3 The Truth Table for
the Conjunction of Two the Disjunction of Two
Propositions. Propositions.
p q p∧q p q p∨q
T T T T T T
T F F T F T
F T F F T T
F F F F F F
1.1 Propositional Logic 5
The use of the connective or in a disjunction corresponds to one of the two ways the word
or is used in English, namely, as an inclusive or. A disjunction is true when at least one of the
two propositions is true. That is, p ∨ q is true when both p and q are true or when exactly one
of p and q is true.
EXAMPLE 6 Translate the statement “Students who have taken calculus or introductory computer science can
take this class” in a statement in propositional logic using the propositions p: “A student who
has taken calculus can take this class” and q: “A student who has taken introductory computer
science can take this class.”
Solution: We assume that this statement means that students who have taken both calculus and
introductory computer science can take the class, as well as the students who have taken only
one of the two subjects. Hence, this statement can be expressed as p ∨ q, the inclusive or, or
disjunction, of p and q. ◂
EXAMPLE 7 What is the disjunction of the propositions p and q, where p and q are the same propositions as
Extra
in Example 5?
Examples
Solution: The disjunction of p and q, p ∨ q, is the proposition
“Rebecca’s PC has at least 16 GB free hard disk space, or the processor in Rebecca’s PC
runs faster than 1 GHz.”
This proposition is true when Rebecca’s PC has at least 16 GB free hard disk space, when the
PC’s processor runs faster than 1 GHz, and when both conditions are true. It is false when both
of these conditions are false, that is, when Rebecca’s PC has less than 16 GB free hard disk
space and the processor in her PC runs at 1 GHz or slower. ◂
Besides its use in disjunctions, the connective or is also used to express an exclusive or.
Unlike the disjunction of two propositions p and q, the exclusive or of these two propositions is
true when exactly one of p and q is true; it is false when both p and q are true (and when both
are false).
Definition 4 Let p and q be propositions. The exclusive or of p and q, denoted by p ⊕ q (or p XOR q), is
the proposition that is true when exactly one of p and q is true and is false otherwise.
Links
GEORGE BOOLE (1815–1864) George Boole, the son of a cobbler, was born in Lincoln, England, in
November 1815. Because of his family’s difficult financial situation, Boole struggled to educate himself while
supporting his family. Nevertheless, he became one of the most important mathematicians of the 1800s. Al-
though he considered a career as a clergyman, he decided instead to go into teaching, and soon afterward
opened a school of his own. In his preparation for teaching mathematics, Boole—unsatisfied with textbooks
of his day—decided to read the works of the great mathematicians. While reading papers of the great French
mathematician Lagrange, Boole made discoveries in the calculus of variations, the branch of analysis dealing
with finding curves and surfaces by optimizing certain parameters.
Source: Library of Congress In 1848 Boole published The Mathematical Analysis of Logic, the first of his contributions to
Washington, D.C. 20540 symbolic logic. In 1849 he was appointed professor of mathematics at Queen’s College in Cork,
USA [LC-USZ62-61664]
Ireland. In 1854 he published The Laws of Thought, his most famous work. In this book, Boole
introduced what is now called Boolean algebra in his honor. Boole wrote textbooks on differential equations and on difference
equations that were used in Great Britain until the end of the nineteenth century. Boole married in 1855; his wife was the niece of
the professor of Greek at Queen’s College. In 1864 Boole died from pneumonia, which he contracted as a result of keeping a lecture
engagement even though he was soaking wet from a rainstorm.
6 1 / The Foundations: Logic and Proofs
The truth table for the exclusive or of two propositions is displayed in Table 4.
EXAMPLE 8 Let p and q be the propositions that state “A student can have a salad with dinner” and “A student
can have soup with dinner,” respectively. What is p ⊕ q, the exclusive or of p and q?
Solution: The exclusive or of p and q is the statement that is true when exactly one of p and
q is true. That is, p ⊕ q is the statement “A student can have soup or salad, but not both, with
dinner.” Note that this is often stated as “A student can have soup or a salad with dinner,” without
explicitly stating that taking both is not permitted. ◂
EXAMPLE 9 Express the statement “I will use all my savings to travel to Europe or to buy an electric car” in
propositional logic using the statement p: “I will use all my savings to travel to Europe” and the
statement q: “I will use all my savings to buy an electric car.”
Solution: To translate this statement, we first note that the or in this statement must be an ex-
clusive or because this student can either use all his or her savings to travel to Europe or use all
these savings to buy an electric car, but cannot both go to Europe and buy an electric car. (This
is clear because either option requires all his savings.) Hence, this statement can be expressed
as p ⊕ q. ◂
Definition 5 Let p and q be propositions. The conditional statement p → q is the proposition “if p, then
q.” The conditional statement p → q is false when p is true and q is false, and true otherwise.
In the conditional statement p → q, p is called the hypothesis (or antecedent or premise) and
q is called the conclusion (or consequence).
Assessment
The statement p → q is called a conditional statement because p → q asserts that q is true
on the condition that p holds. A conditional statement is also called an implication.
The truth table for the conditional statement p → q is shown in Table 5. Note that the state-
ment p → q is true when both p and q are true and when p is false (no matter what truth value
q has).
TABLE 4 The Truth Table for TABLE 5 The Truth Table for
the Exclusive Or of Two the Conditional Statement
Propositions. p → q.
p q p⊕q p q p→q
T T F T T T
T F T T F F
F T T F T T
F F F F F T