Recursion and Induction: Definitions and Applications in Mathematics and Languages, Study notes of Introduction to Philosophy

The concepts of mathematical induction and definition by recursion through the example of the inductive definition of 'descendent'. It also discusses the relationship between these patterns of reasoning and recursive definitions, focusing on the natural numbers and structured languages. Examples of recursive definitions and inductions in arithmetic and language contexts.

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-n5e
koofers-user-n5e 🇺🇸

10 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Induction and Recursion
Notes for Phil. 303
JT Fall 2007
Contents
1 Recursion: Some basic facts 2
1.1 Inductive definition of “descendent” . . ................. 2
1.2 Recursiononnumbers:Asimpleexample................ 5
1.3 Induction on numbers: Deal two cards ................. 6
1.4 Ordinary Induction and Complete Induction .............. 7
1.5 Recursion and induction on languages with structure . . . ...... 8
1.6 Closureclause............................... 9
2 Induction on Numbers and Strings: More Cases 10
2.1 Palindromes ............................... 10
2.2 Fibonaccinumbers: ........................... 11
2.3 Choosingteams:.............................. 12
2.4 Somethingtotryyourself: ........................ 14
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Recursion and Induction: Definitions and Applications in Mathematics and Languages and more Study notes Introduction to Philosophy in PDF only on Docsity!

Induction and Recursion

  • Notes for Phil.
  • JT Fall
  • 1 Recursion: Some basic facts Contents
    • 1.1 Inductive definition of “descendent”
    • 1.2 Recursion on numbers: A simple example
    • 1.3 Induction on numbers: Deal two cards
    • 1.4 Ordinary Induction and Complete Induction
    • 1.5 Recursion and induction on languages with structure
    • 1.6 Closure clause
  • 2 Induction on Numbers and Strings: More Cases
    • 2.1 Palindromes
    • 2.2 Fibonacci numbers:
    • 2.3 Choosing teams:
    • 2.4 Something to try yourself:

1 Recursion: Some basic facts

A simple pattern of reasoning that shows up from time to time in everyday life, and is indispensible to computer programming and analysis of numbers is mathematical induction. There is a related pattern of definition - also very important - called defi- nition by induction (or: definition by recursion). Typically the uses of this reasoning are relatively abstract, but the core pattern is simple and occurs in concrete cases as well as abstract ones. As we often find in this course, the pattern we are trying to learn is just a common - sense pattern of thinking, rendered in a more rigorous and explicit way.

The basic idea of induction is this. Say you have a fixed starting point and an operation you can apply over and over again. Let’s say that when you apply the oper- ation to a given argument, you get something new. Then you can apply this operation to that “something new” and get a further new thing. And you can keep going, ap- plying the operation again and again, and getting new things again and again. (Of course, with some operations you just keep getting the same thing back over and over again.) This gives a way to define a collection: start at the starting point and take what you get by applying the operation over and over again as often as possible. So for example, the set of non-negative integers { 0 , 1 , 2 , ...} can be characterized by the instruction: start with { 0 }, and put into the set everything you get by adding one!

Typically when induction is used, it is applied to infinite sets of abstract things. But the basic reasoning can apply also to finite sets of concrete things. It will be good to consider one mundane example to dispel any air of mystery: the definition of “descendent”.

1.1 Inductive definition of “descendent”

A familiar example of an inductive definition (though in everyday conversation it isn’t crafted in the canonical form) is the definition of “descendent of x”. Recently there was a dispute about whether or not a particular currently living person was a descen- dent of Thomas Jefferson. But what does it mean to say someone is a descendent of Thomas Jefferson? How do we define that set? (It’ll be easier for our exposition if we tweak the definition of “descendent” a bit so that Thomas Jefferson is one of his own descendents.) Informally, we can say: “Thomas Jefferson is one of Jefferson’s descen- dents, and all the children of Jefferson are among Jefferson’s descendents, and all the children of each of the children of Jefferson are among Jefferson’s descendents, and so on...” Or we might put it a little differently: “You know. You take Jefferson, and his

clause that is supposed to define it. If I find a peacock and ask myself if it is a poefool, I can’t use this definition to answer, because I would have to already know that it is a poefool to apply the definition. At first glance, the definition of descendent might seem to have this defect, because the term being defined occurs in the definition itself. In fact, this isn’t a problem, but you need to understand the structure of recursive definitions to see why not: note that each time you apply the definition, you get a bit closer to the baseline stipulation that Jefferson is a descendent of Jefferson, and that baseline stipulation doesn’t presuppose any prior grasp of the definition of “de- scendent of Jefferson”.

Recursive definitions support the special kind of reasoning we’ve mentioned, called “Inductive Reasoning”. The “Jefferson’s descendents” example gives a deceptively simple example of this. One test we would regard as conclusive for demonstrating that someone is a Jefferson descendent is a DNA test. We check a sample of Jeffer- son’s DNA and a sample of the prospective descendent’s DNA, and see if it matches in the relevant ways. Now why should this tell us anything? Answer: because certain properties of DNA are passed on from parents to children. The reasoning involved is absolutely familiar, but logically it is a bit intricate, so I’ll spell it out more ruthlessly than we usually do. I will label the parts of this bit of reasoning so that we can refer to them easily:

Basis: Jefferson has DNA property α. Induction Step: If a person has DNA property α then their children have DNA property α. Therefore: Every descendent of Jefferson has DNA property α.^1

In most of the inductive arguments we’ll study, we actually prove the two premises using mathematics or logic. In this case the two premises are established by empir- ical scientific investigation of microbiology. But the structure of the reasoning from the premises isn’t affected by the way that the premises are justified. There are two observations worth making. First: The inference from the basis and induction step to the conclusion is one we find obvious and untroubling. Second: The inference is logically rather intricate. The premises have to do with the basis and the links of a chain, the conclusion concerns every member of the chain.

(^1) Of course, it matters both that Jefferson’s descendents have a certain property and that people

who aren’t Jefferson descendents don’t have the property. This inductive argument is only relevant to the first of these. But that doesn’t matter to the example.

Among the most prominent topics that invite inductive arguments and support recursive definitions are the natural numbers { 0 , 1 , 2 ,... n,.. .} and languages that are generated by iterating rules. We will be principally concerned with the structured languages, but inductive arguments in arithmetic are simpler, so I’ll look at an couple of illustrations from arithmetic as well as from structured languages.

1.2 Recursion on numbers: A simple example

A simple example of a recursive definition is the definition of multiplication by some number (say: 17) in terms of adding 17:

Basis clause: 17 · 0 = 0 Recursion clause: 17 · (n + 1) = (17 · n) + 17

(More generally, we can define “x · n” recursively by replacing “17” with “x”.) Say that we are asked to calculate 17 · 23. This definition fixes a value for 17 · 23, though to get it we need to unpack the definition by applying the recursion clause repeatedly until we hit the bedrock of the basis:

22 times = (17 · 0) + 17 + 17 + 17︸ ︷︷... + 17︸ 23 times = (0 + 17 + 17 + 17︸ ︷︷... + 17︸ 23 times At each step, until the last one, you get the value of a product of 17 with some number in terms of the product of 17 with a smaller number. At the bottom of the chain, you finally get an expression that is i) unpacked in terms of the basis clause alone, and ii) several “+ 17”’s and doesn’t contain any reference to the “· · · 17” func- tion we are trying to define.

The deck consisting of {C 1 , C 2 ,... , C˜k− 1 , C˜k} has k˜ cards and so by the induction

hypothesis, there are exactly ˜k(˜k−1) 2 ways of dealing a pair of cards from the reduced deck. In the full deck {C 1 , C 2 ,... , C˜k− 1 , C˜k} ∪ {C∗} you can deal all the pairs from the smaller deck, plus all the pairs consisting of one element from the smaller deck and C∗. Since there are exactly ˜k elements in the smaller deck, there are exactly ˜k different pairs consisting of one element of the smaller deck and C∗. So the full deck

contains

˜k(˜k−1) 2 + k˜ possible two-card hands.

Now we just do some simple algebra to get this expression into the form we want:

˜k(˜k−1) 2 + ˜k = k˜^2 −˜k 2 +^

2 טk 2 =^

˜k^2 −˜k+(2×k˜) 2 =^

˜k^2 +˜k 2 =^

˜k(k˜+1) 2

This is just what we want, so the induction step, and hence the thesis, is proven.

1.4 Ordinary Induction and Complete Induction

Proofs by mathematical induction fit into two slightly different schemes, depending on how much you assume about the numbers less than n + 1. These argument pat- terns aren’t importantly different, but to avoid confusion it is worthwhile to note the surface difference in form. We have just seen arguments where we prove some property is true of 0 (or whatever is the first in the series - sometimes it is 1), and then we prove that if we assume that property is true of an arbitrary n, it will also be true of n + 1. These two supports allow us to conclude that the property holds of every number. A variation is sometimes called the method of complete induction, though this usage doesn’t appear to be completely standard. In complete induction, we prove the base clause as before, and then we assume that the property holds of every number less than n + 1. The difference is that instead of assuming the thesis just for the number preceding the given one, we assume it for every number less than the given one. Neither of these methods is any less correct than the other: it just happens that one form is convenient for some problems, and the other form is conve- nient for others. When dealing with strings of symbols in a language, the method of complete induction tends to be a little more useful.

1.5 Recursion and induction on languages with structure

If you speak English (or any other natural language) fluently, you are able to produce long and complicated sentences like:

Incredibly, my neighbor was as irritated as a nest of disturbed bees when I asked reluctantly but insistently for the prompt return of the hedge trimmer I needed to tidy up the back yard before my son’s already delayed birthday party.

We can understand sentences like this. Of course, when they are unusually long it may take some concentration to figure out what they say, but we can usually puz- zle them out in no more than a few seconds. It’s reasonable to conjecture that this ability is grounded in the fact that complex sentences are generated from simpler components by the application (possibly the repeated application) of rules. Here’s an example.

Say we have a sentence “The dog bit the cat” of the form “(noun1)(verb)(noun2)”. We can form a noun phrase “The cat the dog bit” of the form “The (noun2) the (noun1) (verb)”. Also, as our sentence “The dog bit the cat.” exemplifies, given two nouns (noun1) and (noun2) and a verb that takes two arguments, we can form a sen- tence (noun1)(verb)(noun2). Similarly, we can form “The cat chased the rat” from “The cat”, “chased” and “the rat”, and then from “The cat chased the rat” we can form the noun phrase “The rat the cat chased”. Notice that we can iterate these operations over and over: I can form “The dog bit the cat”, then form “The cat the dog bit”, then taking this as (noun1) I can form “The cat the dog bit chased the rat.” And we don’t have to stop there. Further iterations give us some real prizes:

The cheese the rat the cat the dog bit chased ate had spoiled in the fridge.

The fridge the cheese the rat the cat the dog bit chased ate had spoiled in sat next to the stove. .. .

A digression: For entertainment purposes note that some fish, like angler fish, feed themselves by fishing for other fish. We can put this fact this way: Fish fish fish. And of course, following roughly the above pattern, we can note that there are some fish that are the targets of the fish who fish for fish. These are the fish fish fish. So understood, the sentence “Fish fish fish” and the noun phrase “Fish fish fish” support further iterations using the above rules, to get (meaningful) sentences like:

2 Induction on Numbers and Strings: More Cases

2.1 Palindromes

According to the most common definition, a palindrome is a string of letters that reads the same way backwards and forwards (ignoring spaces and punctuation). One simple example is “race car”. More elaborate examples tend to sound a bit stilted, but they can be found. Some instances are: “Madam, I’m Adam”, “A Man, A Plan, A Canal: Panama” and (thought of as spoken by Napoleon before his downfall and exile on the island of Elba): “Able was I, ere I saw Elba.” For more, you can search on youtube for a truly odd video by the parodist Weird Al Yankovic making fun of a truly odd Bob Dylan video from the 1960’s (Subterranean Homesick Blues). 2 The lyrics of Yankovic’s song are a series of palindromes. (“Nurse, I spy gypsies: run!; “Do geese see God?” “Go hang a salami, I’m a lasagna hog.”... )

There are some trivial cases too: “I” is an English language palindrome, and so is “a”. For bookkeeping purposes, let’s count the empty string as an English language expression: then it is a palindrome as well.

We can study the simpler case of palindromes in a regular language: let’s say we are considering the set of all strings in the alphabet {a, b, c}. As far as the structure of palindromes is concerned, one particular property is especially interesting: if you remove the first and last letter of a palindrome, you get another palindrome, two letters shorter. This fact gives us a way to inductively define “palindrome”:

Call a string over {a, b, c} an inductive palindrome if it satisfies the conditions:

Base clause: , ‘a’, ‘b’, and ‘c’ are inductive palindromes. Recursion clause: If σ is an inductive palindrome, then a ∗ σ ∗ a, b ∗ σ ∗ b, c ∗ σ ∗ c are inductive palindromes. [Closure: Nothing else is an inductive palindrome in {a, b, c}].

What we want to do now is prove that every palindrome is an inductive palindrome. The proof exploits the recursive structure of “inductive palindrome” to give an in- ductive proof.

(^2) For Yankovic’s video, a youtube search on “Yankovic palindrome” will most likely turn it up.

For full effect, you might want to watch part of the original Dylan video: A search on “Dylan Subterranean” should do.

Proof: The induction will be on the length of the string σ. Base case: Say that σ is 0 symbols long. Then it is , which is both a palindrome and an inductive palindrome. Inductive step: Assume (Induction hypothesis) that every palindrome of length less than k symbols is an inductive palindrome. Say that σ is a palindrome with exactly k symbols. If σ has exactly one symbol, then it is one of ‘a’,‘b’, or ‘c’, which are inductive palin- dromes by definition. If σ has two or more symbols, then we can remove the first and last letter, leaving a string σ′. Since σ reads the same backwards and forwards, and σ′^ comes from σ by removing the first and last letter, σ′^ reads the same backwards as forwards. That is, σ′^ is a palindrome. Since σ′^ is a palindrome, and it has fewer than k letters, then it is an inductive palindrome by the induction hypothesis. Since σ is a palindrome, the first and last letter must be the same, so it is either ‘a’, ‘b’, or ‘c’. So σ = a ∗ σ′^ ∗ a, or σ = b ∗ σ′^ ∗ b, or σ = c ∗ σ′^ ∗ c, where as we have shown σ′^ is an inductive palindrome. So, by the inductive clause of the definition of inductive palindrome, σ is an inductive palindrome.

2.2 Fibonacci numbers:

A sequence of numbers that shows up in a surprizing number of places in nature is the Fibonacci sequence:

Each number in the sequence is the sum of its two predecessors. The inductive def- inition of this one is a bit different from the ones we are used to, since we need to consider both f (k) and f (k − 1) to define f (k + 1), and we need to define two starting points. But these are minor adjustments. Here’s the definition:

f (0) = 1 f (1) = 1 f (n + 1) = f (n − 1) + f (n) for n > 1

As usual, the inductive structure makes it possible to prove things. Here’s a question: is the Fibonacci function f we’ve just defined dominated by the exponential function

be unclear what you should do the induction on. Here we have the choice between induction on the number of players or the number of teams. In this situation you should fiddle around a bit to figure out what works, and do the induction on the number of players.

Base case: Say that n, the number of players, = 4. This is one of the rare cases where the base case is more involved than the induction step. Take the teams with our friends on them, plus as many extra teams we need to get a total of four. Ignore the other teams. We’ll write (n 1 , n 2 , n 3 , n 4 ) (n 1 , n 2 , n 3 andn 4 all numbers) to represent the number of friends on each team. So, for example (2, 1, 0, 1) means that 2 friends are on team 1, one of the friends is on team 2, one of the friends is on team 4, and none of the friends is on team 3. Here are the possible starting configurations; the last of them represents the target situation where all the friends are on the same team:

Configurations: a) (1,1,1,1) b) (1,2,1,0) c) (2,2,0,0) d) (3,1,0,0) e) (4,0,0,0)

(Note that the order doesn’t matter, so we can count both (say) (1,2,1,0) and (1,1,0,2) as configuration b))

The hardest case is a). Beginning there, we can move to e) in a way that passes through every other configuration. So this sequence of moves also shows how to cover the other configurations:

︸ ︷︷ ︸ conf iguration d

︸ ︷︷ ︸ conf iguration c

︸ ︷︷ ︸ conf iguration b

︸ ︷︷ ︸ conf iguration e

So however the four friends may start out distributed, you can shift them onto the same team while obeying the “move two from different teams onto a third team” rule.

Induction step: OK, so what should we do if we have more than four players? The induction step will show that if we have a procedure for k players, then we have a procedure for k+1.

Assume: (Induction Hypothesis) Any distribution of k players can be recon- figured by repeatedly using the “choose from two onto a third” rule so that all k players eventually end up on the same team. Say that we have k+1 players. Choose one of the players - call her Jill. The collection of all the players besides Jill is a collection of k players, and so by the induction hypothesis we can rearrange them onto the same team. Do that. If they are on the same team as Jill we are done. If not, then we have the following configuration (again, ignoring extra teams): (1,k,0,0).

Here is how to rearrange the players:

(1, k, 0 , 0) → (0, k − 1 , 2 , 0) → (0, k − 2 , 1 , 2) → (2, k − 3 , 0 , 2) → (1, k − 1 , 0 , 1) → (0, k + 1, 0 , 0)

This completes the induction step, so we are done.

2.4 Something to try yourself:

Here is the inductive definition of n! (read “n factorial”): 1! = 1 (n + 1)! = (n + 1) × n!

That is, n! = (n × (n − 1) ×... 3 × 2 × 1) ︸ ︷︷ ︸ n times

Exercise:

Prove by induction: For every n greater than 3, 2n^ < n! < nn.