FAILURE MAP
← Case archive

FA-15166 / Numerics / Open access

Combinadic unrank: descending binomial positions · case 01

The exact combinadic unrank result violates the stated contract at descending binomial positions.

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

ROOT CAUSE

The descending binomial positions step uses range(k-1,0,-1) instead of range(k,0,-1).

THE FAILURE

The descending binomial positions step uses range(k-1,0,-1) instead of range(k,0,-1).

Unsuccessful approach: The partial repair range(1,k+1) still violates the descending binomial positions invariant.

Case contract

Input [k,r], k>=1 and r>=0; unique increasing combination of k nonnegative integers with colex rank r. Bounds: 1<=k<=5 and 0<=r<=49.

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):
    k,r=x;out=[];ceiling=r+k+1
    for j in range(k-1,0,-1):
     a=ceiling-1
     for _ in range(200):
      if a<j or math.comb(a,j)<=r:break
      a-=1
     out.append(a)
     r=r-(math.comb(a,j) if a>=j else 0)
     ceiling=a
    return out[::-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 0], [0]), ([2, 0], [0, 1]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 1], [1]), ([1, 2], [2]), ([1, 3], [3]), ([1, 4], [4]), ([1, 5], [5])], [([1, 1], [1]), ([2, 4], [1, 3]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 17], [17]), ([1, 18], [18]), ([1, 19], [19]), ([1, 20], [20])], [([1, 2], [2]), ([2, 7], [1, 4]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 34], [34]), ([1, 35], [35]), ([1, 36], [36]), ([1, 37], [37])], [([1, 3], [3]), ([2, 10], [0, 5]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([2, 1], [0, 2]), ([2, 2], [1, 2]), ([2, 3], [0, 3]), ([2, 4], [1, 3])], [([1, 4], [4]), ([2, 13], [3, 5]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([2, 18], [3, 6]), ([2, 19], [4, 6]), ([2, 20], [5, 6]), ([2, 21], [0, 7])]]
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 0[][0]Failed
explicit oracle 1[0][0, 1]Failed
explicit oracle 2[1, 3, 5, 7][0, 3, 5, 6, 7]Failed
explicit oracle 3[][1]Failed
explicit oracle 4[][2]Failed
explicit oracle 5[][3]Failed
explicit oracle 6[][4]Failed
explicit oracle 7[][5]Failed

SHA-256 / e3e65a9948a673202c8e637b9e5bb06e3228a2f9e12418b8ef27f962ea3932fd

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):
    k,r=x;out=[];ceiling=r+k+1
    for j in range(1,k+1):
     a=ceiling-1
     for _ in range(200):
      if a<j or math.comb(a,j)<=r:break
      a-=1
     out.append(a)
     r=r-(math.comb(a,j) if a>=j else 0)
     ceiling=a
    return out[::-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 0], [0]), ([2, 0], [0, 1]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 1], [1]), ([1, 2], [2]), ([1, 3], [3]), ([1, 4], [4]), ([1, 5], [5])], [([1, 1], [1]), ([2, 4], [1, 3]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 17], [17]), ([1, 18], [18]), ([1, 19], [19]), ([1, 20], [20])], [([1, 2], [2]), ([2, 7], [1, 4]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 34], [34]), ([1, 35], [35]), ([1, 36], [36]), ([1, 37], [37])], [([1, 3], [3]), ([2, 10], [0, 5]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([2, 1], [0, 2]), ([2, 2], [1, 2]), ([2, 3], [0, 3]), ([2, 4], [1, 3])], [([1, 4], [4]), ([2, 13], [3, 5]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([2, 18], [3, 6]), ([2, 19], [4, 6]), ([2, 20], [5, 6]), ([2, 21], [0, 7])]]
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 0[0][0]Passed
explicit oracle 1[-1, 0][0, 1]Failed
explicit oracle 2[-2, -1, 0, 1, 49][0, 3, 5, 6, 7]Failed
explicit oracle 3[1][1]Passed
explicit oracle 4[2][2]Passed
explicit oracle 5[3][3]Passed
explicit oracle 6[4][4]Passed
explicit oracle 7[5][5]Passed

SHA-256 / ef5ee81e54354e428411d9ecde0158dc6df9cbced74dea237397d3de644af9c6

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 8 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. 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.970392+00:00.

Case digest / ea08c6ebe90cbf3bb03d83ef5ead33b2b873ba556471f980000ef58e52d78b08