0% found this document useful (0 votes)
16 views

CS 2742 (Logic in Computer Science) - Fall 2008: Antonina Kolokolova

This document summarizes different proof techniques in logic and computer science: direct proof, proof by contrapositive, proof by contradiction, and proof by cases. It provides examples of each technique. The direct proof shows that if n is divisible by 4, then it is divisible by 2. The proof by contrapositive proves that if n squared is even, then n is even. The proof that the square root of 2 is irrational uses proof by contradiction. The proof that the floor and ceiling of (n+1)/2 are equal uses a proof by cases on n being even or odd.

Uploaded by

ZhichaoWang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

CS 2742 (Logic in Computer Science) - Fall 2008: Antonina Kolokolova

This document summarizes different proof techniques in logic and computer science: direct proof, proof by contrapositive, proof by contradiction, and proof by cases. It provides examples of each technique. The direct proof shows that if n is divisible by 4, then it is divisible by 2. The proof by contrapositive proves that if n squared is even, then n is even. The proof that the square root of 2 is irrational uses proof by contradiction. The proof that the floor and ceiling of (n+1)/2 are equal uses a proof by cases on n being even or odd.

Uploaded by

ZhichaoWang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS 2742 (Logic in Computer Science) Fall 2008

Lecture 5
Antonina Kolokolova
September 15, 2011

1.1

Proof techniques

Example 1. Consider the sentence if n is divisible by 4, then n is divisible by 2 (we


will use the notation n|4 to mean n is divisible by 4). This is an if-then statement. Its
contrapositive is if n 6 |2 then n 6 |4. That is, if n is an odd number then it is definitely
not divisible by 4.So n|4 is sufficient for n|2 (if n is divisible by 4, it is sufficient for n to be
divisible by 2). On the other hand, n|2 is necessary for n|4.
1) Direct proof : show that if p is true directly.
2) Proof by contrapositive: instead of p q prove q p.
Lemma 1. If n2 is even, then n is even.
Proof. We will show this by showing that if n is odd, then n2 is odd. If n is odd, then
n = 2k + 1 for some k. Then (2k + 1)2 = 2(2k 2 + 2k) + 1, which is an odd number. This
proves that if n is odd, then n2 is odd, thus proving the contrapositive of if n2 is even
then n is even, and so proving the statement if n2 is even then n is even itself.
3) Proof by contradiction: to show that p is true, show that p F .
It is easy to show that (p F ) is logically equivalent to p: just note that (p
F ) (p F ) p by applying the definition of implication followed by the
double negation law followed by the identity law.

Theorem 1. 2 is irrational.
Proof. Recall that a number is called rational if it can be represented as an
(irreducible)
fraction of two integers. Assume, for the sake of contradiction, that 2 is rational:
that
is, there are integers m and n which do not have any common divisors > 1 such
that 2 = m/n.
12

If

2 = m/n then ( 2)2 = m2 /n2 .

From here, 2n2 = m2 , which means that m2 is even.


By the lemma above, then m is even, so m = 2k for some k.
Then m2 = 4k 2 . So 2n2 = 4k 2 , and, dividing by 2, n2 = 2k 2 . So n2 is even.
Using the lemma again, conclude that n is even.
So both n and m are even, but we assumed that m and n do not have a non-trivial
common divisor. This is a contradiction.

4) Proof by cases: to show that p is true, prove (q p) (q p).


Lemma 2. For any natural number n, b(n + 1)/2c = dn/2e
Here, bkc is a floor of a (real) number, defined to be the largest integer smaller than
or equal to k. For example, b5/2c = 2, and b4/2c = 2. Similarly, a ceiling of a
number is the smallest integer larger than or equal to that number. So d5/2e = 3 and
d4/2e = 2. For an integer, both its floor and its ceiling are equal to that integer itself;
for a non-integer, the floor is is rounded-down value and the ceiling is rounded up.
Proof. Case 1: n is even. Then b(n + 1)/2c = n/2 = dn/2e.
Case 2: n is odd. Then b(n + 1)/2c = (n + 1)/2 = dn/2e.
Puzzle 4. A from the island of knights and knaves said: If I am a knight, then Ill eat my
hat!. Prove that A will eat his hat.

13

You might also like