A recursive routine works on large inputs but fails on two-block inputs, yet its induction proof checked a one-block base case - where is the gap?
answer
- which sizes does the proof actually cover
- the step has preconditions too
- smallest k the argument tolerates
- the chain cannot skip a link
- everything above the gap falls
basics
~20 sAlmost certainly in the step's own preconditions: it needs more than one block before its argument applies, so it never links the one-block base to the next size up. Because every later case rests on the missing ones, nothing above the base is proved.
solid answer
~50 sAn induction proof establishes exactly the set of sizes its base cases cover plus the sizes its step can reach from them. Read the step as a reviewer: does its reasoning need two non-empty parts, or a node that really has two children, or "n large enough"? If so, the smallest sizes it can produce sit above the base, and the sizes in between were never established. The damage does not stay local. A step that derives size n from smaller sizes cannot fire at all when one of those smaller sizes is missing, so the gap propagates upward and the proof supports only the base. The repair is to discharge every size the step cannot produce as its own base case - and the routine's behaviour on those sizes is exactly where the defect lives.
go deeper
Recall that a proof covers a stated range, and that the smallest values in that range have to be checked by hand rather than assumed.
Explain that the step carries preconditions of its own, and work out which sizes the proof therefore establishes when the step first applies above the base.
Diagnose the collapse: show that a missing size near the bottom strands every larger case that depends on it, and connect that to a routine that only appears correct because small inputs are untested.
Insist that a correctness claim states its range and that the range matches the inputs the system can actually receive, since the sizes outside it are exactly the unreasoned ones.
The failure here is not a subtle logical error. It is an accounting error: the proof covers a smaller set of inputs than its author thought, and the uncovered sizes are precisely the small ones nobody exercises. ## The coverage set Every induction proof implicitly defines a set: the sizes it actually establishes. That set is - the sizes discharged directly as base cases, plus - the sizes the step can produce, given that everything it depends on is already in the set. So the review question is never "is the step valid?" but "**for which k is the step's own argument valid**, and what does it need in hand when it fires?" ## Where the hidden precondition hides Steps rarely announce their preconditions. Typical smuggled assumptions: - "Split the input into two non-empty parts" - impossible below two blocks. - "Each part is itself a combining node with two children" - needs at least two blocks per part, so at least four overall. - "Take the middle element" - assumes an odd count, or at least a non-empty remainder. - "For n large enough, the term dominates" - honest, and frequently never converted into a stated threshold. Each of these raises the smallest k at which the step is genuinely proved, and none of them raises the base case to match. ## Why the gap does not stay local Suppose the base is size 1 and the step's argument needs two parts of at least two blocks each, so it first applies at size 4 and it needs sizes 2 and 3 available. 1. Size 1: established, directly. 2. Sizes 2 and 3: the step cannot produce them - its argument does not apply - and no base case covers them. Unproved. 3. Size 4: the step applies, but it consumes the claim at sizes 2 and 3. Those are unproved, so nothing is derived. 4. Size 5 and beyond: each one depends on smaller sizes that include the unproved ones. The failure propagates. The naive reading - "only sizes 2 and 3 are missing" - understates it. **Everything above the gap collapses with it**, and the proof supports only the base case. That is the answer an interviewer is listening for, because it explains why the routine "works on large inputs": it was never proved to, it was only tested to. ## How to audit a proof for this in two minutes | Ask | Write down | |---|---| | What sizes are proved directly? | The base set | | What is the smallest k for which every sentence of the step is true? | The step's threshold | | What does the step consume when it fires? | Its dependencies | | Is every dependency in the covered set? | If not, the gap | Do this and off-by-one base cases stop being a matter of luck. In practice the fix is mechanical: add base cases for every size below the step's threshold, then check the routine really does behave correctly on those sizes - which is where a genuine bug usually surfaces, because the small cases are the ones written last and tested least. ## The two symmetric mistakes - **Base too low.** The one above: a base at size 1 under a step that begins at 4. - **Base too high.** The claim says "for all n >= 1" but only n = 3 is discharged and the step climbs upward, so sizes 1 and 2 are outside the proof while inside the claim. Either restate the claim as `n >= 3` or prove the small cases. Both are caught by the same discipline: write the range in the claim, write the range the step covers, and compare them explicitly instead of trusting that they line up. ## What this looks like on the ground A correctness argument that silently starts at four blocks, paired with test data that never goes below a hundred, is a defect waiting for the first empty or single-item input in production. The mathematics is not decoration here: the sizes the proof cannot reach are a precise list of the inputs nobody reasoned about.
- If a step is proved only for k >= 3 and the base only at n = 1, which sizes are established?Only n = 1. The step can never fire, because reaching size 4 requires the claim at size 3, which nothing supplies, and size 3 requires size 2. A single missing link near the bottom leaves the entire chain above it unsupported, not merely the missing sizes.
- What is the mechanical repair once the gap is found?Discharge every size below the step's threshold as its own base case, checking each directly against the routine. If one of them is false, you have found a real bug rather than a proof defect - which is the usual outcome, since the smallest inputs are the least exercised.
saying these in an interview costs you the question
- Assumes the base case is fine because it was checked somewhere
- Thinks a missing size leaves only that size unproved
- Never states the smallest k the step's argument tolerates
- Treats a step that splits input as valid at every size
- Proves a claim for n >= 3 and states it for all n
- Calls small inputs edge cases rather than part of the claim