Lesson 1-The Foundations-Logic and Proofs
Lesson 1-The Foundations-Logic and Proofs
1
Predicate logic uses the following features:
Variables:
Predicates:
Quantifiers
Example 1.0.1
is greater than is a predicate. If we choose then we get the propositional
statement “ is greater than , which is true. But if we choose , then we get the
propositional statement is greater than which is false. So it is clear that the truth value
of a predicate depends on the value of the variable(s).
Predicates are often found in mathematical assertions, in computer programs, and in system
specifications. These statements are neither true nor false when the values of the variables are
not specified. In this section, we will discuss the ways that propositions can be produced from
such statements. The statement is greater than has two parts. The first part, the
variable , is the subject of the statement. The second part-the predicate, "is greater than "-
refers to a property that the subject of the statement can have. We can denote the statement
" is greater than 1" by , where denotes the predicate "is greater than " and is the
variable. The statement is also said to be the value of the propositional function at .
Once a value has been assigned to the variable , the statement becomes a proposition
and has a truth value.
Note 1
Propositional functions become propositions (and have truth values) when their
variables are each replaced by a value from the domain (or bound by a quantifier).
The statement is said to be the value of the propositional function at .
Often the domain is denoted by . So in this example is the integers.
2
Example 1.2.3
Let “ ” be denoted by and (for all three variables) be the set of all
integers. Find the truth values of the following.
1.
2.
3.
Solution:
1. F 2. T 3. Not a proposition
Remark 2:
The domain of a propositional function is the set of possible values of the arguments. The
domain is also known as the universe of discourse. This will be discussed in length under
Section 1.4(Quantifiers).
Self-Assessment Exercises
3
1.3 Compound Expressions
Recall that, compound propositions are formed by combining two or more existing
propositions using logical operators. We can extend this notion to expressions involving
predicates and quantifiers.
Example 1.3.1
Let be the statement Find the truth values of the following statements.
1.
2.
3.
4.
Solution:
1. is true (since ) and is false (since So the compound
statement is true.
2. False
3. False
4. True
Self-Assessment Exercises
1. Let be the statement Find the truth values of the following
statements.
i.
ii.
iii.
iv.
1.4 Quantifiers
Consider Example 1.3.1. Does it make sense to assign to the value “blue”? Intuitively, the
universe of discourse (or domain) is the set of all things we wish to talk about; that is, the set
of all objects that we can sensibly assign to a variable in a propositional function.
4
Example 1.4.1
What would be the universe of discourse for the propositional function The test will
be on the be?
Solution:
The universe of discourse ={Sunday, Monday, Tuesday, Wednesday, Thursday, Friday,
Saturday}
Example 1.4.2
1. If denotes and is the integers, then is false.
2. If denotes and is the positive integers, then is true.
3. If denotes and is the integers, then is false.
Example 1.4.3
Let be the propositional function given by where the universe of
discourse for is the set of all integers.
Express the statement for every x and for every using quantifiers.
Solution:
5
1.4.2 Existential Quantifier
Example 1.4.4
1. If denotes “x > 0” and is the set of all integers, then x P(x) is true. It is also
true if is the positive integers.
2. If denotes “x < 0” and is the set of all positive integers, then is false.
3. If denotes “x is even” and is the set of all integers, then is true.
Example 1.4.5
Let be the propositional function given by where the universe of
discourse for is the set of integers.
Express the statement there exists x and there exists such that using
quantifiers.
Solution:
Example 1.4.6
If denotes and is the integers, then is true.
But if denotes then is false.
6
1.4.4 Properties of Quantifiers
The truth value of and depend on both the propositional function and
on the domain
Example 1.4.7
1. If is the set of all positive integers and P(x) is the statement , then
is true, but is false.
2. If U is the set of all negative integers and is the statement , then both
and are true.
3. If consists of and and is the statement , then both and
are true. But if P(x) is the statement , then both and
are false.
We will often want to consider the negation of a quantified expression. For instance, consider
the negation of the statement "Every student in your class has a computer."
Note 2
Let be any predicate and be its domain (universe of discourse). Then the following
hold:
7
Example 1.4.8
Write the negation of the following statements,
1.
2.
Solution:
1.
2.
Note 3
Precedence of Quantifiers
The quantifiers and have higher precedence than all the logical operators.
For example, means
means something different.
Unfortunately, often people write x P(x) Q(x) when they mean
Self-Assessment Exercises
2. Let be the statement “for every , for every and for every z,
, where the universe of discourse for and is the set of integers.
i. Express the above statement using quantifiers.
ii. Find the truth value of the above statement.
4. Let be the statement “for each there exists such that where the
universe of discourse for and is the set of integers.
8
i. Express the above statement using quantifiers.
ii. Find the truth value of the above statement.
6. Using your previous knowledge and Note 2, write the negation of each of the
following statements.
i.
ii.
iii.
iv. )
There are many reasons to translate English sentences into expressions involving
propositional variables and logical connectives. In particular, English (and every other human
language) is often ambiguous. Translating sentences into compound statements removes the
ambiguity, which is a basic disadvantage in every human language. Moreover, once we have
translated sentences from English into logical expressions we can analyze these logical
expressions to determine their truth values.
Example 1.5.1
Translate the following sentence into logic:
“The election is decided and the votes have been counted”
Solution:
Clearly, this statement consists of two sentence parts. We will use propositional variables to
represent each sentence part and determine the appropriate logical connectives between them.
Let and represent “the election is decided”, and “the votes have been counted”,
respectively. Then we can simply connect these two components and this sentence can be
represented as .
9
Example 1.5.2
Let p and q be the following propositions.
: You drive over miles per hour.
: You get a speeding ticket.
Solution:
1. 2. 3. 4.
Now we know how to use propositions to express sentences in logical expressions. So far, we
have purposely avoided sentences whose translations required predicates and quantifiers.
Translating from English to logical expressions becomes even more complex when
quantifiers are needed. We will use some examples to illustrate how to translate sentences
from English into logical expressions, when quantifiers are involved.
Example 1.5.3
Express the statement "Every student in this class has studied calculus" using predicates and
quantifiers.
Solution:
Step 1: Rewrite the statement so that we can clearly identify the appropriate quantifiers to
use.
"For every student in this class, that student has studied calculus."
Step 2: Introduce a variable
"For every student in this class, has studied calculus."
Step 3: Introduce , which is the statement " has studied calculus." Consequently, if the
domain for x consists of the students in the class, we can translate our statement as
10
Example 1.5.4
Express the statements "Some student in this class has studied Java" and "Every student in
this class has studied either Java or Python" using predicates and quantifiers.
Solution:
Step 1: Rewrite the statement so that we can clearly identify the appropriate quantifiers to
use. "There is a student in this class with the property that the student has studied Java."
Step 3: Introduce , which is the statement " has studied Java." Consequently, if the
domain for consists of the students in the class, we can translate our statement as
We let be " has studied Python" Following our earlier reasoning, we see that if the
domain for consists of the students in this class, this second statement can be expressed as
Self-Assessment Exercises
1. Let be the statement " can speak Russian" and let be the statement " knows
the computer language C++." Express each of these sentences in terms of ,
quantifiers, and logical connectives. The domain for quantifiers consists of all students at
your school.
i. There is a student at your school who can speak Russian and who knows C++.
ii. There is a student at your school who can speak Russian but who doesn't know
C++.
iii. Every student at your school either can speak Russian knows C++.
iv. No student at your school can speak Russian or knows C++.
11
2. Let p, q, and r be the following propositions.
3. Let be the statement " has a cat," let be the statement " has a dog," and let
be the statement " has a ferret." Express each of these statements in terms of ,
, , quantifiers, and logical connectives. Let the domain consist of all students in
your class.
i. A student in your class has a cat, a dog, and a ferret.
ii. All students in your class have a cat, a dog, or a ferret.
iii. Some student in your class has a cat and a ferret, but not a dog.
iv. No student in your class has a cat, a dog, and a ferret.
v. For each of the three animals, cats, dogs, and ferrets, there is a student in your
class who has one of these animals as a pet.
A proof is a logical argument that tries to show that a statement is true. In mathematics, and
computer science, a proof has to be well thought out and tested before being accepted. There
are many different ways to go about proving something: direct proof, proof by contradiction,
and proof by induction. In this course, we will talk about direct proofs.
A statement that has been proven true in order to further help in proving another statement is
called a lemma.
12
Direct Proofs
Many theorems state that a specific type or occurrence of an object exists. One method for
proving the existence of such an object is to prove that ( implies ). In other words,
we would demonstrate how we would build that object to show that it can exist. A proof by
construction is just that, we want to prove something by showing how it can come to be. There
are only two steps to a direct proof:
Example 1.6.1
If and are consecutive integers, the sum of must be an odd number.
Proof: Following the steps we laid out before, we first assume that our hypothesis is true. We
then can say that since and are consecutive integers, is equal to . In that case,
can be rewritten as or . Therefore, we can say that
. We know that any number multiplied by an even number must be even. We also know that
if we add 1 to any even number, it becomes odd. Given these, we can say:
shows that is odd.
Example 1.6.2
If is an odd integer, then is odd.
Proof: Once again, we assume that the hypothesis of this conditional statement is true,
namely, we assume that is odd. By the definition of an odd integer, it follows that
, where is some integer. We want to show that is also odd. We can square both
sides of the equation to obtain a new equation that expresses When we do
this, we find that . By the
definition of an odd integer, we can conclude that is an odd integer (it is one more than
twice an integer). Consequently, we have proved that if is an odd integer, then is an odd
integer.
13
Self-Assessment Exercises
14