TITLE: *Recursive* vs. *inductive* definition
QUESTION [30 upvotes]: I once had an argument with a professor of mine, if the following definition was a recursive or inductive definition:
Suppose you have sequence of real numbers. Define $a_0:=2$ and $a_{i+1}:=\frac{a_i a_{i-1}}{5}$. (Of course this is just an example and as such has only illustrative character - I could have as well taken as an example a definition of some family of sets)
I claimed that this definition was recursive since we have an $a_{i+1}$ and define it going "downwards" and use the word "inductive" only as an adjectiv for the word "proof", but my professor insisted that we distinguish between these types of definition and that this was an inductive definition, since we start with $a_0$ and work "upwards".
Now, is there even someone who can be right  ? Since to me it seems that mathematically every recursive definition is also inductive (whatever these two expressions may finally mean), since the mathematical methods used to define them (namely equations) are the same. (Wikipedia also seems to think they are the same - but I trust a sound mathematical community, i.e. you guys, more than Wikipedia)
And if there is a difference, who is right and what is, if the above is a recursive definition, an inductive definition (and vice-versa) ?
(Please, don't ask me to ask my professor again - or anything similar, since I often get this answer here, after mentioning that this question resulted from a discussion with some faculty member - since out discussion ended with him saying that "it definitely is inductive, but I just can't explain it")

REPLY [2 votes]: Bear in mind that in computer programming these terms have a strict meaning relating to whether programs terminate.
It is possible to inductively define the sum of a list:
 sum([]) = 0
 sum([H|T]) = H + sum(T)

Here the list constantly decreases in length so we know it will terminate. However, for an infinite list such as:
 helper(N) = [N | helper(N + 1)]
 nats = helper(0)
 nats = [0, 1, 2, 3, 4, 5...

such an inductive definition will not terminate.
You might define a list as:
 List(a) = unit ∨ (a ∧ List(a))

Read as a base case of a unit type that has one inhabitant or a pair of the type a and the rest of the list.
One way of dealing with this is to distinguish between finite and possibly infinite data with the helper functions:
μ(f) = ∀a. (f(a) → a) → a
ν(f) = ∃a. a ∧ (a → f a)

These sort of encodings don't give you dependent recursion though but they're simpler than the full story of polynomial endofunctors.
And a finite list would be defined as List(a) = μ(λrest. unit ∨ (a ∧ rest)).
The finite list then becomes a program that lets you apply functions to it to reduce it to a smaller value.
The infinite list then becomes a program that starts with a seed and a function to go to the next step that can be used to generate an infinite stream of values.
So to your example is inherently an inductive definition because it doesn't work with an infinite datatype.
Consider the natural numbers defined as:
 nat = zero or succ(nat)

Then what of the following number?
 omega = succ(omega)

Your algorithm will loop forever.
Most of the time in math people use inductive definitions. But they are specifically different than other recursive algorithms in that they can only work on finite data.
Now you might ask what kind of "coinductive" algorithms can work on an infinite list anyway?
Well for example it is possible to increment each individual member of a list. Remember that the coinductive definition defines the infinite list as a pair so:
 inc((seed, succ)) = ((n, succ, seed), helper)
 helper((n, succ, seed)) = (n + 1, ((succ(seed), succ, seed), helper))

That said, I wouldn't say that these are the definitions of the terms inductive and coinductive in every case. This is just jargon specific to algorithms.
See also https://en.wikipedia.org/wiki/Coinduction