FAILURE MAP
← Case archive

FA-15151 / Numerics / Open access

Colex combination rank: binomial lower index · case 01

The exact colex combination rank result violates the stated contract at binomial lower index.

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

ROOT CAUSE

The binomial lower index step uses i instead of i+1.

VERIFIED REPAIR

Use i+1 at the binomial lower index step.

Unsuccessful approach: The partial repair len(a)-i still violates the binomial lower index invariant.

Case contract

Input strictly increasing selected nonnegative integers; zero-based colex rank=sum choose(a_i,i+1).

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    a=x;rank=0
    for i in range(len(a)):
     top=a[i];bottom=i
     term=math.comb(top,bottom) if 0<=bottom<=top else 0
     rank=rank+term
    return rank
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0], 0), ([0, 1], 0), ([4, 5, 6, 7, 8], 125), ([0], 0), ([1], 1), ([0], 0), ([1], 1), ([2], 2)], [([0], 0), ([0, 1, 2], 0), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 3], 3), ([1, 2], 2), ([1, 3], 4), ([2, 3], 5)], [([0, 1], 0), ([1, 3], 4), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 4], 6), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7)], [([0], 0), ([0, 1, 3], 1), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 1, 2, 3], 0), ([0, 1, 2, 4], 1), ([0, 1, 3, 4], 2), ([0, 2, 3, 4], 3)], [([2], 2), ([0, 1, 2, 3], 0), ([0], 0), ([4, 5, 6, 7, 8], 125), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7), ([1, 5], 11)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 010Failed
explicit oracle 120Failed
explicit oracle 2126125Failed
explicit oracle 310Failed
explicit oracle 411Passed
explicit oracle 510Failed
explicit oracle 611Passed
explicit oracle 712Failed

SHA-256 / 0d4d87db1b05d10a7c7243df12289480bc7a56a1a8ae7254d91d9720f1858eed

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    a=x;rank=0
    for i in range(len(a)):
     top=a[i];bottom=len(a)-i
     term=math.comb(top,bottom) if 0<=bottom<=top else 0
     rank=rank+term
    return rank
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0], 0), ([0, 1], 0), ([4, 5, 6, 7, 8], 125), ([0], 0), ([1], 1), ([0], 0), ([1], 1), ([2], 2)], [([0], 0), ([0, 1, 2], 0), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 3], 3), ([1, 2], 2), ([1, 3], 4), ([2, 3], 5)], [([0, 1], 0), ([1, 3], 4), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 4], 6), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7)], [([0], 0), ([0, 1, 3], 1), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 1, 2, 3], 0), ([0, 1, 2, 4], 1), ([0, 1, 3, 4], 2), ([0, 2, 3, 4], 3)], [([2], 2), ([0, 1, 2, 3], 0), ([0], 0), ([4, 5, 6, 7, 8], 125), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7), ([1, 5], 11)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 000Passed
explicit oracle 110Failed
explicit oracle 254125Failed
explicit oracle 300Passed
explicit oracle 411Passed
explicit oracle 500Passed
explicit oracle 611Passed
explicit oracle 722Passed

SHA-256 / 75035d13a1d2e26784575fbe9b8663fd0e72e46fbf8799de21d214d408e455d5

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    a=x;rank=0
    for i in range(len(a)):
     top=a[i];bottom=i+1
     term=math.comb(top,bottom) if 0<=bottom<=top else 0
     rank=rank+term
    return rank
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0], 0), ([0, 1], 0), ([4, 5, 6, 7, 8], 125), ([0], 0), ([1], 1), ([0], 0), ([1], 1), ([2], 2)], [([0], 0), ([0, 1, 2], 0), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 3], 3), ([1, 2], 2), ([1, 3], 4), ([2, 3], 5)], [([0, 1], 0), ([1, 3], 4), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 4], 6), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7)], [([0], 0), ([0, 1, 3], 1), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 1, 2, 3], 0), ([0, 1, 2, 4], 1), ([0, 1, 3, 4], 2), ([0, 2, 3, 4], 3)], [([2], 2), ([0, 1, 2, 3], 0), ([0], 0), ([4, 5, 6, 7, 8], 125), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7), ([1, 5], 11)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 000Passed
explicit oracle 100Passed
explicit oracle 2125125Passed
explicit oracle 300Passed
explicit oracle 411Passed
explicit oracle 500Passed
explicit oracle 611Passed
explicit oracle 722Passed

SHA-256 / fd7cbcd4ba90780d5c847b589661c90a9538bd6210bcf748be47f4aee5ecf79e

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra 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:39:23.925740+00:00.

Case digest / 1fdd43522afaab2b5606b18a6a383ac06b416d7013d0893f9548be57e3944030