FAILURE MAP
← Case archive

FA-15181 / Numerics / Open access

Combinadic unrank: strict preceding element ceiling · case 01

The exact combinadic unrank result violates the stated contract at strict preceding element ceiling.

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

ROOT CAUSE

The strict preceding element ceiling step uses a-1 instead of a.

VERIFIED REPAIR

Use a at the strict preceding element ceiling step.

Unsuccessful approach: The partial repair j still violates the strict preceding element ceiling 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,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-1
    return out[::-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 0], [0, 1]), ([2, 5], [2, 3]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 1], [1]), ([1, 2], [2]), ([1, 3], [3]), ([1, 4], [4])], [([2, 2], [1, 2]), ([2, 12], [2, 5]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 17], [17]), ([1, 18], [18]), ([1, 19], [19]), ([1, 20], [20])], [([2, 5], [2, 3]), ([2, 17], [2, 6]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 34], [34]), ([1, 35], [35]), ([1, 36], [36]), ([1, 37], [37])], [([2, 9], [3, 4]), ([2, 20], [5, 6]), ([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])], [([2, 14], [4, 5]), ([2, 25], [4, 7]), ([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[-1, 1][0, 1]Failed
explicit oracle 1[1, 3][2, 3]Failed
explicit oracle 2[0][0]Passed
explicit oracle 3[-1, 1, 3, 5, 7][0, 3, 5, 6, 7]Failed
explicit oracle 4[1][1]Passed
explicit oracle 5[2][2]Passed
explicit oracle 6[3][3]Passed
explicit oracle 7[4][4]Passed

SHA-256 / 6099e498a120fd889a7932b9cd8f196ee7cd38d0376249e2bf5586c8a61052ee

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(k,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=j
    return out[::-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 0], [0, 1]), ([2, 5], [2, 3]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 1], [1]), ([1, 2], [2]), ([1, 3], [3]), ([1, 4], [4])], [([2, 2], [1, 2]), ([2, 12], [2, 5]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 17], [17]), ([1, 18], [18]), ([1, 19], [19]), ([1, 20], [20])], [([2, 5], [2, 3]), ([2, 17], [2, 6]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 34], [34]), ([1, 35], [35]), ([1, 36], [36]), ([1, 37], [37])], [([2, 9], [3, 4]), ([2, 20], [5, 6]), ([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])], [([2, 14], [4, 5]), ([2, 25], [4, 7]), ([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, 1][0, 1]Passed
explicit oracle 1[1, 3][2, 3]Failed
explicit oracle 2[0][0]Passed
explicit oracle 3[1, 2, 3, 4, 7][0, 3, 5, 6, 7]Failed
explicit oracle 4[1][1]Passed
explicit oracle 5[2][2]Passed
explicit oracle 6[3][3]Passed
explicit oracle 7[4][4]Passed

SHA-256 / 3c120f1ce992d7efcd3b3841a676156acbd800941e479eb8e8f544f9757536e7

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):
    k,r=x;out=[];ceiling=r+k+1
    for j in range(k,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 = [[([2, 0], [0, 1]), ([2, 5], [2, 3]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 1], [1]), ([1, 2], [2]), ([1, 3], [3]), ([1, 4], [4])], [([2, 2], [1, 2]), ([2, 12], [2, 5]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 17], [17]), ([1, 18], [18]), ([1, 19], [19]), ([1, 20], [20])], [([2, 5], [2, 3]), ([2, 17], [2, 6]), ([1, 0], [0]), ([5, 49], [0, 3, 5, 6, 7]), ([1, 34], [34]), ([1, 35], [35]), ([1, 36], [36]), ([1, 37], [37])], [([2, 9], [3, 4]), ([2, 20], [5, 6]), ([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])], [([2, 14], [4, 5]), ([2, 25], [4, 7]), ([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, 1][0, 1]Passed
explicit oracle 1[2, 3][2, 3]Passed
explicit oracle 2[0][0]Passed
explicit oracle 3[0, 3, 5, 6, 7][0, 3, 5, 6, 7]Passed
explicit oracle 4[1][1]Passed
explicit oracle 5[2][2]Passed
explicit oracle 6[3][3]Passed
explicit oracle 7[4][4]Passed

SHA-256 / b551e9d3e940e3fffa862f8a9ed68a79e527b8570f2c06148027dc52532118c4

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:24.069971+00:00.

Case digest / 01efb079dac4732b4a61e058eea7467b2b41bab9950897c3131dd4b4f250c9c4