FA-15141 / Numerics / Open access
Colex combination rank: selected element traversal · case 01
The exact colex combination rank result violates the stated contract at selected element traversal.
ROOT CAUSE
The selected element traversal step uses range(len(a)-1) instead of range(len(a)).
VERIFIED REPAIR
Use range(len(a)) at the selected element traversal step.
Unsuccessful approach: The partial repair range(1,len(a)) still violates the selected element traversal 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)-1):
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 = [[([1], 1), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0], 0), ([0, 1], 0), ([0], 0), ([1], 1), ([2], 2)], [([1], 1), ([1, 2], 2), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 3], 3), ([1, 2], 2), ([1, 3], 4), ([2, 3], 5)], [([2], 2), ([3], 3), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 4], 6), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7)], [([0, 2], 1), ([2, 3], 5), ([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)], [([1, 2], 2), ([2], 2), ([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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | 0 | 1 | Failed |
| explicit oracle 1 | 0 | 0 | Passed |
| explicit oracle 2 | 69 | 125 | Failed |
| explicit oracle 3 | 0 | 0 | Passed |
| explicit oracle 4 | 0 | 0 | Passed |
| explicit oracle 5 | 0 | 0 | Passed |
| explicit oracle 6 | 0 | 1 | Failed |
| explicit oracle 7 | 0 | 2 | Failed |
SHA-256 / 812d1cc3f7b3e03f1866e48faecd1f68701f254698d1a826d4f5674dc970ebc1
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(1,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 = [[([1], 1), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0], 0), ([0, 1], 0), ([0], 0), ([1], 1), ([2], 2)], [([1], 1), ([1, 2], 2), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 3], 3), ([1, 2], 2), ([1, 3], 4), ([2, 3], 5)], [([2], 2), ([3], 3), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 4], 6), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7)], [([0, 2], 1), ([2, 3], 5), ([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)], [([1, 2], 2), ([2], 2), ([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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | 0 | 1 | Failed |
| explicit oracle 1 | 0 | 0 | Passed |
| explicit oracle 2 | 121 | 125 | Failed |
| explicit oracle 3 | 0 | 0 | Passed |
| explicit oracle 4 | 0 | 0 | Passed |
| explicit oracle 5 | 0 | 0 | Passed |
| explicit oracle 6 | 0 | 1 | Failed |
| explicit oracle 7 | 0 | 2 | Failed |
SHA-256 / 6a8efaee542645d793afc960f265ac2b5bfecff7dc668fac14aba226bb62aaa2
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 = [[([1], 1), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0], 0), ([0, 1], 0), ([0], 0), ([1], 1), ([2], 2)], [([1], 1), ([1, 2], 2), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 3], 3), ([1, 2], 2), ([1, 3], 4), ([2, 3], 5)], [([2], 2), ([3], 3), ([0], 0), ([4, 5, 6, 7, 8], 125), ([0, 4], 6), ([1, 2], 2), ([1, 3], 4), ([1, 4], 7)], [([0, 2], 1), ([2, 3], 5), ([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)], [([1, 2], 2), ([2], 2), ([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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | 1 | 1 | Passed |
| explicit oracle 1 | 0 | 0 | Passed |
| explicit oracle 2 | 125 | 125 | Passed |
| explicit oracle 3 | 0 | 0 | Passed |
| explicit oracle 4 | 0 | 0 | Passed |
| explicit oracle 5 | 0 | 0 | Passed |
| explicit oracle 6 | 1 | 1 | Passed |
| explicit oracle 7 | 2 | 2 | Passed |
SHA-256 / fe05e2cee738aab18589198cba9bb996dfd040c59a128b67c7fafb9fba9e93c1
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.872139+00:00.
Case digest / 12f05be068f5178bd4b87485263da13033d81c8c7e534918cb4acbb3e45a3f0e