https://slides.com/georgelee/ics141-recursion/live
Inductive Definition: Define a function in terms of the previous results
Recursive Definition: Define a function in terms of itself. May also use results that have not been calculated yet.
We'll typically use recursive definitions.
The definition has two parts.
Base clause: Step that defines the first couple of elements of the set.
Inductive clause: Obtain new elements based on previous elements in the set.
You may have seen the Fibonacci numbers before.
Base clause: f(0) = 1, f(1) = 1
Inductive clause: f(n) = f(n - 1) + f(n - 2) if n > 1
Let Σ be a finite, nonempty set of symbols.
A string whose alphabet is Σ is a sequence of symbols chosen from Σ. Σ* denotes the set of all strings over Σ.
Let x = a1a2a3...an and y = b1b2b3...bn
The concatenation of the two strings x and y is:
xy = a1a2a3...anb1b2b3...bn
Base Clause: The empty string (denoted ε or λ) is in Σ*.
Inductive Clause: If x ∈ Σ* and b ∈ Σ, then xb is in Σ*.
How would we write a recursive definition for the length of a string?
Yet another variant on the theme. Prove that a recursive definition holds true.
Basis step: Prove that the result holds for all elements in the basis step of the definition.
Recursive step: Show that if the statement is true for each of the elements used to construct new elements, then the result holds for these new elements.