Skip to section
Foundationsfor rotation-free search
Section 26 of 5250% of course
Contents
Chapter 5 Section 5.1 72 min

Part III · Construction and proof

Why neighboring blocks cannot leak into a score

Prove the target coefficient reads exactly one corpus block.

Animated visual · ManimA score tap sees one block

Query support bounds force every contributor to remain inside the selected corpus block.

Getting the right answer is only half the battle

In Chapter 4, we showed that every intended product qivj,i definitely reaches our target tj = Dj+D−1. In math, we call that a completeness argument: everything we want is there. But we still need a soundness argument: we have to prove that absolutely no unintended garbage can sneak into that same target.

You can run a hundred successful examples, but they still won't prove your code is safe from contamination for every possible block and every valid input. Values can accidentally cancel each other out, and friendly test cases might never even touch a dangerous position. A real proof has to reason about all the positions that could possibly contribute, completely independently of what their current values happen to be.

Let's trace a target backward

Forward tracing asks, "where does this pair end up?" Proving we're safe from contamination is actually easier if we go backward: "which corpus positions could possibly even reach this target?" Any normal convolution term that manages to hit tj must have a query position i and a corpus position tj−i. Since our query support guarantees 0 ≤ i ≤ D−1, let's plug those limits in:

smallest corpus positiontj − (D−1) = Dj
largest corpus positiontj − 0 = Dj+D−1

Look closely at those bounds! They are exactly the left and right edges of block j. Every possible contributor is safely locked inside that block, and every single position in that block neatly decodes back to one logical coordinate of vector j. These bounds don't just say the block is "near" the target; they perfectly cover exactly D positions and completely ignore the neighbors.

Worked example

Let's trace j=2 and D=4

Our target is 11. Query positions 0 through 3 require corpus positions 11, 10, 9, and 8. Block 2 spans positions 8 through 11. That means position 7 (from block 1) and position 12 (from block 3) are mathematically completely unreachable.

Worked example

The edges don't need special casing

For our very first block j=0, backward tracing t₀=D−1 yields corpus positions 0 through D−1. For our last full block j=N/D−1, it yields N−D through N−1. The exact same inequality covers both edges perfectly; we don't ever need to worry about negative or ≥N corpus positions.

Now, let's recover the logical coordinate

A physical corpus position r inside block j represents logical coordinate i = tj−r. When we pair it with query position i, we get qivj,i. So, our proof just established both claims at once: all contributors come strictly from block j, and every single contributor matches up with the exact same logical coordinate.

Check your understanding

Which core assumption is what actually isolates block j?

Proof-structure check

When we showed that intended matching products reach tⱼ, which half of correctness did we establish?

Section summary

  • Backward tracing cleanly turns a target into absolute contributor bounds.
  • Those bounds map perfectly to block j.
  • Our query support width is a fundamental correctness invariant.

Repository layer · second pass

Why can the target coefficient read only vector j’s block?

For target tⱼ=Dj+D−1, any contributing pair must satisfy i+k=tⱼ. Query support restricts i to 0…D−1, so k=tⱼ−i ranges from Dj through Dj+D−1—exactly block j. This is a support proof: values never enter the argument.

The query’s zeros outside its D-wide support are essential. A wider query could produce a valid k in a neighboring block, contaminating the same tap even if every block is internally reversed.

Reasoning chain

  1. 1

    Fix tⱼ.

  2. 2

    Use k=tⱼ−i.

  3. 3

    Substitute the minimum and maximum legal i.

  4. 4

    Obtain the exact corpus interval [Dj,Dj+D−1].

  5. 5

    Conclude no other block can contribute.

Worked trace

Bound both ends for D=4,j=2

  1. t₂=11.
  2. At i=0, k=11.
  3. At i=3, k=8.
  4. All intermediate i give k in 8…11, block 2.

Result. The target’s contributor set is isolated by index bounds.

Executable lens · Python

Make the hidden state visible

def contributors(d, j):
    t = d*j + d - 1
    return [(i, t-i) for i in range(d)]
assert {k for _,k in contributors(4,2)} == {8,9,10,11}

Retype this example, predict each intermediate value, and then change one input that touches a boundary.

Misconception clinic

Tempting mistakes

  • Arguing that neighboring values cancel; isolation must hold for arbitrary values.
  • Forgetting that query support is an implementation invariant.

Retrieval and transfer

Close the book first

  1. Repeat the interval proof symbolically.
  2. Construct contamination when query support has D+1 positions.
  3. Turn the support premise into a runtime assertion.