Induction can be applied when we have to prove something over natural number.
No. There are many forms of induction. In some areas of TCS, like programming languages theory, it is common to define sets/predicates/relations recursively (inductively), and then derive an associated induction principle from its definition. In some type theories, like CiC (the calculus of inductive constructions) this is also done inside the language itself!
For example, let $X$ be the smallest set satisfying the following inference rules:
- a given constant $c$ belongs to $X$.
- if $x,y \in X$, then $f(x,y)\in X$.
- if $x \in X$, then $g(x)\in X$.
(The Knaster-Tarski theorem ensures there really is a smallest set satisfying $1,2,3$.)
Now, how to deduce an associated induction principle? Well, suppose $Y$ is another set satisfying $1,2,3$. Since $X$ is the smallest, we must have $X \subseteq Y$. That's the induction principle!
Let's rephrase the principle of induction over $X$. In order to prove that any $x \in X$ satisfies $x \in Y$, it suffices to prove the following:
- $c \in Y$.
- if $x,y \in Y$ (induction hypothesis), then $f(x,y)\in Y$.
- if $x \in Y$ (induction hypothesis), then $g(x)\in Y$.
In other words, it suffices to prove that $x \in Y$ is a property "preserved by every rule".
As another example, if we define $\mathbb{N}$ as the smallest set such that
- $0 \in \mathbb{N}$.
- if $n \in \mathbb{N}$ then $n+1 \in \mathbb{N}$.
we get the usual induction principle on natural numbers.
On syntactic terms, we proceed similarly. The set of terms is the smallest set $T$ such that
- constants/variables belong to $T$
- if $t_1,\ldots \in T$ then the expression $f(t_1,\ldots)\in T$
- etc.
(actual rules depend on the language you are defining)
Hence, to prove $p(t)$ holds for every term $t\in T$, by induction on $t$, all we have to do is to prove that $p$ holds for every constant/variable, that whenever $p(t_1),p(t_2),\ldots$ hold (induction hypothesis) we also have $p(f(t_1,t_2,\ldots))$, etc.
Inducing on the syntax of a term in this way is sometimes called structural induction.