FA-40031 / Heap invariants / Open access
Binomial carry advances one rank even when the old rank is zero · case 01
The bounded binomial carry certificate reports an incorrect carry rank.
ROOT CAUSE
Binomial carry advances one rank even when the old rank is zero.
THE FAILURE
Binomial carry advances one rank even when the old rank is zero.
Unsuccessful approach: The local patch uses 2*r[i] if link else None and still violates the stated relation.
Case contract
A consolidation cursor sees ordered ranks and index i. Report whether to link now, current rank, carry rank, suffix retained after a link, triple-collision deferral, and link partner. In three equal consecutive ranks defer the first pair so a carry is not consolidated twice out of order. Empty cursor is allowed.
Why this case matters
This isolates an internal heap representation or priority-structure invariant using deterministic finite records.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
r=d['ranks']; i=d['i']; exists=i<len(r); pair=i+1<len(r) and r[i]==r[i+1]; triple=i+2<len(r) and r[i]==r[i+1]==r[i+2]
link=pair and not triple
return {'link_now': link,
'current': r[i] if exists else None,
'carry_rank': r[i] if link else None,
'suffix': r[i+2:] if link else r[i:],
'defer': triple,
'partner': i+1 if link else None}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [1, 2, 2, 3], 'i': 0}, {'link_now': False, 'current': 1, 'carry_rank': None, 'suffix': [1, 2, 2, 3], 'defer': False, 'partner': None})], [({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [2, 3, 3, 4], 'i': 0}, {'link_now': False, 'current': 2, 'carry_rank': None, 'suffix': [2, 3, 3, 4], 'defer': False, 'partner': None})], [({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [3, 4, 4, 5], 'i': 0}, {'link_now': False, 'current': 3, 'carry_rank': None, 'suffix': [3, 4, 4, 5], 'defer': False, 'partner': None})], [({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [4, 5, 5, 6], 'i': 0}, {'link_now': False, 'current': 4, 'carry_rank': None, 'suffix': [4, 5, 5, 6], 'defer': False, 'partner': None})], [({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [5, 6, 6, 7], 'i': 0}, {'link_now': False, 'current': 5, 'carry_rank': None, 'suffix': [5, 6, 6, 7], 'defer': False, 'partner': None})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression certificate 1 | {'carry_rank': None, 'current': None, 'defer': False, 'link_now': False, 'partner': None, 'suffix': []} | {'carry_rank': None, 'current': None, 'defer': False, 'link_now': False, 'partner': None, 'suffix': []} | Passed |
| regression certificate 2 | {'carry_rank': 0, 'current': 0, 'defer': False, 'link_now': True, 'partner': 1, 'suffix': []} | {'carry_rank': 1, 'current': 0, 'defer': False, 'link_now': True, 'partner': 1, 'suffix': []} | Failed |
| regression certificate 3 | {'carry_rank': None, 'current': 0, 'defer': True, 'link_now': False, 'partner': None, 'suffix': [0, 0, 0, 2]} | {'carry_rank': None, 'current': 0, 'defer': True, 'link_now': False, 'partner': None, 'suffix': [0, 0, 0, 2]} | Passed |
| regression certificate 4 | {'carry_rank': 1, 'current': 1, 'defer': False, 'link_now': True, 'partner': 2, 'suffix': [3]} | {'carry_rank': 2, 'current': 1, 'defer': False, 'link_now': True, 'partner': 2, 'suffix': [3]} | Failed |
| regression certificate 5 | {'carry_rank': 2, 'current': 2, 'defer': False, 'link_now': True, 'partner': 2, 'suffix': [4, 5]} | {'carry_rank': 3, 'current': 2, 'defer': False, 'link_now': True, 'partner': 2, 'suffix': [4, 5]} | Failed |
| regression certificate 6 | {'carry_rank': None, 'current': 0, 'defer': False, 'link_now': False, 'partner': None, 'suffix': [0, 1, 1, 2]} | {'carry_rank': None, 'current': 0, 'defer': False, 'link_now': False, 'partner': None, 'suffix': [0, 1, 1, 2]} | Passed |
| variant-dependent certificate | {'carry_rank': None, 'current': 1, 'defer': False, 'link_now': False, 'partner': None, 'suffix': [1, 2, 2, 3]} | {'carry_rank': None, 'current': 1, 'defer': False, 'link_now': False, 'partner': None, 'suffix': [1, 2, 2, 3]} | Passed |
SHA-256 / 9faf4a013585c84850b42248cb6aae780eb60ecad36835b7b5eb5ee014602741
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
r=d['ranks']; i=d['i']; exists=i<len(r); pair=i+1<len(r) and r[i]==r[i+1]; triple=i+2<len(r) and r[i]==r[i+1]==r[i+2]
link=pair and not triple
return {'link_now': link,
'current': r[i] if exists else None,
'carry_rank': 2*r[i] if link else None,
'suffix': r[i+2:] if link else r[i:],
'defer': triple,
'partner': i+1 if link else None}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [1, 2, 2, 3], 'i': 0}, {'link_now': False, 'current': 1, 'carry_rank': None, 'suffix': [1, 2, 2, 3], 'defer': False, 'partner': None})], [({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [2, 3, 3, 4], 'i': 0}, {'link_now': False, 'current': 2, 'carry_rank': None, 'suffix': [2, 3, 3, 4], 'defer': False, 'partner': None})], [({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [3, 4, 4, 5], 'i': 0}, {'link_now': False, 'current': 3, 'carry_rank': None, 'suffix': [3, 4, 4, 5], 'defer': False, 'partner': None})], [({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [4, 5, 5, 6], 'i': 0}, {'link_now': False, 'current': 4, 'carry_rank': None, 'suffix': [4, 5, 5, 6], 'defer': False, 'partner': None})], [({'ranks': [], 'i': 0}, {'link_now': False, 'current': None, 'carry_rank': None, 'suffix': [], 'defer': False, 'partner': None}), ({'ranks': [0, 0], 'i': 0}, {'link_now': True, 'current': 0, 'carry_rank': 1, 'suffix': [], 'defer': False, 'partner': 1}), ({'ranks': [0, 0, 0, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 0, 0, 2], 'defer': True, 'partner': None}), ({'ranks': [0, 1, 1, 3], 'i': 1}, {'link_now': True, 'current': 1, 'carry_rank': 2, 'suffix': [3], 'defer': False, 'partner': 2}), ({'ranks': [1, 2, 2, 4, 5], 'i': 1}, {'link_now': True, 'current': 2, 'carry_rank': 3, 'suffix': [4, 5], 'defer': False, 'partner': 2}), ({'ranks': [0, 1, 1, 2], 'i': 0}, {'link_now': False, 'current': 0, 'carry_rank': None, 'suffix': [0, 1, 1, 2], 'defer': False, 'partner': None}), ({'ranks': [5, 6, 6, 7], 'i': 0}, {'link_now': False, 'current': 5, 'carry_rank': None, 'suffix': [5, 6, 6, 7], 'defer': False, 'partner': None})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][1])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression certificate 1 | {'carry_rank': None, 'current': None, 'defer': False, 'link_now': False, 'partner': None, 'suffix': []} | {'carry_rank': None, 'current': None, 'defer': False, 'link_now': False, 'partner': None, 'suffix': []} | Passed |
| regression certificate 2 | {'carry_rank': 0, 'current': 0, 'defer': False, 'link_now': True, 'partner': 1, 'suffix': []} | {'carry_rank': 1, 'current': 0, 'defer': False, 'link_now': True, 'partner': 1, 'suffix': []} | Failed |
| regression certificate 3 | {'carry_rank': None, 'current': 0, 'defer': True, 'link_now': False, 'partner': None, 'suffix': [0, 0, 0, 2]} | {'carry_rank': None, 'current': 0, 'defer': True, 'link_now': False, 'partner': None, 'suffix': [0, 0, 0, 2]} | Passed |
| regression certificate 4 | {'carry_rank': 2, 'current': 1, 'defer': False, 'link_now': True, 'partner': 2, 'suffix': [3]} | {'carry_rank': 2, 'current': 1, 'defer': False, 'link_now': True, 'partner': 2, 'suffix': [3]} | Passed |
| regression certificate 5 | {'carry_rank': 4, 'current': 2, 'defer': False, 'link_now': True, 'partner': 2, 'suffix': [4, 5]} | {'carry_rank': 3, 'current': 2, 'defer': False, 'link_now': True, 'partner': 2, 'suffix': [4, 5]} | Failed |
| regression certificate 6 | {'carry_rank': None, 'current': 0, 'defer': False, 'link_now': False, 'partner': None, 'suffix': [0, 1, 1, 2]} | {'carry_rank': None, 'current': 0, 'defer': False, 'link_now': False, 'partner': None, 'suffix': [0, 1, 1, 2]} | Passed |
| variant-dependent certificate | {'carry_rank': None, 'current': 1, 'defer': False, 'link_now': False, 'partner': None, 'suffix': [1, 2, 2, 3]} | {'carry_rank': None, 'current': 1, 'defer': False, 'link_now': False, 'partner': None, 'suffix': [1, 2, 2, 3]} | Passed |
SHA-256 / e65ba082649766708077d7614ec5acba28a6413e0c9e7df8ed74acaa37a4d16a
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 stipulated offline diagnostic model; it does not implement a production allocator, concurrency protocol, or complete heap library. 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:43:27.285137+00:00.
Case digest / 0a0c5cf51ac97b2144e99b99205135e868475cb6e803e38e96ea386f330604cd