FAILURE MAP
← Case archive

FA-73031 / Probabilistic sketches / Open access

HyperLogLog merge across precisions: empty registers acquire phantom ranks · case 01

Registers that never saw a hash contribute non-zero ranks after folding, inflating the estimate.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Empty registers are not skipped during folding, so displaced index bits alone produce a rank.

THE FAILURE

Empty registers are not skipped during folding, so displaced index bits alone produce a rank.

Unsuccessful approach: Skipping only empty registers with zero displaced bits still invents ranks for the others.

Case contract

Input {a, b}, each {p, regs}. Both sketches are folded to q = min precision. Folding from p to q with d = p - q maps register j to j >> d; if the low d bits of j are non-zero they become the leading bits of the new remainder, giving rank d - bitlen(low) + 1, otherwise the rank is r + d. Empty registers contribute nothing. The merged sketch is the element-wise maximum. Return [q, regs].

Why this case matters

Merging distinct-count sketches produced with different precision settings requires re-deriving ranks, not just re-indexing registers.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    def fold(sk, q):
        d = sk['p'] - q
        out = [0] * (1 << q)
        for j, r in enumerate(sk['regs']):
            pass
            nj = j >> d
            low = j & ((1 << d) - 1)
            if low != 0:
                nr = d - low.bit_length() + 1
            else:
                nr = r + d
            out[nj] = max(out[nj], nr)
        return out
    q = min(x['a']['p'], x['b']['p'])
    fa = fold(x['a'], q)
    fb = fold(x['b'], q)
    return [q, [max(u, v) for u, v in zip(fa, fb)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [3,
                   2,
                   4,
                   3,
                   0,
                   4,
                   5,
                   1,
                   1,
                   1,
                   0,
                   0,
                   0,
                   5,
                   3,
                   0,
                   4,
                   2,
                   5,
                   3,
                   0,
                   3,
                   0,
                   0,
                   3,
                   0,
                   0,
                   5,
                   4,
                   3,
                   1,
                   0]},
    'b': {'p': 3, 'regs': [2, 1, 0, 4, 3, 0, 1, 3]}},
   [3, [5, 2, 3, 4, 6, 2, 5, 6]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 3, 0, 2]},
    'b': {'p': 4, 'regs': [5, 0, 5, 3, 3, 2, 2, 2, 4, 4, 0, 3, 4, 0, 4, 4]}},
   [2, [7, 5, 6, 6]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [0, 0, 4, 0, 1, 5, 0, 0]},
    'b': {'p': 3, 'regs': [0, 2, 1, 4, 0, 0, 0, 0]}},
   [3, [0, 2, 4, 4, 1, 5, 0, 0]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [4, 4, 4, 4]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 1]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [0, 5, 0, 0, 0, 0, 4, 2]},
    'b': {'p': 6,
          'regs': [0,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   3,
                   2,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   3,
                   0,
                   0,
                   5,
                   0,
                   0,
                   1,
                   0,
                   0,
                   4,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   4,
                   0,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   0,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   2,
                   1,
                   3,
                   0,
                   0,
                   0]}},
   [3, [3, 6, 3, 2, 1, 6, 4, 2]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]],
 [['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [0,
                   0,
                   1,
                   2,
                   0,
                   2,
                   0,
                   3,
                   0,
                   4,
                   5,
                   0,
                   3,
                   0,
                   0,
                   3,
                   3,
                   1,
                   2,
                   0,
                   5,
                   0,
                   3,
                   0,
                   4,
                   1,
                   0,
                   1,
                   1,
                   4,
                   3,
                   4]},
    'b': {'p': 3, 'regs': [3, 0, 3, 3, 0, 1, 1, 2]}},
   [3, [3, 2, 3, 5, 5, 7, 6, 3]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 0, 0, 0]},
    'b': {'p': 4, 'regs': [1, 2, 5, 0, 1, 0, 2, 0, 3, 2, 4, 1, 4, 0, 3, 1]}},
   [2, [3, 3, 5, 6]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 1, 2, 5, 4]},
    'b': {'p': 3, 'regs': [2, 1, 0, 0, 0, 0, 0, 0]}},
   [3, [2, 1, 0, 0, 1, 2, 5, 4]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [5, 5, 5, 5]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 2]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [0, 0, 2, 4, 5, 0, 5, 0]},
    'b': {'p': 6,
          'regs': [0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   1,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   1,
                   2,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   1,
                   4,
                   2,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   0,
                   0,
                   4,
                   0,
                   1,
                   0,
                   0,
                   0,
                   2,
                   0,
                   0,
                   0,
                   4,
                   3,
                   0,
                   0,
                   2,
                   5,
                   0,
                   0,
                   0]}},
   [3, [1, 0, 3, 4, 5, 4, 5, 6]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]],
 [['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [1,
                   2,
                   2,
                   1,
                   3,
                   3,
                   3,
                   0,
                   1,
                   0,
                   4,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   2,
                   4,
                   0,
                   2,
                   4,
                   0,
                   4,
                   0,
                   3,
                   1,
                   2,
                   5,
                   5,
                   0,
                   0]},
    'b': {'p': 3, 'regs': [4, 0, 0, 1, 4, 4, 0, 0]}},
   [3, [4, 5, 3, 1, 4, 4, 2, 7]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 2, 0, 0]},
    'b': {'p': 4, 'regs': [2, 5, 1, 1, 1, 2, 4, 5, 1, 3, 3, 3, 0, 3, 1, 3]}},
   [2, [4, 3, 3, 2]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [5, 0, 0, 4, 0, 0, 2, 5]},
    'b': {'p': 3, 'regs': [3, 0, 1, 1, 5, 3, 1, 0]}},
   [3, [5, 0, 1, 4, 5, 3, 2, 5]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [6, 6, 6, 6]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [1, 0, 0, 3, 0, 0, 0, 5]},
    'b': {'p': 6,
          'regs': [0,
                   2,
                   2,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   5,
                   3,
                   0,
                   3,
                   4,
                   0,
                   4,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   0,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   3,
                   0,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   2,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   4,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   0]}},
   [3, [3, 3, 6, 3, 1, 1, 5, 7]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]],
 [['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [0,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   5,
                   1,
                   4,
                   4,
                   0,
                   2,
                   3,
                   5,
                   1,
                   0,
                   0,
                   1,
                   1,
                   5,
                   3,
                   0,
                   0,
                   0,
                   5,
                   4,
                   3,
                   4,
                   5,
                   3,
                   2]},
    'b': {'p': 3, 'regs': [5, 3, 1, 2, 0, 3, 3, 3]}},
   [3, [5, 3, 3, 4, 1, 7, 3, 6]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 0, 0, 0]},
    'b': {'p': 4, 'regs': [1, 0, 3, 0, 4, 4, 2, 1, 4, 4, 2, 0, 0, 1, 2, 1]}},
   [2, [3, 6, 6, 2]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [3, 3, 2, 1, 5, 3, 0, 0]},
    'b': {'p': 3, 'regs': [0, 1, 0, 0, 0, 2, 2, 5]}},
   [3, [3, 3, 2, 1, 5, 3, 2, 5]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [3, 3, 3, 3]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 1]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [4, 2, 0, 0, 4, 0, 2, 0]},
    'b': {'p': 6,
          'regs': [0,
                   0,
                   0,
                   2,
                   0,
                   0,
                   5,
                   0,
                   0,
                   5,
                   0,
                   4,
                   2,
                   0,
                   0,
                   1,
                   0,
                   0,
                   0,
                   2,
                   1,
                   0,
                   0,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   5,
                   3,
                   4,
                   5,
                   0,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   3,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   2,
                   0,
                   5,
                   0,
                   1,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0]}},
   [3, [4, 3, 2, 3, 8, 6, 2, 3]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]],
 [['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [0,
                   5,
                   1,
                   2,
                   0,
                   5,
                   0,
                   1,
                   1,
                   0,
                   5,
                   1,
                   0,
                   1,
                   0,
                   2,
                   3,
                   1,
                   0,
                   3,
                   4,
                   0,
                   0,
                   5,
                   0,
                   5,
                   1,
                   0,
                   0,
                   0,
                   0,
                   0]},
    'b': {'p': 3, 'regs': [5, 1, 1, 4, 2, 3, 5, 0]}},
   [3, [5, 2, 3, 4, 5, 6, 5, 0]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 3, 3, 0]},
    'b': {'p': 4, 'regs': [1, 3, 2, 0, 0, 5, 2, 2, 3, 2, 4, 2, 3, 3, 1, 3]}},
   [2, [3, 3, 5, 5]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [4, 0, 0, 3, 0, 4, 1, 1]},
    'b': {'p': 3, 'regs': [0, 0, 0, 0, 3, 0, 4, 0]}},
   [3, [4, 0, 0, 3, 3, 4, 4, 1]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [4, 4, 4, 4]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 2]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [0, 0, 4, 4, 0, 5, 3, 0]},
    'b': {'p': 6,
          'regs': [0,
                   0,
                   0,
                   0,
                   2,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   2,
                   0,
                   5,
                   0,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   4,
                   0,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   3,
                   1,
                   3,
                   1,
                   5,
                   0,
                   0,
                   0,
                   0,
                   2,
                   0,
                   3,
                   0,
                   0,
                   4]}},
   [3, [1, 4, 4, 7, 3, 8, 3, 2]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]]]
for label, args, expected in cases[N - 1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fold p5 into p3[3, [5, 2, 3, 4, 6, 2, 5, 6]][3, [5, 2, 3, 4, 6, 2, 5, 6]]Passed
fold p4 into p2[2, [7, 5, 6, 6]][2, [7, 5, 6, 6]]Passed
same precision[3, [0, 2, 4, 4, 1, 5, 0, 0]][3, [0, 2, 4, 4, 1, 5, 0, 0]]Passed
only low-zero slots[2, [4, 4, 4, 4]][2, [4, 4, 4, 4]]Passed
only odd slots[2, [2, 2, 2, 2]][2, [2, 2, 2, 2]]Passed
fold p6 into p3[3, [3, 6, 3, 3, 3, 6, 4, 3]][3, [3, 6, 3, 2, 1, 6, 4, 2]]Failed
empty sketches[2, [1, 1, 1, 1]][2, [0, 0, 0, 0]]Failed

SHA-256 / 0f44c37b96b220314d72f3ee1323e4eb520d78c4de70656da618adcdd5fa77d8

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    def fold(sk, q):
        d = sk['p'] - q
        out = [0] * (1 << q)
        for j, r in enumerate(sk['regs']):
            if r == 0 and (j & ((1 << d) - 1)) == 0:
                continue
            nj = j >> d
            low = j & ((1 << d) - 1)
            if low != 0:
                nr = d - low.bit_length() + 1
            else:
                nr = r + d
            out[nj] = max(out[nj], nr)
        return out
    q = min(x['a']['p'], x['b']['p'])
    fa = fold(x['a'], q)
    fb = fold(x['b'], q)
    return [q, [max(u, v) for u, v in zip(fa, fb)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [3,
                   2,
                   4,
                   3,
                   0,
                   4,
                   5,
                   1,
                   1,
                   1,
                   0,
                   0,
                   0,
                   5,
                   3,
                   0,
                   4,
                   2,
                   5,
                   3,
                   0,
                   3,
                   0,
                   0,
                   3,
                   0,
                   0,
                   5,
                   4,
                   3,
                   1,
                   0]},
    'b': {'p': 3, 'regs': [2, 1, 0, 4, 3, 0, 1, 3]}},
   [3, [5, 2, 3, 4, 6, 2, 5, 6]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 3, 0, 2]},
    'b': {'p': 4, 'regs': [5, 0, 5, 3, 3, 2, 2, 2, 4, 4, 0, 3, 4, 0, 4, 4]}},
   [2, [7, 5, 6, 6]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [0, 0, 4, 0, 1, 5, 0, 0]},
    'b': {'p': 3, 'regs': [0, 2, 1, 4, 0, 0, 0, 0]}},
   [3, [0, 2, 4, 4, 1, 5, 0, 0]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [4, 4, 4, 4]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 1]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [0, 5, 0, 0, 0, 0, 4, 2]},
    'b': {'p': 6,
          'regs': [0,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   3,
                   2,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   3,
                   0,
                   0,
                   5,
                   0,
                   0,
                   1,
                   0,
                   0,
                   4,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   4,
                   0,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   0,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   2,
                   1,
                   3,
                   0,
                   0,
                   0]}},
   [3, [3, 6, 3, 2, 1, 6, 4, 2]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]],
 [['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [0,
                   0,
                   1,
                   2,
                   0,
                   2,
                   0,
                   3,
                   0,
                   4,
                   5,
                   0,
                   3,
                   0,
                   0,
                   3,
                   3,
                   1,
                   2,
                   0,
                   5,
                   0,
                   3,
                   0,
                   4,
                   1,
                   0,
                   1,
                   1,
                   4,
                   3,
                   4]},
    'b': {'p': 3, 'regs': [3, 0, 3, 3, 0, 1, 1, 2]}},
   [3, [3, 2, 3, 5, 5, 7, 6, 3]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 0, 0, 0]},
    'b': {'p': 4, 'regs': [1, 2, 5, 0, 1, 0, 2, 0, 3, 2, 4, 1, 4, 0, 3, 1]}},
   [2, [3, 3, 5, 6]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 1, 2, 5, 4]},
    'b': {'p': 3, 'regs': [2, 1, 0, 0, 0, 0, 0, 0]}},
   [3, [2, 1, 0, 0, 1, 2, 5, 4]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [5, 5, 5, 5]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 2]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [0, 0, 2, 4, 5, 0, 5, 0]},
    'b': {'p': 6,
          'regs': [0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   1,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   1,
                   2,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   1,
                   4,
                   2,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   0,
                   0,
                   4,
                   0,
                   1,
                   0,
                   0,
                   0,
                   2,
                   0,
                   0,
                   0,
                   4,
                   3,
                   0,
                   0,
                   2,
                   5,
                   0,
                   0,
                   0]}},
   [3, [1, 0, 3, 4, 5, 4, 5, 6]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]],
 [['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [1,
                   2,
                   2,
                   1,
                   3,
                   3,
                   3,
                   0,
                   1,
                   0,
                   4,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   2,
                   4,
                   0,
                   2,
                   4,
                   0,
                   4,
                   0,
                   3,
                   1,
                   2,
                   5,
                   5,
                   0,
                   0]},
    'b': {'p': 3, 'regs': [4, 0, 0, 1, 4, 4, 0, 0]}},
   [3, [4, 5, 3, 1, 4, 4, 2, 7]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 2, 0, 0]},
    'b': {'p': 4, 'regs': [2, 5, 1, 1, 1, 2, 4, 5, 1, 3, 3, 3, 0, 3, 1, 3]}},
   [2, [4, 3, 3, 2]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [5, 0, 0, 4, 0, 0, 2, 5]},
    'b': {'p': 3, 'regs': [3, 0, 1, 1, 5, 3, 1, 0]}},
   [3, [5, 0, 1, 4, 5, 3, 2, 5]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [6, 6, 6, 6]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [1, 0, 0, 3, 0, 0, 0, 5]},
    'b': {'p': 6,
          'regs': [0,
                   2,
                   2,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   5,
                   3,
                   0,
                   3,
                   4,
                   0,
                   4,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   0,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   3,
                   0,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   2,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   4,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   0]}},
   [3, [3, 3, 6, 3, 1, 1, 5, 7]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]],
 [['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [0,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   5,
                   1,
                   4,
                   4,
                   0,
                   2,
                   3,
                   5,
                   1,
                   0,
                   0,
                   1,
                   1,
                   5,
                   3,
                   0,
                   0,
                   0,
                   5,
                   4,
                   3,
                   4,
                   5,
                   3,
                   2]},
    'b': {'p': 3, 'regs': [5, 3, 1, 2, 0, 3, 3, 3]}},
   [3, [5, 3, 3, 4, 1, 7, 3, 6]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 0, 0, 0]},
    'b': {'p': 4, 'regs': [1, 0, 3, 0, 4, 4, 2, 1, 4, 4, 2, 0, 0, 1, 2, 1]}},
   [2, [3, 6, 6, 2]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [3, 3, 2, 1, 5, 3, 0, 0]},
    'b': {'p': 3, 'regs': [0, 1, 0, 0, 0, 2, 2, 5]}},
   [3, [3, 3, 2, 1, 5, 3, 2, 5]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [3, 3, 3, 3]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 1]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [4, 2, 0, 0, 4, 0, 2, 0]},
    'b': {'p': 6,
          'regs': [0,
                   0,
                   0,
                   2,
                   0,
                   0,
                   5,
                   0,
                   0,
                   5,
                   0,
                   4,
                   2,
                   0,
                   0,
                   1,
                   0,
                   0,
                   0,
                   2,
                   1,
                   0,
                   0,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   5,
                   3,
                   4,
                   5,
                   0,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   3,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   2,
                   0,
                   5,
                   0,
                   1,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0]}},
   [3, [4, 3, 2, 3, 8, 6, 2, 3]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]],
 [['fold p5 into p3',
   {'a': {'p': 5,
          'regs': [0,
                   5,
                   1,
                   2,
                   0,
                   5,
                   0,
                   1,
                   1,
                   0,
                   5,
                   1,
                   0,
                   1,
                   0,
                   2,
                   3,
                   1,
                   0,
                   3,
                   4,
                   0,
                   0,
                   5,
                   0,
                   5,
                   1,
                   0,
                   0,
                   0,
                   0,
                   0]},
    'b': {'p': 3, 'regs': [5, 1, 1, 4, 2, 3, 5, 0]}},
   [3, [5, 2, 3, 4, 5, 6, 5, 0]]],
  ['fold p4 into p2',
   {'a': {'p': 2, 'regs': [0, 3, 3, 0]},
    'b': {'p': 4, 'regs': [1, 3, 2, 0, 0, 5, 2, 2, 3, 2, 4, 2, 3, 3, 1, 3]}},
   [2, [3, 3, 5, 5]]],
  ['same precision',
   {'a': {'p': 3, 'regs': [4, 0, 0, 3, 0, 4, 1, 1]},
    'b': {'p': 3, 'regs': [0, 0, 0, 0, 3, 0, 4, 0]}},
   [3, [4, 0, 0, 3, 3, 4, 4, 1]]],
  ['only low-zero slots',
   {'a': {'p': 4, 'regs': [2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0]},
    'b': {'p': 2, 'regs': [0, 1, 0, 0]}},
   [2, [4, 4, 4, 4]]],
  ['only odd slots',
   {'a': {'p': 4, 'regs': [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2]},
    'b': {'p': 2, 'regs': [0, 0, 0, 2]}},
   [2, [2, 2, 2, 2]]],
  ['fold p6 into p3',
   {'a': {'p': 3, 'regs': [0, 0, 4, 4, 0, 5, 3, 0]},
    'b': {'p': 6,
          'regs': [0,
                   0,
                   0,
                   0,
                   2,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   3,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   2,
                   0,
                   5,
                   0,
                   0,
                   4,
                   0,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   0,
                   1,
                   0,
                   0,
                   4,
                   0,
                   0,
                   0,
                   5,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   0,
                   3,
                   1,
                   3,
                   1,
                   5,
                   0,
                   0,
                   0,
                   0,
                   2,
                   0,
                   3,
                   0,
                   0,
                   4]}},
   [3, [1, 4, 4, 7, 3, 8, 3, 2]]],
  ['empty sketches',
   {'a': {'p': 3, 'regs': [0, 0, 0, 0, 0, 0, 0, 0]}, 'b': {'p': 2, 'regs': [0, 0, 0, 0]}},
   [2, [0, 0, 0, 0]]]]]
for label, args, expected in cases[N - 1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
fold p5 into p3[3, [5, 2, 3, 4, 6, 2, 5, 6]][3, [5, 2, 3, 4, 6, 2, 5, 6]]Passed
fold p4 into p2[2, [7, 5, 6, 6]][2, [7, 5, 6, 6]]Passed
same precision[3, [0, 2, 4, 4, 1, 5, 0, 0]][3, [0, 2, 4, 4, 1, 5, 0, 0]]Passed
only low-zero slots[2, [4, 4, 4, 4]][2, [4, 4, 4, 4]]Passed
only odd slots[2, [2, 2, 2, 2]][2, [2, 2, 2, 2]]Passed
fold p6 into p3[3, [3, 6, 3, 3, 3, 6, 4, 3]][3, [3, 6, 3, 2, 1, 6, 4, 2]]Failed
empty sketches[2, [1, 1, 1, 1]][2, [0, 0, 0, 0]]Failed

SHA-256 / f0a73f4b596b20e8d9e03a341de733d2cc60709006768b14d08d24f4e2a00023

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic, bounded teaching model with stipulated constants and pre-hashed or explicitly hashed inputs; it is not a production implementation and makes no claim of conformance to any library or paper beyond the stated contract. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:48:43.824942+00:00.

Case digest / 1f96cbc03ea6235d48b54b48192a04a0555135ef5c8ccc27dbdcebe08fa88c63