Reading preferences
Optional display controls need JavaScript. All reading content and navigation work without it.
Source file content/methods/induction/induction.tex
Source file content/methods/induction/introduction.tex
Introduction
Induction is an important proof technique which is used, in different forms, in almost all areas of logic, theoretical computer science, and mathematics. It is needed to prove many of the results in logic.
Induction is often contrasted with deduction, and characterized as the inference from the particular to the general. For instance, if we observe many green emeralds, and nothing that we would call an emerald that's not green, we might conclude that all emeralds are green. This is an inductive inference, in that it proceeds from many particular cases (this emerald is green, that emerald is green, etc.) to a general claim (all emeralds are green). Mathematical induction is also an inference that concludes a general claim, but it is of a very different kind than this “simple induction.”
Very roughly, an inductive proof in mathematics concludes that all mathematical objects of a certain sort have a certain property. In the simplest case, the mathematical objects an inductive proof is concerned with are natural numbers. In that case an inductive proof is used to establish that all natural numbers have some property, and it does this by showing that
Induction on natural numbers can then also often be used to prove general claims about mathematical objects that can be assigned numbers. For instance, finite sets each have a finite number source of elements, and if we can use induction to show that every number source has the property “all finite sets of size source are dots” then we will have shown something about all finite sets.
Induction can also be generalized to mathematical objects that are inductively defined. For instance, expressions of a formal language such as those of first-order logic are defined inductively. Structural induction is a way to prove results about all such expressions. Structural induction, in particular, is very useful---and widely used---in logic.
Source file content/methods/induction/induction-on-N.tex
Induction on source
In its simplest form, induction is a technique used to prove results for all natural numbers. It uses the fact that by starting from source and repeatedly adding source we eventually reach every natural number. So to prove that something is true for every number, we can (1) establish that it is true for source and (2) show that whenever it is true for a number source, it is also true for the next number source. If we abbreviate “number source has property source” by source (and “number source has property source” by source, etc.), then a proof by induction that source for all source consists of:
To make this crystal clear, suppose we have both (1) and (2). Then (1) tells us that source is true. If we also have (2), we know in particular that if source then source, i.e., source. This follows from the general statement “for any source, if source then source” by putting source for source. So by modus ponens, we have that source. From (2) again, now taking source for source, we have: if source then source. Since we've just established source, by modus ponens, we have source. And so on. For any number source, after doing this source times, we eventually arrive at source. So (1) and (2) together establish source for any source.
Let's look at an example. Suppose we want to find out how many different sums we can throw with source dice. Although it might seem silly, let's start with source dice. If you have no dice there's only one possible sum you can “throw”: no dots at all, which sums to source. So the number of different possible throws is source. If you have only one die, i.e., source, there are six possible values, source through source. With two dice, we can throw any sum from source through source, that's source possibilities. With three dice, we can throw any number from source to source, i.e., source different possibilities. source, source, source, source: looks like a pattern: maybe the answer is source? Of course, source is the maximum possible, because there are only source numbers between source, the lowest value you can throw with source dice (all source's) and source, the highest you can throw (all source's).
The range of totals obtainable with n dice
With source dice one can throw all source possible values between source and source.
Proof
Let source be the claim: “It is possible to throw any number between source and source using source dice.” To use induction, we prove:
The induction basis source, i.e., with just one die, you can throw any number between source and source.
(1) Is proved by inspecting a source-sided die. It has all 6 sides, and every number between source and source shows up one on of the sides. So it is possible to throw any number between source and source using a single die.
To prove (2), we assume the antecedent of the conditional, i.e., source. This assumption is called the inductive hypothesis. We use it to prove source. The hard part is to find a way of thinking about the possible values of a throw of source dice in terms of the possible values of throws of source dice plus of throws of the extra source-st die---this is what we have to do, though, if we want to use the inductive hypothesis.
The inductive hypothesis says we can get any number between source and source using source dice. If we throw a source with our source-st die, this adds source to the total. So we can throw any value between source and source by throwing source dice and then rolling a source with the source-st die. What's left? The values source through source. We can get these by rolling source sources and then a number between source and source with our source-st die. Together, this means that with source dice we can throw any of the numbers between source and source, i.e., we've proved source using the assumption source, the inductive hypothesis.
Very often we use induction when we want to prove something about a series of objects (numbers, sets, etc.) that is itself defined “inductively,” i.e., by defining the source-st object in terms of the source-th. For instance, we can define the sum source of the natural numbers up to source by
This definition gives:
Now we can prove, by induction, that source.
Closed formula for the partial sums
Proof
We have to prove (1) that source and (2) if source then source. (1) is obvious. To prove (2), we assume the inductive hypothesis: source. Using it, we have to show that source.
What is source? By the definition, source. By inductive hypothesis, source. We can substitute this into the previous equation, and then just need a bit of arithmetic of fractions:
The important lesson here is that if you're proving something about some inductively defined sequence source, induction is the obvious way to go. And even if it isn't (as in the case of the possibilities of dice throws), you can use induction if you can somehow relate the case for source to the case for source.
Source file content/methods/induction/strong-induction.tex
Strong Induction
In the principle of induction discussed above, we prove source and also if source, then source. In the second part, we assume that source is true and use this assumption to prove source. Equivalently, of course, we could assume source and use it to prove source---the important part is that we be able to carry out the inference from any number to its successor; that we can prove the claim in question for any number under the assumption it holds for its predecessor.
There is a variant of the principle of induction in which we don't just assume that the claim holds for the predecessor source of source, but for all numbers smaller than source, and use this assumption to establish the claim for source. This also gives us the claim source for all source. For once we have established source, we have thereby established that source holds for all numbers less than source. And if we know that if source for all source, then source, we know this in particular for source. So we can conclude source. With this we have proved source and source, i.e., source for all source, and since we have also the conditional, if source for all source, then source, we can conclude source, and so on.
In fact, if we can establish the general conditional “for all source, if source for all source, then source,” we do not have to establish source anymore, since it follows from it. For remember that a general claim like “for all source, source” is true if there are no source. This is a case of vacuous quantification: “all sources are sources” is true if there are no sources, source is true if no source satisfies source. In this case, the formalized version would be “source”---and that is true if there are no source. And if source that's exactly the case: no source, hence “for all source, source” is true, whatever source is. A proof of “if source for all source, then source” thus automatically establishes source.
This variant is useful if establishing the claim for source can't be made to just rely on the claim for source but may require the assumption that it is true for one or more source.
Source file content/methods/induction/inductive-definitions.tex
Inductive Definitions
In logic we very often define kinds of objects inductively, i.e., by specifying rules for what counts as an object of the kind to be defined which explain how to get new objects of that kind from old objects of that kind. For instance, we often define special kinds of sequences of symbols, such as the terms and formulas of a language, by induction. For a simple example, consider strings consisting of letters source, source, source, source, the symbol source, and brackets source and source, such as “source”, “source”, “source” or “source”. You probably feel that there's something “wrong” with the first two strings: the brackets don't “balance” at all in the first, and you might feel that the “source” should “connect” expressions that themselves make sense. The third and fourth string look better: for every “source” there's a closing “source” (if there are any at all), and for any source we can find “nice” expressions on either side, surrounded by a pair of parentheses.
We would like to precisely specify what counts as a “nice term.” First of all, every letter by itself is nice. Anything that's not just a letter by itself should be of the form “source” where source and source are themselves nice. Conversely, if source and source are nice, then we can form a new nice term by putting a source between them and surround them by a pair of brackets. We might use these operations to define the set of nice terms. This is an inductive definition.
Inductive definition of nice terms
[Nice terms] The set of nice terms is inductively defined as follows:
This definition tells us that something counts as a nice term iff it can be constructed according to the two conditions (1) and (2) in some finite number of steps. In the first step, we construct all nice terms just consisting of letters by themselves, i.e.,
In the second step, we apply (2) to the terms we've constructed. We'll get
for all combinations of two letters. In the third step, we apply (2) again, to any two nice terms we've constructed so far. We get new nice term such as source---where source is source from step 1 and source is source from step 2---and source constructed out of the two terms source and source from step 2. And so on. Clause (3) rules out that anything not constructed in this way sneaks into the set of nice terms.
Note that we have not yet proved that every sequence of symbols that “feels” nice is nice according to this definition. However, it should be clear that everything we can construct does in fact “feel nice”: brackets are balanced, and source connects parts that are themselves nice.
The key feature of inductive definitions is that if you want to prove something about all nice terms, the definition tells you which cases you must consider. For instance, if you are told that source is a nice term, the inductive definition tells you what source can look like: source can be a letter, or it can be source for some pair of nice terms source and source. Because of clause (3), those are the only possibilities.
When proving claims about all of an inductively defined set, the strong form of induction becomes particularly important. For instance, suppose we want to prove that for every nice term of length source, the number of source in it is source. This can be seen as a claim about all source: for every source, the number of source in any nice term of length source is source.
Opening-bracket bound for nice terms
For any source, the number of source in a nice term of length source is source.
Proof
To prove this result by (strong) induction, we have to show that the following conditional claim is true:
If for every source, any nice term of length source has source source's, then any nice term of length source has source source's.
To show this conditional, assume that its antecedent is true, i.e., assume that for any source, nice terms of length source contain source source's. We call this assumption the inductive hypothesis. We want to show the same is true for nice terms of length source.
So suppose source is a nice term of length source. Because nice terms are inductively defined, we have two cases: (1) source is a letter by itself, or (2) source is source for some nice terms source and source.
source is a letter. Then source, and the number of source in source is source. Since source, the claim holds.
source is source for some nice terms source and source. Let's let source be the length of source and source be the length of source. Then the length source of source is source (the lengths of source and source plus three symbols source, source, source). Since source is always greater than source, source. Similarly, source. That means that the induction hypothesis applies to the terms source and source: the number source of source in source is source, and the number source of source in source is source.
The number of source in source is the number of source in source, plus the number of source in source, plus source, i.e., it is source. Since source and source we have:
In each case, we've shown that the number of source in source is source (on the basis of the inductive hypothesis). By strong induction, the proposition follows.
Exercise defining and bounding supernice terms
Define the set of supernice terms by
Any letter source, source, source, source is a supernice term.
If source and source are supernice terms, then so is source.
Nothing else is a supernice term.
Show that the number of source in a supernice term source of length source is source.
Source file content/methods/induction/structural-induction.tex
Structural Induction
So far we have used induction to establish results about all natural numbers. But a corresponding principle can be used directly to prove results about all elements of an inductively defined set. This often called structural induction, because it depends on the structure of the inductively defined objects.
Generally, an inductive definition is given by (a) a list of “initial” elements of the set and (b) a list of operations which produce new elements of the set from old ones. In the case of nice terms, for instance, the initial objects are the letters. We only have one operation: the operations are
You can even think of the natural numbers source themselves as being given by an inductive definition: the initial object is source, and the operation is the successor function source.
In order to prove something about all elements of an inductively defined set, i.e., that every element of the set has a property source, we must:
Prove that the initial objects have source
Prove that for each operation source, if the arguments have source, so does the result.
For instance, in order to prove something about all nice terms, we would prove that it is true about all letters, and that it is true about source provided it is true of source and source individually.
Balanced brackets in every nice term
The number of source equals the number of source in any nice term source.
Proof
We use structural induction. Nice terms are inductively defined, with letters as initial objects and the operation source for constructing new nice terms out of old ones.
The claim is true for every letter, since the number of source in a letter by itself is source and the number of source in it is also source.
Suppose the number of source in source equals the number of source, and the same is true for source. The number of source in source, i.e., in source, is the sum of the number of source in source and source plus one. The number of source in source is the sum of the number of source in source and source plus one. Thus, the number of source in source equals the number of source in source.
Exercise on the first symbol of a nice term
Prove by structural induction that no nice term starts with source.
Let's give another proof by structural induction: a proper initial segment of a string source of symbols is any string source that agrees with source symbol by symbol, read from the left, but source is longer. So, e.g., source is a proper initial segment of source, but neither are source (they disagree at the second symbol) nor source (they are the same length).
Proper initial segments contain more opening brackets
Every proper initial segment of a nice term source has more source's than source's.
Proof
By induction on source:
source is a letter by itself: Then source has no proper initial segments.
source for some nice terms source and source. If source is a proper initial segment of source, there are a number of possibilities:
source is just source: Then source has one more source than it does source.
source is source where source is a proper initial segment of source: Since source is a nice term, by induction hypothesis, source has more source than source and the same is true for source.
source is source or source: By the previous result, the number of source and source in source are equal; so the number of source in source or source is one more than the number of source.
source is source where source is a proper initial segment of source: By induction hypothesis, source contains more source than source. By the previous result, the number of source and of source in source are equal. So the number of source in source is greater than the number of source.
source is source: By the previous result, the number of source and source in source are equal, and the same for source. So there is one more source in source than there are source.
Source file content/methods/induction/relations.tex
Relations and Functions
When we have defined a set of objects (such as the natural numbers or the nice terms) inductively, we can also define relations on these objects by induction. For instance, consider the following idea: a nice term source is a subterm of a nice term source if it occurs as a part of it. Let's use a symbol for it: source. Every nice term is a subterm of itself, of course: source. We can give an inductive definition of this relation as follows:
Inductive definition of the subterm relation
The relation of a nice term source being a subterm of source, source, is defined by induction on source as follows:
This definition, for instance, will tell us that source. For (2) says that source iff source, or source, or source. The first two are false: source clearly isn't identical to source, and by (1), source iff source, which is also false. However, also by (1), source iff source, which is true.
It's important to note that the success of this definition depends on a fact that we haven't proved yet: every nice term source is either a letter by itself, or there are uniquely determined nice terms source and source such that source. “Uniquely determined” here means that if source it isn't also source with source or source. If this were the case, then clause (2) may come in conflict with itself: reading source as source we might get source, but if we read source as source we might get not source. Before we prove that this can't happen, let's look at an example where it can happen.
Inductive definition of bracketless terms
Define bracketless terms inductively by
Bracketless terms are, e.g., source, source, source. Now if we defined “subterm” for bracketless terms the way we did above, the second clause would read
Now source is of the form source with
Now is source a subterm of source? The answer is yes if we go by the first reading, and no if we go by the second.
The property that the way a nice term is built up from other nice terms is unique is called unique readability. Since inductive definitions of relations for such inductively defined objects are important, we have to prove that it holds.
Unique readability of nice terms
Suppose source is a nice term. Then either source is a letter by itself, or there are uniquely determined nice terms source, source such that source.
Proof
If source is a letter by itself, the condition is satisfied. So assume source isn't a letter by itself. We can tell from the inductive definition that then source must be of the form source for some nice terms source and source. It remains to show that these are uniquely determined, i.e., if source, then source and source.
So suppose source and also source for nice terms source, source, source, source. We have to show that source and source. First, source and source must be identical, for otherwise one is a proper initial segment of the other. But by the proposition on proper initial segments of nice terms, that is impossible if source and source are both nice terms. But if source, then clearly also source.
We can also define functions inductively: e.g., we can define the function source that maps any nice term to the maximum depth of nested source in it as follows:
Inductive definition of depth
The depth of a nice term, source, is defined inductively as follows:
For instance
Here, of course, we assume that source an source are nice terms, and make use of the fact that every nice term is either a letter or of the form source. It is again important that it can be of this form in only one way. To see why, consider again the bracketless terms we defined earlier. The corresponding “definition” would be:
Now consider the bracketless term source. It can be read in more than one way, e.g., as source with
Calculating source according to the first way of reading it would give
But a function must always yield a unique value; so our “definition” of source doesn't define a function at all.
Exercise defining the length of a nice term
Give an inductive definition of the function source, where source is the number of symbols in the nice term source.
Exercise comparing depth and length
Prove by structural induction on nice terms source that source (where source is the number of symbols in source and source is the depth of source as defined in the definition of the depth of a nice term).
Source disclosures
- TR075-SAR-001: Source wording note. The induction-step discussion says to take one for n, although the quantified variable in the immediately preceding statement is k. The wording and formulas remain exactly as printed. source
- TR075-SAR-003: Source wording note. The dice proof contains the words one on of where ordinary prose would say on one of. The source wording is retained. source
- TR075-SAR-002: Source wording note. The vacuity discussion prints capital P of zero inside the quoted universal claim, whereas its preceding formalization has capital P of l. The printed claim is preserved and not silently rewritten. source
- TR075-SAR-004: Source wording note. The depth discussion prints an between s sub one and s sub two where ordinary prose would say and. The source wording is retained. source