Logic 1
Logic 1
151)
Department of Mathematics
College of Sciences
King Saud University
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
Propositions
Our discussion begins with an introduction to the basic building blocks of
logic-propositions. A proposition is a declarative sentence that is either true or
false, but not both.
Example 1.1
All the following declarative sentences are propositions.
√
1 2 is a real number.
2 −5 is a positive integer.
3 2 > 4.
4 1 + 2 = 3.
Propositions 1 and 4 are true, whereas 2 and 3 are false.
Example 1.2
Consider the following sentences.
1 What times is it?
2 Read this carefully.
3 x + 1 = 2.
4 x + y = z.
Sentences 1 and 2 are not propositions because they are not declarative sentences.
Sentences 3 and 4 are not propositions because they are neither true nor false.
Note that each of sentences 3 and 4 can be turned into a proposition if we assign
values to the variables.
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
Definition 1.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.
Example 1.3
Find the negations of the following propositions:
1 2 = 3; 3 2 ≥ −2; 5 3 > 2.
2 6 ≤ 4; 4 2 < 0;
1 2 6= 3; 3 2 < −2; 5 3 ≤ 2.
2 6 > 4; 4 2 ≥ 0;
Example 1.4
Find the negations of the following propositions
1 ” −1 is an integer”.
2 ” −1 is a negative integer”.
Solution:
1 ” −1 is not an integer”.
2 ” −1 is a non negative integer”.
Truth Table
TABLE 1 Table 1 displays the truth table for the negation of a proposition p.
p ¬p This table has a row for each of the two possible truth values of a
T F proposition p. Each row shows the truth value of ¬p corresponding
F T to the truth value of p for this row.
Definition 1.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.
Example 1.5
Find the conjunction of the propositions p and q where p is the proposition ”
2 < 5” and q is the proposition ” 2 > −6.”
Solution: The conjunction of these propositions, p ∧ q, is the proposition ” 2 < 5
and 2 > −6.”
This conjunction can be expressed more simply as ” −6 6 2 < 5.”
For this conjunction to be true, both conditions given must be true. It is false,
when one or both of these conditions are false.
Definition 1.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.
Example 1.6
What is the disjunction of the propositions p and q where p is the proposition
”−3 ∈ R” and q is the proposition ” −3 ∈ N.”
Solution: The disjunction of p and q, p ∨ q, is the proposition ”−3 ∈ R or
−3 ∈ N”
This proposition is true.
Truth Table
TABLE 2 TABLE 3
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
Table 2 displays the truth table of p ∧ q. Table 3 displays the truth table of p ∨ q.
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
Truth Table
TABLE 4
p q p→q
T T T
T F F
F T T
F F T
Example 1.7
What are the√contrapositive, the converse, and the inverse of the conditional
statement ” 2 exist whenever the real 2 is positive.”?
Solution: Because ”q whenever p” is one of the ways to express the conditional
statement p →√q, the original statement can be rewritten as ”If the real 2 is
positive, then 2 exist” √
Consequently, the contrapositive is ”If 2 does not exist, the real 2 is not
positive, then” √
The converse is ” 2 exist, then the real 2 is positive.”
√
The inverse is ”If the real 2 is not positive, then 2 does not exist”
Only the contrapositive is equivalent to the original statement.
BICONDITIONALS
Definition 1.5
Let p and q be propositions. The biconditional statement p ↔ q is the proposition
”p if and only if q”. The biconditional statement p ↔ q is true when p and q
have the same truth values, and is false otherwise. Biconditional statements are
also called bi-implications.
Note that the statement p ↔ q is true when both the conditional statements
p → q and q → p are true and is false otherwise. That is why we use the words ”if
and only if” to express this logical connective and why it is symbolically written by
combining the symbols → and ←.
Truth Table
TABLE 5
p q p↔q
T T T
T F F
F T F
F F T
Example 1.8
Let p be the statement ”You can take the flight,” and let q be the statement
”You buy a ticket.” Then p ↔ q is the statement ”You can take the flight if and
only if you buy a ticket.”
This statement is true if p and q are either both true or both false, that is, if you
buy a ticket and can take the flight or if you do not buy a ticket and you cannot
take the flight. It is false when p and q have opposite truth values.
Example 1.9
Construct the truth table of the compound proposition (p ∨ ¬q) → (p ∧ q).
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
Introduction
An important type of step used in a mathematical argument is the replacement of
a statement with another statement with the same truth value.
Because of this, methods that produce propositions with the same truth value as a
given compound proposition are used extensively in the construction of
mathematical arguments.
Definition 2.1
• A compound proposition that is always true, no matter what the truth values
of the propositional variables 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.
Example 2.1
We can construct examples of tautologies and contradictions using just one
propositional variable.
Consider the truth tables of p ∨ ¬p and p ∧ ¬p. Because p ∨ ¬p is always true, it
is a tautology. Because p ∧ ¬p is always false, it is a contradiction.
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
Definition 2.2
The compound propositions p and q are called logically equivalent if p ↔ q is a
tautology.
The notation p ≡ q denotes that p and q are logically equivalent.
Example 2.2
1 Show that ¬(p ∨ q) and ¬p ∧ ¬q are logically equivalent.
2 Show that ¬(p ∧ q) and ¬p ∨ ¬q are logically equivalent.
Solution: We construct the truth table.
TABLE 3 The Truth Table
p q p ∨ q ¬(p ∨ q) ¬p ¬q ¬p ∧ ¬q p ∧ q ¬(p ∧ q) ¬p ∨ ¬q
T T T F F F F T F F
T F T F F T F F T T
F T T F T F F F T T
F F F T T T T F T T
Example 2.3
1 Show that p → q and ¬p ∨ q are logically equivalent.
2 Show that p → q and ¬q → ¬p are logically equivalent.
Solution: We construct the truth table.
TABLE 4 The Truth Table
p q ¬p ¬q ¬p ∨ q p → q ¬q → ¬p
T T F F T T T
T F F T F F F
F T T F T T T
F F T T T T T
Example 2.4
Show that p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent.
This is the distributive law of disjunction over conjunction.
Solution: We construct the truth table.
TABLE 5 The Truth Table
p q r q∧r p ∨ (q ∧ r) p ∨ q p ∨ r (p ∨ q) ∧ (p ∨ r)
T T T T T T T T
T T F F T T T T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F F F T F F
F F T F F F T F
F F F F F F F F
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
Example 2.5
Show that ¬(p → q) and p ∧ ¬q are logically equivalent.
Solution: We could use a truth table to show that these compound propositions
are equivalent.
So, we will establish this equivalence by developing a series of logical equivalences,
using one of the equivalences in Table 6 at a time, starting with ¬(p → q) and
ending with p ∧ ¬q.
We have the following equivalences.
¬(p → q) ≡ ¬(¬p ∨ q) by Example 3
≡ ¬(¬p) ∧ ¬q by the second De Morgan’s law
≡ p ∧ ¬q by the double negation law
Example 2.6
Show that ¬(p ∨ (¬p ∧ q)) and ¬p ∧ ¬q are logically equivalent by developing a
series of logical equivalences.
Solution: Solution: We will use one of the equivalences in Table 6 at a time,
starting with ¬(p ∨ (¬p ∧ q)) and ending with ¬p ∧ ¬q.
We have the following equivalences.
¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬(¬p ∧ q) by the second De Morgan’s laws
≡ ¬p ∧ [¬(¬p) ∨ ¬q] by the first De Morgan’s laws
≡ ¬p ∧ (p ∨ ¬q) by the double negation law
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q) by the distributive laws
≡ F ∨ (¬p ∧ ¬q) because ¬p ∨ p ≡ F
≡ (¬p ∧ ¬q) ∨ F by the commutative laws
≡ ¬p ∧ ¬q by the identity laws
Consequently ¬(p ∨ (¬p ∧ q)) and ¬p ∧ ¬q are logically equivalent.
Example 2.7
Show that (p ∧ q) → (p ∨ q) is a tautology.
Solution: To show that this statement is a tautology, we will use logical
equivalences to demonstrate that it is logically equivalent to T. (Note: This could
also be done using a truth table.)
(p ∧ q) → (p ∨ q) ≡ ¬(p ∧ q) ∨ (p ∨ q) by conditional law
≡ (¬p ∨ ¬q) ∨ (p ∨ q) by the first De Morgan’s law
≡ (¬p ∨ p) ∨ (¬q ∨ q) by the associative and
commutative laws for disjunction
≡T ∨T
≡T
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
Example 3.1
Let P (x) denote the statement ”x > 3.” What are the truth values of P (4) and
P (2)?
Solution: We obtain the statement P (4) by setting x = 4 in the statement
”x > 3.” Hence, P (4), which is the statement ”4 > 3” is true.
However, P (2), which is the statement ”2 > 3,” is false.
Example 3.2
Let Q(x, y) denote the statement ”x = y + 3.” What are the truth values of the
propositions Q(1, 2) and Q(3, 0)?
Solution: To obtain Q(1, 2), set x = 1 and y = 2 in the statement Q(x, y).
Hence, Q(1, 2) is the statement ”1 = 2 + 3,” which is false. The statement
Q(3, 0) is the proposition ”3 = 0 + 3,” which is true.
Example 3.3
Let R(x, y, z) denote the statement ”x + y = z”, What are the truth values of the
propositions R(1, 2, 3) and R(0, 0, 1)?
Solution: The proposition R(1, 2, 3) is obtained by setting x = 1, y = 2, and
z = 3 in the statement R(x, y, z). We see that R(1, 2, 3) is the statement
”1 + 2 = 3”, which is true. Also note that R(0, 0, 1), which is the statement
”0 + 0 = 1”, is false.
1 Propositional Logic
Logic operators
Conditional Statements
2 Propositional Equivalences
Logical Equivalences
Constructing New Logical Equivalences
The statement ∀x P (x) is true when P (x) is true for every x and is false
when there is an x for which P (x) is false.
The statement ∃x P (x) is true when there is an x for which P (x) is true and
is false when P (x) is false for every x.
¬ (∃x Q(x)) ≡ ∀x ¬Q(x).
¬ (∀x P (x)) ≡ ∃x ¬P (x).
Example 3.4
Let P (x) be the statement ”x + 1 > x”. What is the truth value of the
quantification ∀x P (x), where the domain consists of all real numbers?
Solution: Because P (x) is true for all real numbers x, the quantification ∀x P (x)
is true.
Example 3.5
Let Q(x) be the statement ”x < 2.” What is the truth value of the quantification
∀x Q(x), where the domain consists of all real numbers?
Solution: Q(x) is not true for every real number x, because, for instance, Q(3) is
false. That is, x = 3 is a counterexample for the statement ∀x Q(x). Thus
∀x Q(x) is false.
Example 3.6
Suppose that P (x) is ”x2 > 0.” To show that the statement ∀x P (x) is false
where the universe of discourse consists of all integers, we give a counterexample.
We see that x = 0 is a counterexample because x2 = 0 when x = 0, so that x2 is
not greater than 0 when x = 0.
Looking for counterexamples to universally quantified statements is an important
activity in the study of mathematics, as we will see in subsequent sections.
When all the elements in the domain can be listed–say,x1 , x2 , ..., xn –it follows
that the universal quantification ∀x P (x) is the same as the conjunction,
P (x1 ) ∧ P (x2 ) ∧ · · · ∧ P (xn ), because this conjunction is true if and only if
P (x1 ), P (x2 ), . . . , P (xn ) are all true.
Example 3.7
What is the truth value of ∀x P (x), where P (x) is the statement ”x2 < 10” and
the domain consists of the positive integers not exceeding 4?
Solution: The statement ∀x P (x) is the same as the conjunction
P (1) ∧ P (2) ∧ P (3) ∧ P (4), because the domain consists of the integers 1, 2, 3,
and 4. Because P (4), which is the statement ”42 < 10,” is false, it follows that
∀x P (x) is false.
Example 3.8
What is the truth value of ∀x (x2 ≥ x) if the domain consists of all real numbers?
What is the truth value of this statement if the domain consists of all integers?
Solution: The universal quantification ∀x (x2 ≥ x), where the domain consists of
2
all real numbers, is false. For example, 12 6≥ 21 . Note that x2 ≥ x if and only if
x2 − x = x(x − 1) ≥ 0. Consequently, x2 ≥ x if and only if x ≤ 0 or x ≥ 1. It
follows that ∀x (x2 ≥ x) is false if the domain consists of all real numbers
(because the inequality is false for all real numbers x with 0 < x < 1). However, if
the domain consists of the integers, ∀x (x2 ≥ x) is true, because there are no
integers x with 0 < x < 1.
Example 3.9
What are the negations of the statements ∀x (x2 > x) and ∃x (x2 = 2)?
Solution: The negation of ∀x (x2 > x) is the statement ¬∀x (x2 > x), which is
equivalent to ∃x ¬(x2 > x). This can be rewritten as ∃x (x2 ≤ x).
The negation of ∃x (x2 = 2) is the statement ¬∃x (x2 = 2), which is equivalent
to ∀x ¬(x2 = 2). This can be rewritten as ∀x (x2 6= 2).
Example 3.10
Show that ¬∀x (P (x) → Q(x)) and ∃x (P (x) ∧ ¬Q(x)) are logically equivalent.
Solution: By De Morgan’s law for universal quantifiers, we know that
¬∀x (P (x) → Q(x)) and ∃x (¬(P (x) → Q(x))) are logically equivalent. By the
fifth logical equivalence in Table 7 in Section 1.2 (1.3 in book), we know that
¬(P (x) → Q(x)) and P (x) ∧ ¬Q(x) are logically equivalent for every x. Because
we can substitute one logically equivalent expression for another in a logical
equivalence, it follows that ¬∀x (P (x) → Q(x)) and ∃x (P (x) ∧ ¬Q(x)) are
logically equivalent.