Lecture 1: introduction; proof, implication, modus ponens [018T]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
These lecture notes were prepared by Jon Sterling using Marcelo Fiore’s lectures as source material. Any mistakes were introduced by Jon Sterling. Generative AI was not used to write these lecture notes.
Introduction [018U]
- September 21, 2026
- Jon Sterling, with contributions from Marcelo Fiore
This course has the following goals:
- Learn to read and write, and also work with, mathematical definitions and arguments.
- Do some basic discrete mathematics.
- Get a taste for computer science applications.
What is Discrete Mathematics? [018V]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
From Discrete Mathematics (second edition) by N. Biggs:
Discrete mathematics is the branch of Mathematics in which we deal with questions involving finite or countably infinite sets. In particular, this means that the numbers involved are either integers, or numbers closely related to them, such as fractions or ‘modular’ numbers.
What is it that we do? [018W]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
In general: we build mathematical models and apply methods to analyse problems that arise in computer science.
In particular: we make and study mathematical constructions by means of definitions and theorems. We aim at understanding their properties and limitations.
Application areas [018Y]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Discrete mathematics is applied in many areas of computer science, including but not limited to the following: algorithmics, compilers, computability, computer aided verification, computer algebra, complexity, cryptography, databases, digital circuits, discrete probability, model checking, network routing, program correctness, programming languages, security, semantics, type systems.
Lecture plan [018X]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
The course is divided in four parts:
Thinking like a mathematician [018Z]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Complementary reading: Preface and Part I of How to Think Like a Mathematician. Some friendly advice from op. cit.:
- It’s up to you.
- Think for yourself.
- Observe.
- Seek to understand.
- Collaborate.
- Be active.
- Question everything.
- Prepare to be wrong.
- Develop your intuition.
- Reflect.
Proofs [0190]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Complementary readings
- September 21, 2026
- Marcelo Fiore, Jon Sterling
- Part II, IV, and V of How to Think Like a Mathematician by K. Houston.
- Chapters 1 and 8 of Mathematics for Computer Science by Lehman, Leighton, and Meyer.
- Chapter 3 of How to Prove It by Velleman.
- Chapter II of The Higher Arithmetic by Davenport.
Proofs in practice [0191]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
We are interested in examining the following statement:
The product of two odd integers is odd.
This seems innocuous enough, but it is in fact full of baggage. For instance, it presupposes that you know:
- what a statement is;
- what the integers are, and that amongst them there is a class of odd ones;
- what the product of two integers is, and that it is in turn an integer.
More precisely put, we may write:
If m and n are odd integers, then so is m\cdot n.
This further presupposes that you know:
- what variables are;
- what “if…then” statements are, and how one goes about proving them;
- that the symbol “\cdot ” is commonly used to denote the product operation.
Yet more precisely, we should write:
For all integers m and n, if m and n are odd then so is m\cdot n.
This now additionally presupposes that you know what “for all…” statements are, and how one goes about proving them.
Thus, in trying to understand and then prove the above statement, we are assuming quite a lot of mathematical jargon that one needs to learn and practice with it to make it a useful, and in fact very powerful, tool.
Some mathematical jargon [0192]
- September 21, 2026
- with contributions from Jon Sterling, Marcelo Fiore
Jargon Statement [0193]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
A statement is a sentence that makes a definite mathematical claim
Statements can be true or false, or even unsolved. An example of a true statement is: e^{i\pi }+1 = 0\text {.} An example of a false statement is e^2 = e\text {.} An example of an unsolved statement (as of the date these notes were prepared) is Goldbach's Conjecture:
Every even natural number greater than two is the sum of two primes.
Statements can be written in any notation so long as it can be read in a standard and precise way by a fellow mathematian.
A non-example of a statement is:
This statement is false.
Although there are areas of mathematical logic that study how these kinds of expressions can be made sense of, they do not have a definite mathematical meaning in the standard mathematical vernacular and are therefore not “mathematical statements”.
Mathematics is not a game that can be “exploited” by a clever use of words: mathematics is communication, in good faith, between people who are educated in a common mathematical language.
Jargon Predicate [0199]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
A predicate is a statment whose truth depends on the value of one or more variables.
For example, “the function f is differentiable” is a predicate on functions f\colon \mathbb {R}\to \mathbb {R}.
Jargon Theorems, propositions, lemmas, corollaries, oh my! [019A]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
These are all jargon for the same “sort” of thing, but they each have a different subjective flavour. Part of the art of mathematics is knowing which one of these to use when referring to a mathematical result.
- A theorem is a very important true statement.
- A proposition is a less important but nonetheless interesting true statement.
- A lemma is a true statement that is mainly used in proving other true statements: part of the journey, rather than the destination.
- A corollary is a true statement that is a simple deduction from a theorem or proposition.
Examples: we speak of “Fermat’s Last Theorem” (a magnificent result that ironically was not known in fact to be true in Fermat’s lifetime) and “The Pumping Lemma” (an auxiliary result that is mainly used to prove that certain languages are not regular).
Jargon Conjectures [0194]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
A conjecture is a statement that the speaker believes to be true, but for which we have no proof at the time. For example, the following conjectures are believed to be true by many but not yet verified:
- Goldbach’s Conjecture
The Riemann Hypothesis- \mathbf {P}\not = \mathbf {NP}
Jargon Proofs [0195]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
A proof is a logical explanation of why a statement is true; a method for establishing truth. A proof is structured as a sequence of logical deductions from axioms and previously proved statements that concludes with the proposition in question.
Jargon Logic [0196]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Logic is the study of methods and principles used to distinguish good (correct) from bad (incorrect) reasoning.
There are many kinds of logic; for example: classical predicate logic, intuitionistic predicate logic, Hoare logic, temporal logic, etc.
Mathematicians generally do not need to be experts in formal logic in the above sense; instead, some basic understanding of the rules of reasoning (how you make progress on conclusions, how you make good use of assumptions) is sufficient.
Jargon Definition [0197]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
A definition is an explanation of the mathematical meaning of a word (or phrase). The word or phrase is defined in terms of properties and notions that have already been defined or are expected to be understood by the reader.
You may be used to one word having a single definition from school mathematics. Unfortunately, in the real world, one word may be given many different definitions in different contexts and different mathematical communities: it is up to you to be sure what meaning is intended. Generally if you are having a mathematical interaction with someone and they use a word in a way that could be ambiguous, it is expected that you would pipe up and ask them what they have in mind. Similarly, you must do your best to “simulate” your interlocutor’s frame of reference so that you may use words in a way that will denote for them.
Warning: it is vitally important that you can recall definitions precisely. A common problem is not being able to advance in some problem because the definition of a word is unknown. (Think about your examinations!)
Jargon Axiom [0198]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
An axiom is a basic assumption about a mathematical situation, which has a definite mathematical meaning.
Axioms can be considered facts that do not need to be proved (just to get us going in a subject) or they can be used in definitions.
Axioms are often grouped into packages: for example, the axioms of Euclidean Geometry, Riemannian Geometry, Hyperbolic Geometry, etc.
Definition, theorem, intuition, proof in practice [019B]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
We start with an example to illustrate the process of working through definitions and theorems and proofs:
Definition Odd and even integers [019D]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
An integer is said to be odd whenever it is of the form 2\cdot i + 1 for some (necessarily unique) integer i. It is even when it is not odd, or (equivalently) when it is of the form 2\cdot i for some (necessarily unique) integer i.
Proposition Closure of oddness under multiplication [019C]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
For all integers m and n, if m and n are odd, then so is m\cdot n.
Intuition.
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Before attempting a proof, we might first try and get some intuition for why it might be true (or, indeed, false: we don’t always know in advance if what we want to prove is really true). Do this on a separate piece of working paper.
Everybody’s intuitions are different, so it is hopeless to convey “the” intuition. But one possible intuition for this proposition is geometrical, where we visualise the multiplication of two numbers as the area of a square.
We let m and n be two odd numbers; this means that we have some i and j such that m=2\cdot i + 1 and n = 2\cdot j + 1. We can therefore draw a grid where m is the height and n is the width; then we compute the area of the entire grid by computing the areas of the cells in the grids and adding them up.
| j | j | 1 | |
| 1 | j | j | 1 |
| i | i\cdot j | i\cdot j | i |
| i | i\cdot j | i\cdot j | i |
We therefore have m\cdot n = 4\cdot i\cdot j + 2 \cdot i + 2\cdot j + 1, which is odd because the part before +1 divides by 2.
Now that we have got some intuition, we can go ahead with a proper proof. Proofs are written in a kind of specialised language that has developed over time to be easily and unambiguously interpreted by mathematicians: some turns of phrase may feel formulaic at times (cf. Homer’s ῥοδοδάκτυλος Ἠώς). It is part of the tradition and makes us feel at home. Here we go:
Proof.
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Let m and n be two odd integers, so that we have m = 2\cdot i + 1 and n = 2\cdot j + 1 for some integers i and j. Hence we have:
\begin {aligned} m\cdot n &= (2\cdot i + 1) \cdot (2\cdot j + 1) \\ &= 4\cdot i \cdot j + 2\cdot i + 2\cdot j + 1 \\ &= 2\cdot (2\cdot i \cdot j + i + j) + 1 \end {aligned}Hence, if we define k \coloneqq 2\cdot i \cdot j + i + j, we have m\cdot n = 2\cdot k + 1. Therefore, m\cdot n is odd.
Remark on scratch-work: If you had included only the equational calculation of m\cdot n, that would not have been a proof. That is what we in the business call scratch work. Proofs are written in words; your scratch work is useful as you work your way to a solution, but it is meaningless on the page unless incorporated within the (prose!) structure of a real mathematical proof; we will not accept it! A real proof explains what the calculations are for, where variables come from and how they are used. Professional mathematicians usually omit their calculations entirely, and just give the reasoning. (But we want you to give more detail than that for now.)
Writing good proofs [019E]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Some advice from Section 1.9 of Mathematics for Computer Science by Lehman, Leighton, and Meyer:
- State your game plan.
- Keep a linear flow.
- A proof is an essay, not a calculation.
- Avoid excessive symbolism.
- Revise and simplify.
- Introduce notation thoughtfully.
- Structure long proofs.
- Be wary of the “obvious”.
- Finish.
Scaffold your proofs!
- September 21, 2026
- Marcelo Fiore, Jon Sterling
At all points in a proof, it should be easy for the reader to keep track of what the present assumptions are (statements that may be used for deduction) and what the present goals are (statements that remain to be proved). In a non-trivial proof, you ought to be writing things like “It remains to show that…” and “Because we have assumed (…), to establish (…) it suffices to check (…).” This kind of language is called scaffolding: use it liberally. If I can’t follow your proof, it is not a proof!
Dr Sterling’s advice
- September 21, 2026
- Marcelo Fiore, Jon Sterling
You may have got to Cambridge on the wings of magnificent Olympiad-style tours de force of proof by intimidation. That skill will take you no further, I will personally guarantee it. Proof is empathetic communication between two mathematicians in good faith.
What proofs are for in computer science [019F]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Mathematical proofs play a growing role in computer science (e.g. they are used to certify that software and hardware will always behave correctly under well-defined tolerances, something that no amount of testing can do.)
For a computer scientist, some of the most important things to prove are the correctness of programs and systems—whether (or under what conditions) a program or system does what it‘s supposed to do. Developing mathematical methods to verify programs and systems remains an active research area; the hard part is often finding a precise enough way to specify the intended behaviour. (Related: definitions in mathematics are more important than theorems.)
Understanding complex statements [019H]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Statements can be simple (like “2 is a prime number”); more complex statements are built up by combining simpler ones via logical connective like “if…then…” or “…implies…” or “…if and only iff…”, or even “…and…” and “…or…” and “it is not the case that…” and “for all…” and “there exists…”.
To understand a connective, like one of the above, we have to know what it means to undertake to prove it, and (dually) what it means to make good use of it when it lies in an assumption. In this lecture, we will focus on implication.
Understanding implication [019G]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Theorems can usually be written in the following form:
If [some assumptions] hold, then [some conclusion] follows.
If-then statements are phrased in a variety of ways. For example, the following means the same thing as the above:
[some assumptions] imply [some conclusion].
When writing a logical expression symbolically (which we will do only extremely rarely), implication may be written the word “implies” may be written as a double arrow “\implies ”.
Our goal now is to understand the concept of implication, which means that we need to understand two things:
- How to make progress on a goal that is an implication.
- How to make goo duse of an assumption that is an implication.
How to prove implication goals: assume the antecedent [019I]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Here is how you prove a statement like “P implies Q”:
- At this point your goal is P\implies Q and you have no assumptions.
- Now assume P, and try to prove Q under this assumption. At this point, your assumptions now include P and your goal is Q.
When you do these steps, you should say what you are doing in your proof. Say “Assume P holds; to prove Q, we [blah blah blah]…” or something like that.
Warning Assuming is not asserting!
- September 21, 2026
- Marcelo Fiore, Jon Sterling
It is totally possible to assume something that is untrue in the course of a correct proof. When you assume P, you are not saying “I believe that P is true”; you are rather testing the logical consequences of P by adding it to your assumptions.
Let’s look at another example.
Proposition Square root reflects rationality [019J]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
To make sense of Proposition [019J], we must have seen a definition like the following already.
Definition Rational, positive, nonnegative, natural [019K]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
A real number is
- rational if it is of the form m/n for a pair of integers m and n; otherwise it is irrational;
- positive if it is greater than 0 and negative if it is smaller than 0;
- nonnegative if it is greater than or equal to 0, and nonpositive if it is smaller than or equal to 0;
- natural if it is a nonnegative integer.
Proof of Proposition [019J]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Assume that x is a positive real number and that \sqrt {x} is rational. The latter assumption means, by definition, that \sqrt {x}=m/n for some integers m and n. It follows that x = (m/n)^2 = m^2/n^2 and since m and n are integers and hence m^2 and n^2 are natural numbers, we conclude that x is a rational number as well.
How to use implication assumptions: prove the antecedent [019L]
- September 21, 2026
- Marcelo Fiore, Jon Sterling
Logical deduction by modus ponens [019S]
- September 22, 2026
- Marcelo Fiore, Jon Sterling
If you have assumed an implication P\implies Q, then to prove Q it suffices to prove P. In other words:
If P and P\implies Q hold, then Q holds.
Formal logicians call this rule of reasoning “modus ponens”. Rules of reasoning can be written symbolically using horizontal lines: the premises go on top, and the conclusions go below:
\frac {P \qquad P \implies Q}{Q}In professional mathematics, we do not usually write things out in such terms, but it can be useful to understand and play with formal styles of reasoning when getting started.
Theorem Transitivity of implication [019T]
- September 22, 2026
- Marcelo Fiore, Jon Sterling
Let P_1, P_2, and P_3 be statements. If P_1\implies P_2 and P_2\implies P_3, then P_1\implies P_3.
Scratch work.
- September 22, 2026
- Marcelo Fiore, Jon Sterling
Before we write out a real proof, we will do some scratch work.
| Step | Assumptions | Goal |
|---|---|---|
| Starting point. | P_1, P_2, P_3 are statements. | If P_1\implies P_2 and P_2\implies P_3, then P_1\implies P_3 |
| We decompose the goal by assuming the antecedents. | P_1, P_2, P_3 are statements such that P_1\implies P_2 and P_2\implies P_3. | P_1\implies P_3 |
| We decompose goal the again by assuming the antecedent. | P_1, P_2, P_3 are statements such that P_1\implies P_2 and P_2\implies P_3 and P_1 holds. | P_3 |
| There is nothing more we can do to the goal. We now use modus ponens on our assumption P_2\implies P_3, and must prove the antecedent P_2. | P_1, P_2, P_3 are statements such that P_1\implies P_2 and P_2\implies P_3 and P_1 holds. | P_2 |
| There is nothing we can do to the goal. We now use modus ponens on our assumption P_1\implies P_2, and must prove the antecedent P_1. | P_1, P_2, P_3 are statements such that P_1\implies P_2 and P_2\implies P_3 and P_1 holds. | P_1 |
| Our goal P_1 is one of our assumptions, so we are done. | P_1, P_2, P_3 are statements such that P_1\implies P_2 and P_2\implies P_3 and P_1 holds. | (done!) |
The scratch work above was very useful for figuring out how the reasoning goes. It is not a proof, however. We will now turn it into a proof.
Proof.
- September 22, 2026
- Marcelo Fiore, Jon Sterling
First try to write out a proper proof yourself. Only after trying it out, click on this text to reveal a possible proof.
Let P_1, P_2, and P_3 be three statements such that P_1\implies P_2 and P_2\implies P_3. To show that P_1\implies P_3 we assume P_1 and it remains to show that P_3 holds. By our assumption P_2\implies P_3 it suffices to show that P_2 holds; by our assumption P_1\implies P_2, it suffices to recall our assumption that P_1 holds.
Chains of implications [019U]
- September 22, 2026
- Marcelo Fiore, Jon Sterling
We have seen that implication is transitive; we can therefore deduce implications P\implies Q by means of a whole chain of more manageable implications between intermediate statements, which we may write like so:
\begin {aligned} P &\implies P_1\\ &\implies P_2\\ &\quad \vdots \\ &\implies P_n\\ &\implies Q\text {.} \end {aligned}What if my goal is not the conclusion of an implication? [019V]
- September 22, 2026
- Jon Sterling
Modus ponens applies in the specific case where you are trying to prove Q and you know that P\implies Q holds. In practice, you may actually have an assumption like P\implies Q but your goal is some other statement R.
in a case like this, you may know in advance that it will be useful to have Q in your pocket in the course of proving R. Here is how you do this:
- I know P\implies Q, and I want to prove R.
- To prove R, by modus ponens, it suffices to prove Q \implies R and Q.
- Now we have two goals.
- In one goal, we want to prove Q\implies R. We assume Q, and try to prove R from that. (The rest of this subproof goes here.)
- On the other goal, we need to prove Q. (The rest of this subproof goes here.)