In our initial class we discussed a couple of recursive definitions, first of the predicate “is a natural number”, and then of the functions “factorial,” “even/odd,” and “nbits.” To remind you of our definitions of the last three:
All of these definitions assume that the function’s arguments and
k
can be any natural number.
factorial =def { if the argument is
0
, then1
; if the argument isk+1
, then(k+1)⋅factorial(k)
}
even =def { if the argument is
0
, thentrue
; if the argument isk+1
, thenodd(k)
}
odd =def { if the argument is0
, thenfalse
; if the argument isk+1
, theneven(k)
}
nbits =def { if the argument is
0
, then0
; if the argument is 2k, thenk+1
; otherwisenbits(k)
}
In the last case, it’s important than the second rule/clause has precedence over or higher priority than the last clause. The last clause is only used when the argument is not 2k for any natural number k
.
We said that if an argument ever matched multiple clauses (of the same priority) that gave different results, then the definition would be “broken” or “illegal.” Similarly, if the function being defined is allowed to receive some argument that no clause matches, then again the definition will be “broken” or “illegal.” Later in the semester we’ll discuss some interesting issues and complexities about this. But for now, those are the rules.
We talked in class about why it’s okay for these definitions to apparently be circular, because the circularity is used in such a way that we can rely on the definition always “bottoming out” in the base case(s).
I mentioned also that we’ll see later in the term a way to transform these definitions into a different (although more complex) style where there isn’t any even apparent circularity.
On Wednesday, we began with the idea of mathematically inductive arguments. Our example was to prove that the factorial of a natural number is never 0
. I expect this thesis won’t be very surprising. But how should we go about proving it?
Here is what we did:
n ≥ 0
, factorial(n) > 0
.n
is 0
, thusly: From the definition of factorial (above), factorial(0) = 1
, which is > 0
.n
is k
(which is a number ≥ 0
). Allowing ourselves that assumption, we establish the thesis for the case where n
is k+1
, thusly: From the definition of factorial, factorial(k+1) = (k+1)⋅factorial(k)
. Since k
is a natural number, k+1
has to be > 0
. From our assumption about the case where n
is k
, factorial(k)
is also > 0
. We help ourselves to the arithmetical fact that when two numbers, both > 0
, are multiplied, the result is also > 0
.In some contexts you might have to prove that last arithmetical fact, rather than being allowed to help yourself to it. But here we’ll take it for granted.
This illustrates the basic structure of a (mathematically) inductive proof or argument. (Philosophers also sometimes talk about a different kind of induction, enumerative induction, where you generalize from observed samples to not-yet-observed cases, or to the whole population. That’s a different beast. It’s just got a similar-looking name.)
In this example, the induction step made the assumption that the claim has been established for the single case where n
is k
. Sometimes you’ll instead have to assume that the claim has been established for a range of cases, for example up to and including the case where n
is k
. The rest of the proof would look the same.
Inductive arguments aren’t always about numbers, and the pool of “established” cases don’t always differ by being about the next bigger number. You’ll also see inductive arguments, for example in a coming homework, about the length of strings. There we start by establishing our thesis about a “short” string, and the induction step expands the pool of established cases to longer and longer strings.
In other cases, you might start with “atomic formulas”: sentences that don’t have any logical connectives like not
or and
in them. And then you’ll expand the pool of established cases to formulas that are built up out of less complex formulas using each connective.