Parametric Induction
In questa pagina 5
Unfolding (Divide and Conquer - Paradigm and Call TreeA divide-and-conquer algorithm comes from a substructure property (threshold n0, Divide and Conquer functions) with strictly smaller subinstances; the call tree describes the execution, and D&C has no memory (equal subinstances are recomputed). Complete example: MAX of an array, with correctness by induction, the recurrence, and the exact count n-1 via the theorem on full binary trees.Divide and Conquer - Paradigm and Call Tree →) gives a closed form for . For arbitrary , with floors and ceilings, the exact form may be very hard to find. One then states a guess on the growth and tries to prove it rigorously: parametric induction. The closed form for suggests the order of growth (not the constants); for a wide class there is also the Master TheoremThe Master Theorem for T(n) = aT(n/b) + w(n) compares w(n) with the threshold n^(log_b a). Case 1 (w polynomially smaller): Theta(n^(log_b a)); case 2 (same order): Theta(n^(log_b a) log n); case 3 (polynomially larger and regular): Theta(w(n)). Full proof from the levels of the tree, extended version with floors and ceilings, a table of applications, and the misuse when no case applies (w = n log n).Master Theorem →.
Method
Simulate an induction proof of a closed-form bound whose constants are parameters determined at the end, accumulating constraints that make every step valid. Typical guess: i.e. (or ); both together give . and are the same for all .
- Base [B]. Impose the guess on base values: each base gives a constraint.
- Hypothesis [HP]. Assume the guess for all arguments smaller than .
- Step [HP TH]. Apply the definition of , use [HP], simplify with equalities or always-valid bounds, and write the conditional inequality whose truth (for some ) yields the thesis. The symbol marks a condition on the parameters, not an always-true bound.
- Intersection. If the set of constraints is nonempty, any admissible pair turns the proof into a normal induction. For an upper bound take the smallest (best constant of the dominant term); for a lower bound the largest .
The method is not infallible. If the guess is false the constraint set is certainly empty, but it may be empty for a true guess too, when the tool is too weak. Failure does not disprove the guess. Afterwards confirm with a standard induction to catch calculation errors.
Example 1: upper bound for MAX
, . Guess: , .
- [B] : . Constraint: .
- [HP TH] For both arguments are and : since . We need .
Constraints: , , hence . The minimum is and then is forced:
Example 2: lower bound for MAX
Guess . [B] . [Step] , enough that , i.e. . For a lower bound take maximum: , so , . Hence and with Example 1, for all . This is a lucky case: usually the bounds do not coincide in the constants.
Example 3: when the simplest guess fails
Guess for MAX (true with ). [B] . [Step] , and is satisfied by no . The intersection is empty although the guess is true: with a single parameter the tool is too weak, the is not absorbed. Adding the lower-order term () fixes it. Practical rule: try a one-parameter guess first; add parameters only after a failure.
Example 4: a guess with
, . The Master Theorem suggests . The guess fails at the base: for it gives whatever . Add a linear term: .
- [B] : constraint .
- [Step] For , , and is non-decreasing for with , , :
Constraints , ; with minimum : , with equality for (unfolding gives ).
Versione ripasso
- Idea: simulate the induction proof of a guess with parametric constants (e.g. ) and collect constraints from the base (one per base ) and the step [HP TH] (the condition ). If the intersection is nonempty choose: for an upper bound the minimum , for a lower bound the maximum .
- MAX, upper: base ; step (uses ); choice : .
- MAX, lower: base ; step ; : . So for all (lucky case).
- Failure: guess gives (empty constraint) though true with : tool too weak, not guess false. Try one parameter first, then add.
- With : , . Guess fails at the base (); with : base , step i.e. (uses non-decreasing); .
- Final check with a standard induction to catch calculation errors.
- Rounding facts: , , .
- Order of growth first: closed form for (see Recurrence Relations - Recursion Tree and General FormulaThe recurrence tree has the shape of the call tree of the worst instance and T(n) is the sum of the works of its nodes. For the family T(n) = s(n) T(f(n)) + w(n) with base T0 for n <= n0, counting nodes per level with the iterates of f and the level f*(n,n0) gives the closed formula T(n) = sum over levels of [product of s] w + [product of s] T0, proved by induction and applied to merge sort, Hanoi and square-root recurrences.Recurrence Relations - Recursion Tree and General Formula →) or Master TheoremThe Master Theorem for T(n) = aT(n/b) + w(n) compares w(n) with the threshold n^(log_b a). Case 1 (w polynomially smaller): Theta(n^(log_b a)); case 2 (same order): Theta(n^(log_b a) log n); case 3 (polynomially larger and regular): Theta(w(n)). Full proof from the levels of the tree, extended version with floors and ceilings, a table of applications, and the misuse when no case applies (w = n log n).Master Theorem →; then parametric induction pins the constant.
- Common mistakes: constants depending on ; [HP] on arguments not smaller than or outside the base; forgetting the most restrictive base constraint; reading "empty constraint" as "guess false"; not minimizing .