TExcelTAD
Home › Discrete Mathematics › Propositions and Proofs

Propositions and Proofs

A proof is a chain of logical steps that shows a statement is true, starting from facts everyone accepts. Programmers meet the same idea when they argue that a function always returns the right answer, not just on the inputs they tested. This lesson defines the basic vocabulary: propositions, predicates, axioms and proofs.

Propositions

A proposition is a statement that is either true or false, and not both.

Statement Proposition?
2+3=52 + 3 = 5 yes, true
"Every even number greater than 2 is a sum of two primes" yes (Goldbach's conjecture), truth value unknown
x+1=4x + 1 = 4 no: its truth depends on xx (it is a predicate)
"Close the door." no: a command is neither true nor false

A predicate is a statement with variables that becomes a proposition once the variables get values. Write P(n)P(n) for "n2+n+41n^2 + n + 41 is prime". Then P(1)P(1) is true and P(40)P(40) is false. Many important propositions have the form "for every nn, P(n)P(n)", written ∀n. P(n)\forall n.\ P(n).

Why checking examples is not enough

A predicate can hold for a long run of values and still fail. Euler's polynomial n2+n+41n^2 + n + 41 is prime for n=0,…,39n = 0, \ldots, 39. An even more striking case: the equation a4+b4+c4=d4a^4 + b^4 + c^4 = d^4 was conjectured by Euler to have no positive integer solutions, and the smallest counterexample has d=422481d = 422481. Some false claims fail only for numbers far beyond what any computer can test. That is why mathematicians want proofs.

python · try it yourself
def first_failure(pred, limit):
    for n in range(limit):
        if not pred(n):
            return n
    return None

is_prime = lambda m: m > 1 and all(m % d for d in range(2, int(m ** 0.5) + 1))
print("n^2 + n + 41 first fails at n =", first_failure(lambda n: is_prime(n * n + n + 41), 100))
print("2^n > n^2 first fails at n =", first_failure(lambda n: 2 ** n > n * n, 100))
print("2^n > n^2 holds for 5..99:", all(2 ** n > n * n for n in range(5, 100)))
n^2 + n + 41 first fails at n = 40
2^n > n^2 first fails at n = 2
2^n > n^2 holds for 5..99: True

The second predicate fails for small nn (at n=2n = 2, 4>44 > 4 is false; n=3n = 3 and n=4n = 4 fail too) but holds from n=5n = 5 on. Proving "for all n≥5n \ge 5" needs induction.

Axioms and the axiomatic method

A proof has to start somewhere. Axioms are propositions accepted without proof, such as the rules of integer arithmetic. From axioms we derive new true statements using inference rules. The most important rule is modus ponens: from PP and P→QP \to Q, conclude QQ.

Results have different names depending on their role:

Name Meaning
theorem an important proposition that has been proved
lemma a preliminary result used to prove a theorem
corollary a result that follows quickly from a theorem
conjecture a statement believed true but not yet proved

Anatomy of a good proof

Here is a short complete proof.

Theorem. The sum of two odd integers is even.

Proof. Let aa and bb be odd. By definition of odd, a=2j+1a = 2j + 1 and b=2k+1b = 2k + 1 for some integers j,kj, k. Then

a+b=2j+1+2k+1=2(j+k+1)a + b = 2j + 1 + 2k + 1 = 2(j + k + 1)

which is 2 times an integer, so a+ba + b is even. ■\blacksquare

Notice the habits: state what you assume, use the definitions (an odd number is 2k+12k + 1), name new variables, and end by saying exactly what was shown. A good proof is clear enough that a reader can check each step.

In software

Formal verification tools (Coq, Lean, Isabelle, TLA+, Dafny) check proofs by computer. They are used for compilers (CompCert), operating system kernels (seL4) and cloud infrastructure, where tests alone cannot cover every input. Even without such tools, writing down why code is correct is the habit that finds bugs before users do. See Proving Programs Correct with Invariants.

Exercises

Exercise 1: Proposition or not?

Which are propositions? (a) 7>37 > 3, (b) x2=9x^2 = 9, (c) "Every prime is odd", (d) "Is 9 prime?"

Answer

(a) and (c) are propositions ((a) true, (c) false); (b) is a predicate; (d) is a question.

Solution

(a) has a definite truth value: true. (c) is a definite claim, false because 2 is prime and even. (b) depends on xx, so it is a predicate P(x)P(x); it becomes a proposition once xx is fixed. (d) is a question, which is neither true nor false.

Exercise 2: Product of odd numbers

Prove that the product of two odd integers is odd.

Answer

(2j+1)(2k+1)=2(2jk+j+k)+1(2j + 1)(2k + 1) = 2(2jk + j + k) + 1, which is odd.

Solution

Let a=2j+1a = 2j + 1 and b=2k+1b = 2k + 1 with integers j,kj, k. Then

ab=4jk+2j+2k+1=2(2jk+j+k)+1ab = 4jk + 2j + 2k + 1 = 2(2jk + j + k) + 1

and 2jk+j+k2jk + j + k is an integer, so abab has the form 2m+12m + 1: it is odd. ■\blacksquare

Exercise 3: Find the counterexample

The claim "2n+12^n + 1 is prime whenever nn is a power of 2" holds for n=1,2,4,8,16n = 1, 2, 4, 8, 16. Check n=32n = 32.

Answer

232+1=4294967297=641⋅67004172^{32} + 1 = 4294967297 = 641 \cdot 6700417, so the claim is false.

Solution

These are the Fermat numbers; Fermat himself conjectured they are all prime, and Euler found the factor 641.

python · try it yourself
from sympy import factorint

for k in range(6):
    n = 2 ** k
    print(n, 2 ** n + 1, factorint(2 ** n + 1))
1 3 {3: 1}
2 5 {5: 1}
4 17 {17: 1}
8 257 {257: 1}
16 65537 {65537: 1}
32 4294967297 {641: 1, 6700417: 1}

Test yourself

Which of these is a predicate rather than a proposition?

  1. 55 is prime
  2. x>10x > 10
  3. 2+2=52 + 2 = 5
  4. There are infinitely many primes

From PP and P→QP \to Q we may conclude QQ. What is this rule called?

  1. Contradiction
  2. Modus ponens
  3. Induction
  4. Contrapositive

A claim holds for the first 10910^9 natural numbers. Which is true?

  1. It is proved for all natural numbers
  2. It may still fail for a larger number
  3. It must be an axiom
  4. It is a corollary