Professional Documents
Culture Documents
Logic and Proofs
Logic and Proofs
Proposition:
A proposition or a statement is a declarative sentence that is either
true or false, but not both.
Examples:
Vijayawada is the capital of India.
I am in Vyzag.
1+3=4.
2+2=7.
Who are you?
Give me a cup of tea.
x+3=6.
xy=z.
First four sentences are declarative sentences which are either true
or false, but not both. So those are propositions. Fifth and sixth
sentences are not propositions because they are not declarative
sentences. Last two sentences are not propositions because they are
neither true nor false.
Propositional variables and truth value:
We use letters to denote propositional variables which represent
propositions. The truth value of a proposition is true, denoted by T, if it
is a true proposition, and the truth value of a proposition is false,
denoted by F, if it is a false proposition.
Compound propositions:
New propositions which are formed from existing propositions using
logical operators, are called compound propositions.
We discuss some of the compound propositions as follows:
Negation of a proposition: Let p be a proposition. The negation of
p, denoted by ¬p, is the statement:
“It is not the case that p.”
The proposition ¬p is read “not p”. The truth value of ¬p is the
opposite of the truth value of p.
p ¬p
T F
F T
p q p∧q
T T T
T F F
F T F
F F F
p q p∨q
T T T
T F T
F T T
F F F
p q p⊕q
T T F
T F T
F T T
F F F
Conditional Statements: 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 condition and q is called the conclusion or
consequence.
Example: If it is raining, then I will stay at home.
The Truth Table for Conditional Statement:
p q p→q
T T T
T F F
F T T
F F T
p q p↔q
T T T
T F F
F T F
F F T
x y ¬x x ∨y x ∧y x ⊕y
1 1 0 1 1 0
1 0 0 1 0 1
0 1 1 1 0 1
0 0 1 0 0 0
Applications of Propositional Logic
Logic Puzzles:
Example: An island has two kinds of inhabitants, knights, who always
tell the truth, and knaves, who always lie. You met two people A and
B in that island. Identify A and B if A says “B is a knight” and B says
“We are of same type”.
Solution: Both A and B are knights.
Propositional Equivalences
p q p∧q ¬(p ∧ q) ¬p ¬q ¬p ∨ ¬q
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T
p q p→q ¬p ¬p ∨ q
T T T F T
T F F F F
F T T T T
F F T T T
Logical Equivalences:
Equivalence Name
p ∧ T ≡ p, p ∨ F ≡ p Identity laws
p ∨ T ≡ T, p ∧ F ≡ F Domination laws
p ∨ p ≡ p, p ∧ p ≡ p Idempotent laws
¬(¬p) ≡ p Double negation law
p ∨ q ≡ q ∨ p, p ∧ q ≡ q ∧ p Commutative laws
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r ), (p ∧ q) ∧ r ≡ p ∧ (q ∧ r ) Associative laws
p ∧ (q ∨ r ) ≡ (p ∧ q) ∨ (p ∧ r ), p ∨ (q ∧ r ) ≡ (p ∨ q) ∧ (p ∨ r ) Distributive laws
¬(p ∨ q) ≡ ¬p ∧ ¬q, ¬(p ∧ q) ≡ ¬p ∨ ¬q De Morgan’s Laws
p ∨ (p ∧ q) ≡ p, p ∧ (p ∨ q) ≡ p Absorption laws
p ∨ ¬p ≡ T , p ∧ ¬p ≡ F Negation laws
Constructing New Logical Equivalences:
Example: Show that ¬(p ∨ (¬p ∧ q)) and ¬(p ∨ q) are logically
equivalent.
Solution:
¬(p ∨ (¬p ∧ q) ≡ ¬p ∧ ¬(¬p ∧ q) (by De Morgan’s law)
≡ ¬p ∧ (¬(¬p) ∨ ¬q) (by De Morgan’s law)
≡ ¬p ∧ (p ∨ ¬q) (by Double negation law)
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q) (by Distributive law)
≡ F ∨ (¬p ∧ ¬q) (by Negation law)
≡ ¬p ∧ ¬q (by Identity law)
≡ ¬(p ∨ q) (by De Morgan’s law)
Example: Show that ¬(p ↔ q) and p ↔ ¬q are logically equivalent.
Solution:
¬(p ↔ q) ≡ ¬((p → q) ∧ (q → p)) (by definition of biconditional operator)
≡ ¬(p → q) ∨ ¬(q → p) (by De Morgan’s law)
≡ ¬(¬p ∨ q) ∨ ¬(¬q ∨ p) (p → q ≡ ¬p ∨ q)
≡ (p ∧ ¬q) ∨ (q ∧ ¬p) (by De Morgan and Double negation law)
≡ ((p ∧ ¬q) ∨ q) ∧ ((p ∧ ¬q) ∨ ¬p) (by Distributive law)
≡ ((p ∨ q) ∧ (¬q ∨ q)) ∧ ((p ∨ ¬p) ∧ (¬q ∨ ¬p))
≡ ((p ∨ q) ∧ T ) ∧ (T ∧ (¬q ∨ ¬p)) (by Negation law)
≡ (p ∨ q) ∧ (¬q ∨ ¬p) (by Identity law)
≡ (¬(¬p) ∨ q) ∧ (¬p ∨ ¬q) (by Double negation law)
≡ (¬p → q) ∧ (p → ¬q) (p → q ≡ ¬p ∨ q)
≡ (¬q → p) ∧ (p → ¬q) (p → q ≡ ¬q → ¬p)
≡ p ↔ ¬q
Example: Show that (p → q) → r and p → (q → r ) are not logically
equivalent.
Solution:
(p → q) → r ≡ ¬(p → q) ∨ r (p → q ≡ ¬p ∨ q)
≡ ¬(¬p ∨ q) ∨ r (p → q ≡ ¬p ∨ q)
≡ (p ∧ ¬q) ∨ r (by De Morgan’s and Double negation law)
p → (q → r ) ≡ ¬p ∨ (q → r ) (p → q ≡ ¬p ∨ q)
≡ ¬p ∨ (¬q ∨ r ) (p → q ≡ ¬p ∨ q)
≡ (¬p ∨ ¬q) ∨ r (by Associative law)
Example: Let P(x) denote the statement “x > 2". P(5) is true and
P(2) is false.
Example: Let Q(x, y ) denote the statement “x = y + 1". Q(2, 1) is
true and Q(3, 0) is false.
∃xP(x) is true when there exists x in the domain for which P(x)
is true.
∃xP(x) is false when P(x) is false for every x in the domain.
Example: Let P(x) be the statement “x < 5". What is the truth value
of the quantification ∃xP(x), where the domain consists of all real
numbers?
Solution: ∃xP(x) is true since P(x) is true for x = 2.
Example: Let P(x) be the statement “x 2 ≤ 0". What is the truth value
of ∃xP(x), where the domain consists of all real numbers?
Solution: ∃xP(x) is true since P(x) is true for x = 0.
Example: Let P(x) be such that “x 2 < 18". What is the truth value of
∃xP(x), where the domain consists of all integers bigger than 5?
Solution: ∃xP(x) is false since P(x) is false for all integers x > 5.
Example: Let P(x) be such that “x 2 − 4 = 0". What is the truth value
of ∃xP(x), where the domain consists of all positive integers?
Solution: ∃xP(x) is true since P(x) is true for x = 2.
The Uniqueness Quantifier:
The Uniqueness quantification of P(x) is denoted by ∃!xP(x), is the
statement
“There exists a unique x in the domain such that P(x) is true."
lim f (x) = L
x→a
means
For every real number ϵ > 0 there exists a real number δ > 0 such
that |f (x) − L| < ϵ whenever 0 < |x − a| < δ.
This definition of a limit can be expressed as
into English, where F (a, b) means a and b are friends and the
domain for x, y , and z consists of all students in your college.
Solution: The statement says that there is a student x such that for
all students y and all students z if x and y are friends and x and z are
friends and y and z are not the same student, then y and z are not
friends. In other words, there is a student none of whose friends are
also friends with each other.
Translating English Sentences into Logical Expressions:
Example: Express the statement “If a person is female and is a
parent, then this person is someone’s mother" as a logical expression
involving predicates, quantifiers with a domain consisting of all
people, and logical connectives.
Solution: We introduce the propositional functions F (x) to represent
“x is female", P(x) to represent “x is a parent," and M(x, y ) to
represent “x is the mother of y ." The original statement can be
represented as
∀x((F (x) ∧ P(x)) → ∃yM(x, y ))
or
∀x∃y ((F (x) ∧ P(x)) → M(x, y )).
Example: Express the statement “Everyone has exactly one best
friend" as a logical expression involving predicates, quantifiers with a
domain consisting of all people, and logical connectives.
Solution: We introduce the predicate B(x, y ) to be the statement “y
is the best friend of x". Then the statement is expressed as
∀x∃!yB(x, y )
or
∀x∃y (B(x, y ) ∧ ∀z((z ̸= y ) → ¬B(x, z))).
Negating Nested Quantifiers:
Example: Express the negation of the statement ∀x∃y (xy = 1) so
that no negation precedes a quantifier.
Solution: ¬∀x∃y (xy = 1) ≡ ∃x(¬∃y (xy = 1)) ≡ ∃x∀y ¬(xy = 1) ≡
∃x∀y (xy ̸= 1).
Example: Use quantifiers and predicates to express the fact that
limx→a f (x) does not exist where f (x) is a real-valued function of a
real variable x and a belongs to the domain of f .
Solution:
lim f (x) ̸= L
x→a
means
¬∀ϵ > 0 ∃δ > 0 ∀x(0 < |x − a| < δ → |f (x) − L| < ϵ)
≡∃ϵ > 0 ∀δ > 0 ∃x¬(0 < |x − a| < δ → |f (x) − L| < ϵ)
≡∃ϵ > 0 ∀δ > 0 ∃x(0 < |x − a| < δ ∧ |f (x) − L| ≥ ϵ).
Step:
(1) p → q [Premise]
(2) ¬q → ¬p [Contrapositive of (1)]
(3) ¬p → r [Premise]
(4) ¬q → r [From (2) and (3), Hypothetical syllogism]
(5) r → s [Premise]
(6) ¬q → s [From (4) and (5), Hypothetical syllogism]
Hence the argument form is valid. So hypothesis p → q, ¬p → r , and
r → s lead to the conclusion ¬q → s.
Example: Show the following argument is valid. “If today is Monday, I
have a test in Mathematics or Economics. If my Economics professor
is sick, then I will not have a test in Economics. Today is Monday, and
my Economics professor is sick. Therefore, I will have a test in
Mathematics".
Solution: Let p be the statement “Today is Monday", q be the
statement “I have a test in Mathematics", r be the statement “I have a
test in Economics", s be the statement “My Economics professor is
sick".
Here the argument form is given by
p →q∨r
s → ¬r
p∧s
∴q
Step:
(1) p ∧ s [Premise]
(2) p [From (1), Simplification]
(3) s [From (1), Simplification]
(4) p → q ∨ r [Premise]
(5) q ∨ r [From (2) and (4), Modus ponens]
(6) s → ¬r [Premise]
(7) ¬r [From (3) and (6), Modus ponens]
(8) q [From (5) and (7), Disjunctive syllogism]
Hence the argument form is valid.
Rules of Inference for Quantified Statements:
Example: Show that the premises “A student in this class has not
read the book," and “Everyone in this class passed the exam" imply
the conclusion “Someone who passed the first exam has not read the
book."
Solution: Let C(x) be “x is in this class", B(x) be “x read the book",
E(x) be “x passed the exam".
Step:
(1) ∃x(C(x) ∧ ¬B(x)) [Premise]
(2) C(a) ∧ ¬B(a) [Existential instantiation from (1)]
(3) C(a) [Simplification from (2)]
(4) ∀x(c(x) → E(x) [Premise]
(5) (c(a) → E(a) [Universal instantiation from (4)]
(6) E(a) [From (3) and (5), Modus ponens]
(7) ¬B(a) [Simplification from (2)]
(8) E(a) ∧ ¬B(a) [From (6) and (7), conjunction ]
(9) ∃x(E(x) ∧ ¬B(x)) [Existential generalization from (8)]
Introduction to Proofs
Some Terminology:
A theorem is a statement that can be proved to be true by logical
arguments.
Less important theorem sometimes is called a proposition.
An axiom is a statement which we assume to be true without
proof.
A less important theorem that is helpful in the proof of other re-
sults or facts is called a lemma.
A corollary is a statement that follows directly from a theorem
that has been proved.
A conjecture is a statement that is being proposed to be a true
statement but neither proved nor disproved yet.
A proof is a valid argument that establishes the truth of a theo-
rem.
Proof Methods
Direct Proof:
A direct proof of a conditional statement p → q starts by assuming p
and finishes by establishing q. In a direct proof, we can use
definitions, axioms, previously proven facts or results, and rules of
inference.
Example: Prove that “If n is an odd integer, then n3 is odd".
Solution: If n is odd, then n = 2k + 1 for some integer k . Hence
n2 = (2k + 1)3 = 8k 3 + 12k 2 + 6k + 1 = 2(4k 3 + 6k 2 + 3k ) + 1.
Therefore n2 = 2t + 1, where t = 4k 3 + 6k 2 + 1 is an integer. Hence
n2 is odd.
Proof by Contraposition:
This method make use of the fact that the conditional statement
p → q is equivalent to its contrapositive, ¬q → ¬p.
Example: Prove that ∀n ∈ Z, if 5n + 4 is odd, then n is odd.
Solution: Let p be the statement “5n + 4 is odd" and q be the
statement “n is odd". Contrapositively, we have to prove that if n is
even then 5n + 4 is even. Assume that n is even. Then n = 2k for
some integer k . Therefore 5n + 4 = 2(5k + 2). Hence 5n + 4 is even.
Vacuous proof:
Vacuous proof is based on the fact that the conditional statement
p → q is always true if p is false. Thus in vacuous proof we have to
show that p is false.
Example: Show that the proposition P(0) is true, where P(n) is “If
n > 1, then n3 > n" and the domain consists of all integers.
Solution: Let p be the statement “n > 1" and q be the statement
“n3 > n2 ". Since p is false for n = 0, P(n) is true for n = 0. Hence
P(0) is vacuously true.
Trivial proof:
A proof of p → q that uses the fact that q is true, is called a trivial
proof.
Example: Let P(n) be “If a and b are positive integers with a ≥ b,
then an ≥ bn ", where the domain consists of all nonnegative integers.
Show that P(0) is true.
Solution: Let p be the statement “a > b" and q be the statement
“an ≥ bn ". For n = 0, q is true and q is independent of p. Hence P(0)
is trivially true.
Proof by Contradiction:
Target is to prove that a statement p is true. If for a false proposition
q, we prove that ¬p → q is true, then we can conclude that ¬p is false
and thus p is true. Proof of this type are called proof by
contradiction.
√
Example: Prove that 2 is irrational by giving a proof by
contradiction.
√ √
Solution: Assume that 2 is rational,i.e, 2 = ba for some integers
a, b with b ̸= 0 and gcd(a, b) = 1. Therefore a2 = 2b2 . Since 2 | a2 ,
hence 2 | a. Let a = 2c for some integer c. Therefore b2 = 2c 2 .
Hence 2 | b2 and so 2 | b. Since 2 | a and 2 | b, we have 2 | gcd(a, b),
which is a contradiction
√ to gcd(a, b) = 1. Hence our assumption is
wrong. Therefore 2 is irrational.
√
Note: Generalizing proof of last example one can show that p is
irrational for any prime p.
Proof by Equivalence:
To prove a theorem that is a biconditional statement, that is, a
statement of the form p ↔ q, we show that p → q and q → p are both
true.
Example: Prove the theorem “If n is an integer, then n is even if and
only if n2 is even."
Solution:
Note: Sometimes a theorem states that several propositions are
equivalent. Such a theorem states that propositions p1 , p2 , p3 , ..., pn
are equivalent. To show they are equivalent one can show p1 → p2 ,
p2 → p3 ,..., pn−1 → pn , pn → p1 .
Example: Show that these statements about the integer n are
equivalent:
p1 : n is odd.
p2 : n + 5 is even.
p3 : n2 + 1 is even.
Solution:
Proof by Cases:
A proof by cases must cover all possible cases that arise in a
theorem. We illustrate proof by cases with few examples.
Example: Prove that if n is an integer, then n3 ≥ n.
Solution:
Example: Show that |xy | = |x||y |, where x and y are real numbers.
Solution:
Proof Without Loss of Generality:
To prove |xy | = |x||y |, we consider the cases x > 0, y < 0 and
x < 0, y > 0. But these are same cases with the roles of x and y
reversed. To make the proof shorter, we could have proved these
cases together by assuming, without loss of generality, that x > 0 and
y < 0. One can proof the case with x < 0 and y > 0 by using similar
argument.
Example: Show that if x and y are integers and both xy , x + y are
even, then both x and y are even.
Solution:
Proof of Existence:
Many theorems are assertions that objects of a particular type exist.
A theorem of this type is a proposition of the form ∃xP(x), where P is
a predicate. A proof of a proposition of this kind is called a proof of
existence.
Example: Show that there is a positive integer that can be written as
the sum of cubes of positive integers in two different ways.
Solution:
Proof of Uniqueness:
Some theorems assert the existence of a unique element with a
particular property. To prove a statement of this type we need to show
that an element with this property exists and that no other element
has this property.
Example: Show that if a and b are real numbers and a ̸= 0, then
there is a unique real number r such that ar + b = 0.
Solution:
Backward Proof:
Target of backward proof method is to prove a statement q and For
that we have to find a statement p with the help of q such that we can
prove with the property that p → q.
Example: Prove that the arithmetic mean of two different positive
numbers is greater than their geometric mean.
Solution:
Counterexample:
To show that a statement of the form ∀xP(x) is false, we need only a
counterexample, that is, an example x for which P(x) is false.
Example: Show that the statement “Every positive integer is the sum
of the squares of three integers" is false.
Solution: