Last lecture we looked in some detail at a proof stating that if a program is finitely branching then termination can always be shown by a measure function to the natural numbers.
I want to use the opportunity to show you the patterns that arise when establishing an argument and then formalise them as rules of logic.
To help you understand better how proofs work, to learn how to navigate a proof without getting lost.
To understand that proofs are structured in the same way as programs, by nesting blocks:
To train ourselves in the "double-think" between formalism (just following the rules) and meaning (being guided by what we want to achieve and understand). This double-think is as valuable a skill in programming as it is in maths.
To learn the rules of logic.
To explain the idea that all of formal, deductive reasoning can be reduced to this small set of rules.
Going back to our lecture on induction, we then understand that this small set of rules is an inductive definition of the set of all provable statements in (as far as we know) all of mathematics.[1]
In the following I will provide a "director's commentary" on the proof from the previous lecture.
Show: If
is finitely branching and terminating, then there is a measure function .
The next step needs no understanding, it is purely formal: To prove an implication, you assume the assumptions and show the conclusion.
Assume that
is finitely branching and terminating.
Show that there is a measure function.
Here we need an idea as we have to show an existential statement ("there is"). You cannot come up with the definition wihtout understanding what is going on.
Define
.
Show that.
Implication again, purely formal reasoning.
Assume
.
Show.
This, in turn, means that we have to show the following two statements.
The next step consists of several smaller steps. The first one is still formal, but we need to know the definition of
(One)
This follows from
being transitive.
The last line above could be expanded with more detail.
(Two) There is
and . To show that such an
exists means to show that
there issuch that and not .
An existential statement again. Again we need an idea. Here we see a good example of double-think. One can guess that it is
Define
. We need to check two statements.
(First) Show:
.
This follows becauseis reflexive by definition.
(Second) Show: not
.
We argue by contradiction.
To show a negation, one reasons by contradiction.
Assume
.
Then.
Which contradicts thatis terminating.
We showed not
.
The rest is easy. As in programming, we should just check that all blocks close properly.
We showed (First) and (Second).
We showed (Two).
We showed
.
We showed
.
We showed that there is a measure function
.
We showed that if
is finitely branching and terminating, then there is a measure function .
Remark: It is interesting to speculate whether the more concise proof or the proof with more detail is easier to understand. The short proof leaves more details for the reader to fill in. The longer proof drowns the ideas in lots of "bureaucracy". Ultimately, I believe, the answer must be to master the double-think: To be able to switch between a high and a low level of abstraction effortless. This is similar to listening to polyphonic music: Our brains are not made for following several tunes at the same time. Maths and programming need a similar effort if one wants to appreciate their beauty.
The purely formal, idea-free content of the above proof can be condensed into a set of formal rules, the rules of logic.
Let us go over a few of them.
The following explains the rule called
where
For example, if
The rule of reasoning in this case is simple:
Or in symbolic notation:
Notice that there is an important side-condition, namely that we need to choose a name
The following explains the rule called
The rule is:
Or in symbolic notation:
Suppose the statement is
The rule in this case asks us to identify (define) a particular
Or in symbolic notation:
Exercise: Find examples of applications of these rules in the proof of the theorem of the previous lecture.
Exercise: Which of the other rules of Gentzen can you identify in the proof of the previous lecture?
Exercise: Think about the following: Is it possible to reduce all steps in this proof to an application of one of this rules? What about other proofs or even all proofs?
Exercise: Give a formal proof, using Gentzen rules, that every number divisible by 4 is divisible by 2. You may use the laws of arithmetic freely. [Hint:
All rules as given by Gentzen. The original paper and a link to an English translation.
The style of writing proofs with indentation is due to Fitch, a summary of the rules is here and there are also latex macros for writing Fitch style proofs.
An excellent (maybe the best ever (?)) popular science book on formal systems is Goedel Escher Bach.
The idea that mathematics can be reduced to logic (in the sense discussed here) is the central message of Russel and Whitehead's Principa Mathematica. But it was Gentzen who found this beautifully simple set of rules called Natural Deduction. ↩︎