skip to content

A reviewer rechecks your resolver's chosen version set in a second, yet the resolver ran for hours. Why is that gap expected?

level: middleimportance: should knowfreq 46%

answer

  1. one candidate versus all candidates
  2. cost per check, not the count
  3. exponentially many certificates to sift
  4. brute force still gives an upper bound
  5. the distance between them is open

basics

~20 s

A checker is handed one candidate; a solver must locate one among exponentially many. Fast checking bounds the cost per candidate, not the number of candidates that must be tried. Whether that gap can always be closed is the open P versus NP question.

solid answer

~40 s

Verification and search price different things. The reviewer receives a completed version set and only confirms each constraint holds — one pass over the constraints, linear in the size of the answer. The resolver had no answer to start from: with `n` packages and up to `k` versions each there are up to `k^n` combinations, and a fast per-candidate check does nothing to shrink that count. In the general shape, certificates of length `p(n)` give about `2^p(n)` candidates, so brute force is exponential even though each check is polynomial. That is also the good news hidden in the definition: a problem in NP is always decidable, with an exponential upper bound. What nobody knows is whether the gap can be closed in general — that is exactly what P versus NP asks.

go deeper

for a junior

Hold on to the shape: verifying is given an answer, solving has to produce one. A fast check is about one candidate, not about how many there are.

for a middle

Quantify it: count the candidate space, multiply by the per-check cost, and show why a polynomial check leaves the total exponential.

for a senior

Use the split in a design discussion: decide whether the answer needs recomputing or only rechecking, and have the solver emit an artefact the reviewer can validate.

for a principal

Own the tradeoff explicitly: an exact search with an auditable certificate, a good-enough answer with a bound, or a cached answer revalidated cheaply are three different commitments.

## The asymmetry, precisely A verifier is a function of two things: the instance and **one** proposed answer. Its polynomial bound is a statement about the cost of processing that pair. A solver is a function of one thing: the instance. It must produce an answer that does not exist yet. Those are different jobs with different inputs, and no theorem converts a bound on the first into a bound on the second. Put in the resolver's terms: the reviewer's recheck walks the dependency constraints once and asks, for each, whether the chosen versions satisfy it. The resolver had to **choose** those versions, and the space it chose from is combinatorial. ## Counting what the solver faces - With `n` packages and up to `k` acceptable versions each, the naive space is up to `k^n` combinations. Ten packages with five candidate versions each is already about ten million; twenty packages is about a hundred trillion. - In the general shape of NP, a certificate of `p(n)` bits gives at most `2^p(n)` candidate strings. Multiplying by a polynomial check leaves `2^p(n) * poly(n)` — still exponential. - Constraints prune the space in practice, and good solvers prune aggressively, but pruning is a heuristic on the instance. It is not a bound implied by the verifier's speed. The key move is to notice that the verifier's polynomial is **per candidate**. Nothing in the definition multiplies it by anything smaller than the candidate count. ## What a fast verifier does buy you The gap is not a defect; the checkability is a real asset: - **Decidability with a concrete bound.** Enumerating every certificate and checking it terminates, so a problem in NP is never undecidable and never worse than exponential. - **Auditability.** The answer can be rechecked by a party that does not trust, cannot run, or does not have the solver. Trust moves from the search to the check, and the check is the simple component. - **A cheap correctness oracle for the solver itself.** Any candidate the solver emits can be validated independently, so a bug in the search surfaces as a rejected certificate rather than a silently wrong result. - **Cheap revalidation.** When nothing about the instance changed, rechecking the stored answer is far cheaper than recomputing it. | Intuition | Why it fails | |---|---| | 'Checking is fast, so searching must be nearly as fast' | The check is priced per candidate; the search pays the candidate count too | | 'The checker could be run backwards to produce an answer' | A verifier is a decision procedure over pairs; inverting it is the search problem restated | | 'Hours of runtime means the implementation is poor' | It may be, but the combinatorial space is there regardless of implementation quality | | 'No fast solver is known, so none can exist' | Non-existence is unproved; this is the open question, not a settled result | ## Where this shows up in a plan When someone proposes 'the service will just compute the optimal configuration on each request', the useful response is not 'that is NP-something' as a verdict. It is the split: how large is the candidate space, is a certificate being produced that anyone can recheck, and is an answer that is merely good enough acceptable. The verifier framing gives you a design lever — emit the proof artefact alongside the answer — that is independent of how the search is implemented and survives replacing the solver later. ## The sentence that closes the gap honestly 'Fast to check' and 'fast to find' are related only by a question nobody has answered. Saying 'checking is easy so finding is easy' asserts a resolution to that question; saying 'checking is easy therefore finding is impossible' asserts the opposite one. Both are overclaims. The correct statement is narrow: the verifier bounds the audit, brute force over certificates bounds the search from above, and the distance between those two bounds is open.

  • Does a polynomial verifier at least guarantee that the problem can be solved in some bounded time?
    Yes. Certificates are at most `p(n)` bits, so there are at most `2^p(n)` of them; enumerate each and run the polynomial check. The total is exponential but finite, which is why a problem in NP is always decidable and never worse than exponential time.
  • If the search was slow and unreviewable, why is the reviewer's recheck still worth producing?
    Because it moves trust off the solver. The recheck confirms the chosen set satisfies every constraint using only the answer and the instance, so a solver that is slow, heuristic, randomised or later replaced does not weaken the guarantee the reviewer gets.

Checking a finished jigsaw is a glance along the seams; assembling it from a heap is a different job with a different cost. The picture being obviously right at the end says nothing about how long the sorting took.

saying these in an interview costs you the question

  • Says a fast verifier implies a fast solver exists
  • Claims the checker can be inverted to emit a certificate
  • Treats easy to check as proof the problem is easy
  • Concludes the problem is undecidable because search is slow
  • Assumes long runtime always means a poor implementation