1.3. Proofs#

Now that we have a solid understanding of propositional and predicate logic, it is time to actually put them to use. In this section we will examine a few proof methods—strategies to formally prove something. Then, we will see lots of examples of putting them to use.

We have already seen equivalence proofs as one kind of proof. “Proof by truth table” is also another valid option for proving equivalence. Here, we look to prove more general statements that cannot (easily) be proved by a truth table.


1.3.1. Theorems#

In mathematics, a proof is a very formal thing.

Definition (proof)

A proof is a precise, formal, and valid argument which establishes the truth of a statement.

Much like how satisfiability and consistency have direct applications to computer science, so too do mathematical proofs. For example:

  • computer and software system verification;

  • cybersecurity and cryptography;

  • artifical intelligence; and

  • guaranteeing algorithm correctness.

But to find a proof, we must first begin with something to prove. In mathematics we have several different categories of “provable” things.

Definition (theorem)

A theorem is a formal statement that can be shown to be true. It establishes a truth from which other theorems can be proved, or algorithms constructed.

Definition (lemma)

A lemma is a formal statement that can be shown to be true, and is used as part of the proof of another theorem. It is a “helper theorem”.

Definition (proposition)

A proposition is a formal statement that can be shown to be true, but the importance of this fact is less than that of a theorem.

Definition (corollary)

A corollary is a special case of a theorem, lemma, or proposition. It follows directly from a theorem and is not typically proved explicitly. Corollaries are stated to show an “important result” or “important implication” of of a theorem.

Definition (conjecture)

A conjecture is a formal statement that is likely to be true, but has not yet been proved to be true. Once proven to be true, it may become a formal theorem or lemma.

Regarless of whether we are dealing with a theorem, a lemma, or a proposition, the way they are stated and the way they are proved remains the same. So, all of the remaining content in this section applies to a theorem, lemma, etc. We will simply use “theorem” for consistency.

A rose by any other name would smell as sweet.

—Shakespeare

Theorem Statements#

Theorems are typically stated as inferences or biconditionals. “If P then Q” or “P if and only if Q”. Often, mathematicians are not very good at writing so explicitly. They may write “Let x be ‘something something something’ and y have property ‘something’. There is z that ‘something else’”.

Moreover, this structure of using “let x be…” is an implicit universal quantifer. For all x which satisfy this property, the inference (theorem) holds.

With a little practice, we can extract the impliciation from such statements. Indeed, the “language of mathematics” is itself a language, and we need to understand it through practice.

Implicit implications

Consider the following theorem statement.

Theorem

Let x, y be positive real numbers such that x>y. Then, x2>y2.

This also means:

“If x>y, where x and y are positive real numbers, then x2>y2.”

Which also means:

“For all positive real numbers x and y, if x>y, then x2>y2.”

Notice that the last statement in this previous example is the closest to being a direct translation to predicate logic. Let P(x,y):=x>y. Let Q(x,y):=x2>y2. If we let the domain of x and y be all positive real numbers, then the previous example states xy (P(x,y)Q(x,y)).

Translating theorems

Translate the following theorems to quantified logic statements.

  1. 4x4+1=(2x2+2x+1)(2x22x+1) holds for any real number x

  2. “Suppose m and n are integers such that n2+1=2m. Then, m must be the sum of squares of two integers.”

Translating theorems

  1. Let A(x):=4x4+1=(2x2+2x+1)(2x22x+1). Let the domain of x be all real numbers.

    x A(x)
  2. Let P(m,n):=n2+1=2m. Let Q(m,x,y):=m=x2+y2. The domains of m,n,x,y are the integers.

    m n (P(m,n)x y Q(m,x,y))

Proving “obvious” theorems#

Sometimes, certain statements are obviously true. Nonetheless, a simple and straight-forward proof is needed. Often, such proofs are used to prove larger or more complex theorems. Here, we will look at two such kinds of proofs before starting “real” proofs.

Consider the implication pq. If we know that q is true, then the implication is trivially true. A trivial proof is thus a simple statement that shows q to be obviously true.

Trivial proof

Proposition

If it is raining, then 1=1.

Proof:

This implication is trivially true since 1=1 is known to be true. The truth value of the premise does not matter.

Another obvious proof for implications pq relies on p being false. Recall, “falsity implies anything”. If we know p to be false, then the implication pq is always true. A vacuous proof is thus a simple statement that shows p to be obviously false.

Vacuous proof

Proposition

If the door is both open and closed, 2+2=5.

Proof:

This implication is trivially true since the premise is always false (by the law of complementation). The truth value of the conclusion does not matter.

1.3.2. Direct Proofs#

A direct proof is one of the most straight-forward types of proofs. If we wish to prove the statement pq, we assume that p is true and use laws, axioms, and logical equivalences to show that q must also be true.

Another way of defining a direct proof is the following. If we want to prove a statement AB, we assume A is true and then prove a sequence of implications: AA1A2B for some statements A1,A2,.

Before we see some examples, lets consider a few mathematical definitions.

Definition (even and odd integers)

An integer m is even if it satisfies the formula m=2k for some integer k. An integer n is odd if it satisfies the formula n=2k+1 for some integer k.

Definition (rational number)

A number n is rational if there exists integers p and q such that n=pq and q0.

In the following two examples, we prove the statement through a direct proof. By assuming p is true, and then showing q must also be true, we have directly proven pq.

A first direct proof

Proposition

If n is an odd integer, then n2 is odd.

Proof:

Let P(n):=n is odd”. Let Q(n):=n2 is odd”. Letting the domain of n be all integers, we look to prove n (P(n)Q(n)).

Let us assume P(n) is true. Therefore, there exists some integer k such that n=2k+1. Then, n2=(2k+1)2=(4k2+4k+1)=2(2k2+2k)+1. Letting k=2k2+2k, we have that k is an integer and n2=2k+1. Therefore, n2 is odd.

Note that we use the symbol to mean “end of proof”. This is also called “Q.E.D.”.

A second direct proof

Proposition

The sum of two rational numbers is rational.

Proof:

Let P(x):=x is a rational number”, where the domain of x is all (real) numbers. We look to prove x y (P(x)P(y)P(x+y).

Let us assume that x and y are rational numbers. Then, there exists integers a,b,c,d such that x=ab, y=cd, b0, and d0. We have:

x+y=ab+cd=ad+bcbd=fg,

where f=ad+bc and g=bd0 are integers. Therefore x+y is rational.

Note that translating the statement to predicate logic is not required for the proof. These are just shown for the sake of extra practice of translating and understanding theorem statements.

Proving biconditionals#

A theorem can also be stated as a conditional instead of just a single conditional, i.e. pq. In this case, our prove must consist of two parts. Remember that pq(pq)(qp). Therefore, we must prove two implications. In such a proof, proving pq is called “proving the sufficient condition”; proving qp is called: “proving the necessary condition”.

Note that each implication can be proved in a different way. For example, one implication may be vacuously true while the other requires a direct proof. For a different proof, you may prove on condition with a direct proof, and another condition with an indirect proof (see Indirect Proofs below).

Translating theorems

Prove the following statement using a direct proof.

Proposition

“A non-zero number q is rational if and only if there exists a non-zero integer n such that qn is an integer.”

Translating theorems

In this example we are proving a biconditional, an “if and only if”. Therefore, we must prove two conditionals:

  1. “If q is a non-zero rational number then there exists a non-zero integer n such that qn is an integer”, and

  2. “If qn is an integer for some number q and some non-zero integer n, then q is rational.”

Let us prove 1. Assume q is rational. Therefore, q=ab for some integers a, b with b0. Take n=b. Then, nq=nab=a. Since a is an integer, so is qn.

Let us prove 2. Assume n is a non-zero integer and qn is an integer. That means there exists an integer r such that qn=r. Since n is non-zero, we can divide both sides by n and we get q=rn. Since both r and n are integers, q is a rational number.

1.3.3. Indirect Proofs#

In an indirect proof we look to prove a statement like AB without following a sequence of implications AA1B to prove AB. Instead, we proceed in an unexpected way.

There are two main types of indirect proofs. Proof by contrapositive and proof by contradition.

Proof by Contrapositive#

To prove a statement pq we will instead prove that ¬q¬p. Indeed, recall from Implication, Inverse, Converse, and Contrapositive that an implication and its contrapositive positive are equivalent. That is, pq¬q¬p.

Proving the contrapositive can be done using any other proof method. Typically, one proves the contrapositive directly. But this is not always true. Let’s consider an example where we do prove the contrapositive directly.

Proof by contrapositive

Proposition

If n is an integer such that 3n+2 is odd, then n is odd.

Proof:

We will proceed by proof by contrapositive. Assume n is not odd. Then, we must prove 3n+2 is not odd. Since n is not odd, it is even and we have n=2k for some integer k. Then, 3n+2=3(2k)+2=6k+2=2(3k+1). Letting k=3k+1 we have 3n+2=2k. Hence, it is even.

In this previous example, notice that you may have interpreted the theorem statement as “if (n is an integer AND 3n+2 is odd) then (n is odd)”. However, since odd and even are properties of the integers only, it makes more sense to interpret this theorem statement as “for any integer n, if 3n+2 is odd then n is odd”. That is, we restrict the domain of n to be the integers.

Important

When reading and interpreting theorem statements, be sure to distinguish between what is part of the premise, and what is part of the domain of discourse.

Proof by Contradiction#

In a proof by contradiction, we look to assume some fact and then find a contradiction. Recall that a contradiction is a statement is always false.

Typically, we are looking to prove some statement p. To do so by contradiction, we assume ¬p is true and derive a contradiction. That is, we show that ¬pA1A2F, for some statements A1,A2,.

By contrapositive, if ¬pF holds then Tp holds. Therefore, p must be true.

Proof by contradiction

Theorem

There is no largest integer.

Proof:

Proceed by proof by contradiction. Assume that there does exist some largest integer. Call such an integer n. But, n+1 is also an integer and n+1 is strictly larger than n. Therefore, our assumption that a largest integer exists is false. That is, there is no largest integer is true.

1.3.4. Strategies to help with proofs#

In this section we will see some examples that will help with writing and deciphering proofs. These strategies can be incorporated into various different proof methods.

  1. Finding errors in proofs

  2. Proof by cases

  3. Without loss of generality

  4. Disproof by counterexample

Finding errors in proofs#

Remember that a proof is a logical and sequential argument. A proof only holds is every step along the way is correct. A single “misstep” makes a proof invalid and thus, not proving anything. Try to find the error in the following proof.

An incorrect proof

Proposition

1=2

Proof:

  1. a=b

  2. a2=ab

  3. a2b2=abb2

  4. (ab)(a+b)=b(ab)

  5. a+b=b

  6. 2b=b

  7. 2=1

  1. Premise

  2. Multiply both sides by a

  3. Subtract b2 from both sides

  4. Factor both sides

  5. Divide both sides by ab

  6. Since a=b, a+b=2b.

  7. Divide both sides by b.

Translating theorems

Proof:

  1. a=b

  2. a2=ab

  3. a2b2=abb2

  4. (ab)(a+b)=b(ab)

  5. a+b=b

  6. 2b=b

  7. 2=1

  1. Premise

  2. Multiply both sides by a

  3. Subtract b2 from both sides

  4. Factor both sides

  5. Divide both sides by ab

  6. Since a=b, a+b=2b.

  7. Divide both sides by b.

At step 5, we cannot divide by (ab)! We assumed a=b, therefore ab=0 and we cannot divide by 0.

Proof by cases#

In a theorem, it is possible that the premise itself is a compound statement. The compound statement may be explicit, like “Let a=1 or a=1”, or implicit, like “let n be an integer”. In this latter statement, there are different kinds of cases you could apply. You could consider n to be odd or even. You may consider n to be zero, positive, or negative.

There are two steps in a proof by cases:

  1. Extract from the theorem statement the possible cases; and

  2. Prove each case independently.

The validity of a proof by cases comes from the following logical equivalence:

(p1p2pn)q(p1q)(p2q)(pnq)

Each of the “or” conditions in the premise is a separate case that we must prove.

Proof by cases

Proposition

Let x and y be real numbers. If x0 or y0 then x2+y20.

Proof:

First, consider x0. Then, x20 and x2>0. We also know y20 without any further assumptions. Therefore, x2+y2 is strictly greater than 0.

Second, consider y0. Again, y20 and y2>0. Therefore, since x20, x2+y2 is strictly greater than 0. .

Notice in this previous proof that the proof for each case is identical, up to the “naming” of x as the variable of interest or y as the variable of interest. This brings us to our next idea: without loss of generality.

Without loss of generality#

Without loss of generality, often abbreviated to w.l.o.g., is a way for provers to be lazy. When two cases are sufficiently similar, one only needs to give a proof to one of the cases.

What constitutes as “sufficiently similar”? Typically, it will be an arbitrary choice made throughout the proof for which the other choice would be equally as valid. Such an arbitrary choice should be symmetric.

For example, if proving a statement regrading two integers a and b. One can assume, without loss of generality, that ab. Since a and b do not have any other conditions imposed on them, it is an arbitrary choice to say “ab”. It is equally valid to say “ba”.

Without loss of generality

Proposition

For two integers x and y, if xy and x+y are both even, then both x and y are even.

Proof:

We provide a proof by contrapositive. Suppose that it is not that case that both x and y are even. That is, one or both of x and y are odd. We then look to prove that xy and x+y are not both even. We will prove this contrapositive by cases.

Without loss of generality, assume that x is odd. Thus, x=2k+1 for some integer k.

Case 1: y is even and y=2 for some integer .

x+y=(2k+1)+2=2(k+)+1

Therefore, x+y is odd.

Case 2: y is odd and y=2 for some integer .

xy=(2k+1)(2+1)=4k+2k+2+1=2(2k+k+)+1

Therefore, xy is odd.

In either case, at least one of x+y or xy is odd. This proves the contrapositive and thus the proposition.

In this example, we used w.l.o.g. to state that we made an arbitrary choice. We chose that x is odd. We could have equally made the choice that y was odd and then proved the two cases that x was even or x was odd. Since either choice would follow the same proof, they are “sufficiently similar” and we only need to prove one of the choices.

Disproof by counterexample#

We have seen that many theorems are stated in the form x P(x). Rather than prove such a statement, one could also disprove the statement. That is, one can prove that x P(x) is false. But, how?

From predicate logic we know that if x P(x) is false, then ¬x P(x) is true. Moreover, ¬x P(x)x ¬P(x).

A proof by example is a proof of x Q(x) by finding a particular example for which Q(x) is true. Letting Q(x) be ¬P(x), we can thus disprove our original statement x P(x).

Disproof by counterexample

Conjecture

For a real number x, if x<1, then x2<1.

Let P(x):=x<1. Let Q(x):=x2<1. We look to disprove x (P(x)Q(x)). That is, we should prove x ¬(P(x)Q(x)). This implication is false if P(x) is true and Q(x) is false.

x=2 is such a counterexample. P(2) is true since 2<1. However, Q(2) is false since (2)2=41.

Therefore, this conjecture is false.

1.3.5. Even more types of proofs#

Up to this point we have seen several different kinds of proofs and proof strategies:

  • Direct proof

  • Proof by contrapositive

  • Proof by contradiction

  • Proof by cases

  • Disproof by counterexample

We will see even more proof methods in later chapters of this course. Most importantly, induction. To conclude this chapter we see two more kinds of closely related proofs. Existence proofs and uniqueness proofs.

Existence proofs#

Existence proofs look to prove theorems of the form x P(x). These are very similar to using counterexamples to disprove a statement.

There are two kinds of existence proofs for x P(x).

  1. A constructive proof finds a witness a such that P(a) is true. Thus proving that the statement with the existential quantifier is true. Constructive proofs may provide the witness itself or provide a method for “constructing” a witness.

  2. A nonconstructive proof proves that a witness must exist (usually in some indirect way) without providing a particular witness.

Constructive proof

Theorem

There is a positive integer that is equal to two different sums of cubes of positive integers.

Proof:

1729=103+93=123+13

You might now say: where did that proof come from? Indeed, the difficulty with existence theorems is that finding a witness can be very challenging. Moreover, it is often equally as difficult to disprove an existence theorem. That is, it is just as difficult to prove that ¬x P(x)x ¬P(x) is true.

Aside (open problems)

Such problems that have not yet been proven to be true, but also not yet proved to be false, are open problems. Open problems often have a conjecture associated with them. It is often the case that research continues in certain directions with the assumption that a conjecture is true.

If a conjecture is later found to be false, then all of that work which assumed the opposite is immediately invalidated. Such open problems are therefore very “high stakes”.

The Millenium Prize Problems are 7 open problems with particularly high stakes. In 2000, the Clay Mathematics Institute issued a bounty of $1,000,000 to each problem. The person who proved (or disproved) one of the problems would be awarded $1,000,000. In 22 years, only one of those problems has been solved: the Poincaré conjecture.

The biggest, and arguably most consequential, open problem is P=?NP. This question says, can any problem which is easily verified be easily solved?

In some sense, this is related to existence proofs. Once we have a witness, it is very easy to verify if that witness satisfies the theorem. But, is it always easy to find a witness? That is the open question of whether or not P=NP.

Most of computer science has been developed under the assumption that PNP. For example, everything related to cryptography and cybersecurity relies on PNP. You’ll learn more about that in CS3331.

Another way of performing a constructive proof is a give a method or algorithm to construct/compute a witness. This is a core principle which underlies the theory of computer science. You start with a theorem statement, prove that a solution exists by providing an algorithm to compute one, and then and only then do you implement the algorithm in a programming language.

Going the other way may not work out for you. If you try to implement an algorithm before you have proven that thing you are trying to do exists, then you may never be able to finish the algorithm because no such algorithm exists.

Even without an algorithm to construct a witness, it may still be possible to prove an existence theorem. That kind of proof would be a nonconstructive existence proof.

Nonconstructive proof

Theorem

There exists irrational numbers x and y such that xy is rational.

Proof:

We know 2 is irrational (see Exercise 1.38). Let x=y=2.

We have two cases: 22 is rational or irrational. In the first case, the theorem is obviously true and we are done. Consider the second case. Let x=22. Let y=2. By assumption x is irrational and we know y to be irrational. Then, we have:

xy=222=222=22=2

Surely 2 is rational, and we have proved the statement in both cases. .

Notice that this proof does not provide a particular witness. Rather, the proof showed that either xy=22 is rational or xy=222 is rational. But, we do not know which is the witness.


Uniqueness proofs#

The last kind of proof we will discuss in this chapter is uniqueness proofs. These are a form of existence proofs where we want to prove a statement of the form “there exists a unique x such that P(x)”.

This kind of theorem statement can be written using special notation: !x P(x). ! means that there exists exactly one element from the domain of discourse that satisfies the predicate.

Proving uniqueness can be very tricky. Indeed, proving !x P(x) is the same as proving a more complicated statement:

x (P(x)y (yx¬P(y)))

or, equivalently:

x (P(x)y (P(y)y=x))

Therefore, there are two parts of a uniqueness proof.

  1. Existence: we must show that an x exists such that P(x) is true.

  2. Uniqueness: we must show if yx then P(y) is false or we must show that if P(y) is true then y=x (they are contrapositives).

Uniqueness proof

Theorem

If a and b are real numbers such that a0, then there is a unique real number r such that ar+b=0.

Proof:

Existence: Since a0 we have ar+b=0r=ba.

Uniqueness: Proceed by contradiction. Suppose s is a real number such that sr and as+b=0. Since this and the previous equation both equal 0, we have:

ar+b=as+bar=asr=s

Since we chose s arbitrarily and arrived at the fact the r=s, we know that r is unique.

1.3.6. Exercises#

Exercise 1.33

Let n be an integer. Prove that n is even if and only if n2 is even.

Exercise 1.34

Let n be a positive integer. Prove that if 3n2+8 is even then n is even.

Exercise 1.35

Let n be a positive integer. Prove that if n is even then 5n+3n3 is even.

Exercise 1.36

Prove the following by a direct proof.

Proposition

If p is a prime number larger than 2, then p2 is odd.

Exercise 1.37

Prove the following by contrapositive.

Proposition

Let q be a number. If 5q is not rational then q is not rational.

Exercise 1.38

Prove the following proposition using proof by contradiction.

Proposition

2 is irrational.

Exercise 1.39

Prove the following proposition using proof by contradiction.

Proposition

Let q be a non-zero rational number and r be an irrational number. qr is irrational.

Exercise 1.40

Prove that the following propositional formula is a tautology.

((pq)(qr))(pr)

Exercise 1.41

Prove that log2(9) is an irrational number.

Exercise 1.42

Recall the absolute value function, |x| is defined as:

|x|={x,if x0x,if x<0

Prove that |a+b||a|+|b| for any real numbers a and b.