Logic
Logic
Proposition
Definition 1: A declarative sentence that
is either true or false, but not both, is a
proposition (or a statement), which we will
denote by the lowercase letter p, q, r, s, or t ■
Examples: The following sentences are
Propositions:
1) Socrates was a Greek philosopher;
2) 2+3=5;
3) 1 + 1 = 0;
Proposition
4) the moon is made of green cheese;
5) the equation x y z has no positive
n n n
p q pq
Truth table T T T
for p q
T F F
F T F
F F F
Disjunction
Definition 4: The disjunction of two
arbitrary propositions p and q, denoted by
pq
is the proposition “p or q” . The
disjunction is defined by the following
truth table:
Disjunction
p q pq
T T T
Truth table
for p q T F T
F T T
F F F
Example:
p: Harry likes pepperoni pizza for lunch
q: Harry likes mushroom pizza for lunch
p v q: Harry likes pepperoni pizza for
lunch or Harry likes mushroom pizza for
lunch
p v q: Harry likes pepperoni or mushroom
pizza for lunch.
Negation
Definition 5: The negation of a proposition
p is “It is not the case that p”, denoted by p.
You may read p as the “negation of p” or
simply “not p”. The negation is defined by
the following truth table:
p p
Truth table T F
for p
F T
Implication
Definition 6: Two propositions p and q can
be combined to form statement: If p, then q.
Such a statement is an implication, denoted by
pq
. Since it involves a condition, it is also
called a conditional statement. The component
p is the hypothesis of the implication and q the
conclusion. The implication is defined by the
following truth table:
Implication
pq
and defined by the following truth table:
Biconditional Statement
Truth table p q pq
for p q :
T T T
T F F
F T F
F F T
Example: Construct a truth table
for p q q p
p q p q q p p q q p
T T T T T
T F F T F
F T T F F
F F T T T
Equivalents
Definition 8: Two compound propositions s
and t, are logically equivalent, symbolized by
st
if they have identical truth tables ■
Examples:
p q p q q p
p q q p
Example: p q p q
p q p p q pq
T T F T T
T F F F F
F T T T T
F F T T T
Tautology and Contradiction
Definition 9: a) A compound statement
that is always true (T) is a tautology;
b) A compound statement that is always false
(F) is a contradiction ■
Examples: 1) p p
2) p p
3) p q p q 4) p p
The order of precedence: 1) 2)
3) 4) 5)
Laws of Logic
Let p, q, and r be any three propositions.
Let t denote a tautology and f a contradiction.
Then:
1) Associative Laws:
p q r p q r
p q r p q r
Laws of Logic
2) Commutative Laws:
p q q p, pq q p
3) Distributive Laws:
p q r p q p r ,
p q r p q p r .
Laws of Logic
4) De Morgan's Laws:
p q p q, p q p q
5) Idempotent Laws:
p p p, p p p
6) Double negation Law:
p p
Laws of Logic
7) Properties of the tautology (t) and
contradiction (f):
p t t, p f f
p f p, p t p
t f , f t
8) Contradiction Law: p p f
Laws of Logic
9) Third Exclusion Law:
p p t
10) Implication Conversion Law:
p q p q
11) Contrapositive Law:
p q q p
12) Reductio ad Absurdum Law:
p q p q f
Laws of Logic
Example: p q r p q r
Proof:
7. x y z, x N , y N , z N .
Predicate
Definition 11 (general) :
Predicate P is a function of the following type
P : M 1 M 2 ... M n T , F , M i UD, i 1, 2,..., n
■
The variables in the predicate P are free
variables. As they vary over the UD, the truth
value of P can vary.
Quantifiers
Definition 12:
Universal quantifier: - for all, for each, or
for every.
Existential quantifier: - for some, there
exists a, or for at least.
Uniqueness quantifier: ! - there exists a
unique (meaning exactly one) ■
Quantifiers
The statements
xP x , xP x , ! xP x
are quantified propositions with fixed truth
values. The variable x in quantified proposition
is a bound variable, bound by the appropriate
quantifier.
Quantified propositions
Example: Rewrite each proposition
symbolically, where UD -set of integer numbers:
1) For each integer x, there exists an integer y
such that x + y = 0.
2) There exists an integer x such that x + y = y
for every integer y.
3) For all integers x and y, x y = y x.
4) There are integers x and y such that x + y=
=1.
Quantified propositions
The order is important in the following
quantified propositions:
xy x y yx x y
Quantified propositions
Example: Determine the truth value of each
proposition, where x and y are real numbers:
1) xy y x ,
2
2) xy y x ,
2
3) xy y x ,
2
4) yx y x ,
2
5) xy y x 2 , 6) yx y x 2 .
Equivalences involving
Quantified propositions
Definition 13: Statements involving quantified
propositions 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 is used for the variables ■
Example:
x P x Q x xP x xQ x
x P x Q x xP x xQ x
Negation of a quantified
propositions
De Morgan's laws:
Truth table H C H C
for H C T T T
T F F
F T T
F F T
Trivial proof
The trivial proof is based on the “Implication
Conversion Law”:
H C H C
I) If hypothesis H is false, then the implication
H C is true regardless of whether C is true
or false.
Trivial proof
Examples:
1) If 1=2, then 3=4.
2) If 1 is even, then 2n+1 is even for all
positive integer n.
II) If conclusion C is true, then the implication
H C is true regardless of whether H is true
or false.
Trivial proof
Examples:
1) If n is a prime number, then n 2 n is an
even integer.
2) Let P x, n 1 x 1 nx .
n
If x is a positive real number, then P x, 0
is true.
3) Prove that for every integer n 41 number
2n 7 is odd.
Direct Proof
In the direct proof of the theorem H C
assume that the given hypotheses H is true.
Using the laws of logic or previously known facts,
establish that the desired conclusion C is also
true. The result (implication H C is true)
follows out of Truth table for implication.
Direct Proof
Examples: 1) Product of any two odd integers
Is an odd integer.
PROOF: There exist integers m and n such
that x = 2m + 1 and y = 2n + 1. Thus,
x y 2m 1 2n 1 4mn 2m 2n 1
2 2mn m n 1 2k 1
■
Direct Proof
2) The arithmetic mean of any two nonnegative
real numbers is greater than or equal to their
geometric mean.
PROOF: Let a, b R and a 0, b 0. Then
2
a b 0 a 2 ab b 0
ab
ab ■
2
Indirect Proof
There are two kinds of indirect proofs for the
theorem H C : proof by contraposition
and proof by contradiction.
The first method is based on the Law of the
Contrapositive:
H C C H
In this method, assume the desired conclusion
C is false; then using the laws of logic, establish
Proof by contraposition
that hypothesis H is also false. Once you have
done this, the theorem is proved.
Examples:
1) If the square of an integer is odd, then the
integer is odd.
PROOF: Let x be any integer such that x 2 is
odd. We would like to prove that x must be an
odd integer. In the contrapositive method, we
Proof by contraposition
assume the conclusions false; that is, x is not
odd; in other words, assume x is an even
integer: x=2k for some integer k. Then
x 2k 2 2k
2 2 2
x 2 3 5 ... p 1
Proof by contradiction
Clearly, x > p and x is a prime: when x is
divided by each of the primes 2, 3, 5,…,p, we
get 1 as the remainder. But this contradicts the
assumption that p is a largest prime number ■
2) 2 is not a rational number .
PROOF: Suppose the given conclusion is false;
that is, 2 is a rational number :
m
2 , or n 2 2 m 2
n
Proof by contradiction
Without loss of generality We can assume, that
fraction
m
is uncancelled. On the other hand:
n
n 2 m m 2k n 2k
2 2 2 2
n 2p
But this contradicts the assumption that fraction
m n is uncancelled ■
Existence Theorems
Theorems of the form xP x also occur in
mathematics. To prove such a theorem,we must
establish the existence of an object a for which
P (a) is true. Such a proof is an existence proof.
There are two kinds of existence proofs:
the constructive existence proof and the
nonconstructive existence proof. If we are able
to find a mathematical object b such that P (b)
Constructive proof
1729 1 12 9 10
3 3 3 3
Nonconstructive proof
A nonconstructive existence proof of the
Theorem xP x does not provide us with an
element a for which P (a) is true, but rather
Establishes its existence by an indirect method,
usually contradiction.
Example:
Prove that there is a prime number > 3.
Nonconstructive proof
PROOF: Suppose there are no primes > 3. Then
2 and 3 are the only primes. Since every integer
2
can be expressed as a product of powers of
primes, 25 must be expressible as i a product
25 2 3 j of
powers of 2 and 3, that is, for some
integers i and j. But neither 2 nor 3 is a factor
of 25, so
i 25
25 2 3 j cannot be written in the form
- a contradiction.
Counterexample
Is the statement Every girl is a brunette true or
false? Since we can find at least one girl who is
not a brunette, it is false!
More generally, suppose you would like to show
that the statement xP x is false. Since
xP x x P x
by De Morgan's law, the statement xP x
Counterexample
n N E n n 2
n 41 is a prime