Proofs

A proof is a valid argument that establishes the truth of a statement.

In Math and CS, we mostly use informal proofs.

Why proofs in CS?

  • To prove your program to be correct
  • Dijkstra “Testing shows the presence of bugs, not its absence”
  • To establish your OS is secure
  • To prove your algorithm gives you the correct answer
  • To show your system specifications are consistent

Tools in our “Proof” Toolbox

  • The Rules of Inference allow us to preserve truth.
  • We must begin with the truth
  • We must start with premises that are true.
  • To prove a mathematical statement, we will need the following tools
    • Definitions
    • Theorem - A statement that can be shown to be true
    • axioms - Statements we assume to be true
    • lemma - A helping theorem or result which is needed to prove a theorem
    • proof - A valid argument that establishes the truth of a theorem
    • corollary - A theorem that can be established directly from a theorem
    • conjecture - A statement that is proposed to be true, usually on the basis of some partial evidence or intuition of an expert. When proof is found, the conjecture becomes a theorem.

Types of Proofs

Link to original

Theorems

A theorem is a statement that can be shown to be true.

How are theorems stated?

  • Many theorem assert that a property holds for all elements in the domain.
  • We may have a universal quantifier, but it may not be explicitly stated.
    • Ex: If , where and are positive real numbers, then
    • What that really means is

Theorems that are Biconditional Statements

These are theorems that have the form .

We know that

We can prove biconditional by proving both and .

Ex: For all integers , is odd if and only if is odd.

Link to original

Definitions

Definitions of Numbers

Even Number

: An integer is said to be even if there exists an integer such that

Odd Number

: An integer is said to be odd if there exists an integer such that

Rational Number

: A real number is rational if there exists integers and , where ,

Irrational Number

: A real number is irrational if there exists integers and , where , , and and have no common factors

Absolute Value

: is the absolute value of and it equals when , and equals when .

Definitions of Sets

Natural Numbers

: The set of natural numbers is defined to be

Note that exists in this set. This is debated heavily, but for the purposes of this class, we assume it is a natural number.

Integers

: The set of integer numbers is defined to be

Rationals

: The set of rational numbers is defined to be

Real

Empty Set/Null Set

Is simply or

Singleton Set

A set with exactly one element.

: singleton (we are saying that we have a Set with a null set within it)

U: Universal

Refers to all the elements that are in the currently referenced scope.

Ordered -tuple

: is an ordered collection of objects.

Note that there are parentheses instead of curly brackets. When this is the case, order does matter.

as long as

a_1=b_1 \\ a_2=b_2 \\ \vdots \\ a_n=b_n \end{align}$$ If $n=2$, then we have an **ordered pair.** ### Union $$A\cup{B}$$ is defined as $$x\in A \vee x\in B$$ ### Intersection $$A\cap B$$ is defined as $$x\in A\wedge x\in B$$ ### Difference $$ A - B $$ is defined as $$x\in A \wedge \neg x\in B$$ ### Complement $$\overline{A}\; \text{or}\; A^\complement $$ is defined as $$x\in U\wedge \neg x\in A$$ Complement of $B$ with respect to $A$ is the difference ### Set Identities ### Cardinality of Combined Sets (Principle of Inclusion-Exclusion) $|A\cup B| = |A| + |B| - |A\cap B|$ $|A\cup B\cup C| = |A|+|B|+|C|-|A\cap B| - |B\cap C| - |C\cap A| + |A\cap B\cap C|$ $$|A\cup B\cup C\cup D| = |A|+|B|+|C|+|D|-|A\cap B| - |B\cap C| - |C\cap D| - |C\cap D| - |A\cap B| - |A\cap C| + |A\cap B\cap C| + |A\cap C\cap D|+|B\cap C\cap D|+|A\cap B\cap D|-|A\cap B\cap C\cap D|$$ $A_1\cup A_2$ $\bigcup\limits_{i=1}^{n}A_i$ ## Functions ### Increasing/Decreasing Functions if $x<y$ then $f(x)\leq f(y)$ this is increasing $f(x)<f(y)$ this is strictly increasing if $x>y$ then $f(x)\geq f(y)$ this is decreasing if $x>y$ then $f(x)>f(y)$ this is strictly decreasingLink to original

Direct Proof

Definition

A direct proof of a conditional statement is constructed by

  • Assume is true
  • Use rules of inferences, axioms, and logical (basic) equivalences to show that must follow

Note: In some cases, you may want to use direct proof by contraposition

Example 1: Give a direct proof of the theorem “If is an odd integer, then is odd.”

: An integer is said to be even if there exists an integer such that

: An integer is said to be odd if there exists an integer such that

For direct proof, we will assume the hypothesis is true.

Proof:

Assume is odd, then we have , for some integer (this is essentially a universal instantiation)

Squaring , , we get where is an integer

\begin{flalign} n^2 \\ \equiv\, <\mathrm{substitution}> \\ (2k+1)^2 \\ \equiv\, <\mathrm{algebra}> \\ 4k^2+4k+1 \\ \equiv\, <\mathrm{algebra}> \\ 2(2k^2+2k)+1 \\ \equiv\, <\mathrm{substitution}> \\ 2r+1 \end{flalign}

What if we skip the last substitution? We can do this instead:

Since is an integer, is also an integer. can be written as by the definition of odd integers, is odd.

Example 2: Give a direct proof of the theorem “The sum of two real rational numbers is rational”

Remember the definition of a rational number:

Rational Number

: A real number is rational if there exists integers and , where ,

Link to original

Proof:

Arbitrarily pick 2 rational numbers. and be two real rational numbers. there exist integers ( and such that and ).

Now,

Let = and . Since are integers & and , and are integers and . by definition of rational numbers, is rational.

Link to original

Direct Proof by Contraposition

Definition

If we can prove that the negation

Example: Prove that for any integer if is odd, then is odd.

This theorem is of the form . What is and ?

: is odd. : is odd.

Contrapositive

: is even. : is even.

Proof: Assume is even. Therefore, , where is an integer. Now,

Since is an integer, is even. Therefore, . Therefore .

Link to original

Trivial Proof

Definition

If we can show that is always true then we can say is true.

Example: Let be “if and are non-negative integers and , then . Show that is true.

  • What is the domain? Non-negative integers (includes zero)
  • We need to show is true, in other words, “if and are non-negative integers and , then .”

Let’s do an equivalence style proof:

The conclusion is always true regardless of what the values of a and b are. Therefore, P(0) is always true.

Link to original

Vacuous Proof

Definition

If we can show that is always false, then is always true.

Example: Prove where is “If is an integer with , which is a perfect square then is a perfect cube.”

Proof:

is both There are no perfect squares between 10 and 15 the statement that is an integer with , which is a perfect square, then is false for all integers . is true for all integers .

note: this one lowkey explained mad weirdly, i’d recommend just watching a youtube video on it: Vacuous Proofs

Link to original

Proof by Contradiction

Transclude of Basic-Equivalences#law-of-excluded-middle

Definition

For any statement , either it is true or false. There is nothing in the middle.

So, if i want to prove , I can start by assuming is true.

Suppose from that I derive or any contradiction.

Basically, proof by contradiction relies on you making an assumption (a negation of part of the statement) and then proving that the statement is false when that assumption is made, then you can say that the original is true.

Example: Prove that is irrational.

Assume is rational. There exists integers () such that and and have no common factors.

Now,

Since is an integer, is an even integer.

Using result, is even.

there exists an integer such that

Since is an integer, is even. b is even.

Since and are even, and and have a common factor of 2.

This contradicts the fact that the and are co-prime and have no common factors. Therefore, the opposite must be true, and is irrational.

Example 2: Prove a claim of the form using proof by contradiction

We assume the negation and derive a contradiction.

Assume that both . Derive a contradiction. We can resolve the contradiction by giving up p, but p is our premises, we will stick with . Therefore, must be true. Therefore, .

Example 3: Prove “for any integer , if is odd, then is odd”

For the negation, we assume that is even and is odd.

Since is even, there exists an integer such that .

Now,

Since is an integer, is even, this contradicts the fact that is odd.

must be odd.

by contradiction, if is odd, then is odd.

Link to original

Proof by Cases

Definition

the original conditional statement wtih a hypothesis made up of a disjunction of propositions can be proved by proving each of the conditional statements individually.

To prove , we can find and then individually prove every case.

Common Errors

  • Drawing incorrect conclusions from examples
  • No matter how many cases we cover in our own proof, we cannot prove the theorem to be true unless we prove every case

Example: if is a real number, then is a positive real number.

Proof: Let us consider two cases:
  1. is positive, since a positive number times a positive number is positive, must be positive.
  2. is negative, since a negative number times a negative number is positive, must be positive This “completes” the proof (no it doesn’t. the proof is wrong)

Why? : we missed the case where

Example: Use proof by cases to prove that , where and are real numbers.

First, we need the definition of absolute value.

Transclude of Definitions#absolute-value

Proof: We will consider four cases.

Case 1: .

Therefore, we have and . Also, . Therefore,

for ,

Case 2: .

Therefore, we have and . Also, . Therefore,

for , we have

Case 3: .

Therefore, we have and . Also, . Therefore,

for , we have

Case 4: .

Therefore, we have and . Also, . Therefore,

for , we have

for all real numbers, , :

Without loss of generality (WLOG)

  • in the last example, we dismissed case 3 because it was the same as case 2 with reversed roles
  • to shorten the proofs, we could have proved cases 2 and 3 together because both are completely arbitrary, and whichever one is positive and whichever one is even does not matter

Example: Show that if and are integers and both and are even, then both and are even.

Techniques Employed:

Proof: Using proof by contrapositive, we will show that if is odd or is odd, is odd or is odd.

Without loss of generality, assume is odd.

there exists and integer such that

Now, all we have to analyze is when is odd and is even.

we must consider two cases, is odd or is even

Cases:
  1. is odd
  2. is even
Case 1: is odd.

there exists integer ,

Now \begin{align} xy\\ \equiv<substitution>\\ (2m+1)(2n+1)\\ \equiv<algebra>\\ 4mn+2m+2n+1\\ \equiv<algebra>\\ 2(2mn+m+n)+1\\ \end{align} Since and are integers, is also an integer. is odd.

Case 2: is even.

there exists integer such that y=

Now, $$\begin{align} x+y\ \equiv\ 2m+1+2n\ \equiv\ 2(m+n)+1 \end{align}$$$m, n\thereforem+n$ is an integer.

is odd.

By contraposition, if and are even, then both and are even.

Link to original

Exhaustive Proof

Definition

This is a type of Proof by Cases

Definition

the original conditional statement wtih a hypothesis made up of a disjunction of propositions can be proved by proving each of the conditional statements individually.

To prove , we can find and then individually prove every case.

Link to original

  • Some theorems can be proved by examining a small number of examples
  • We call this exhaustive proofs
  • Better for computers, but even those have limits

Common Errors

Common Errors

  • Drawing incorrect conclusions from examples
  • No matter how many cases we cover in our own proof, we cannot prove the theorem to be true unless we prove every case

Example: if is a real number, then is a positive real number.

Proof: Let us consider two cases:
  1. is positive, since a positive number times a positive number is positive, must be positive.
  2. is negative, since a negative number times a negative number is positive, must be positive This “completes” the proof (no it doesn’t. the proof is wrong)

Why? : we missed the case where

Link to original

Example: It is true that every non-negative integer is the sum of 18 fourth power integers.

: To determine if a non-negative integer can can be written as a sum of 18 fourth powers, we might begin to examine whether is the sum of 18 fourth power integers for the smallest non-negative integers.

Fourth power integers: .

We can show that non-negative integers add up to ?? can be written as a sum of 18 fourth powers.

One might conclude it is possible based on this example, but 79 cannot be written as a sum of 18 fourth powers.

Example: Prove that if is a positive integer such that

Proof:

is a positive integer where . Therefore,

For

And

Since, , therefore, for , . Repeat this line of reasoning for

Link to original