FAILURE MAP
← Case archive

FA-5681 / Combinatorics / Open access

Positive composition count · case 01

Zero components are admitted in a positive composition.

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

ROOT CAUSE

Zero components are admitted in a positive composition.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return math.comb(n-1,parts-1) if n>=parts else 0

Unsuccessful approach: Choosing item positions does not choose gaps between items.

Case contract

Nonnegative integer counts. Permutation and combination counts are zero when a requested selection exceeds the available objects. Shape sizes satisfy the preconditions stated below. parts>=1; count ordered vectors of parts strictly positive integers summing to n. Exact operational definition: math.comb(n-1,parts-1) if n>=parts else 0

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Combinatorics results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n, parts):
    return math.comb(n+parts-1,parts-1)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 2)', solve(*(5, 2)), 4)
check('fixture 2: (3, 3)', solve(*(3, 3)), 1)
check('fixture 3: (2, 3)', solve(*(2, 3)), 0)
check('fixture 4: (0, 1)', solve(*(0, 1)), 0)
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
fixture 1: (5, 2)64Failed
fixture 2: (3, 3)101Failed
fixture 3: (2, 3)60Failed
fixture 4: (0, 1)10Failed

SHA-256 / adfe57ecd002d9e2691862cb6b9954d0cb732f7b7cd6eb542432df4ee4278fb3

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n, parts):
    return math.comb(n,parts)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 2)', solve(*(5, 2)), 4)
check('fixture 2: (3, 3)', solve(*(3, 3)), 1)
check('fixture 3: (2, 3)', solve(*(2, 3)), 0)
check('fixture 4: (0, 1)', solve(*(0, 1)), 0)
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
fixture 1: (5, 2)104Failed
fixture 2: (3, 3)11Passed
fixture 3: (2, 3)00Passed
fixture 4: (0, 1)00Passed

SHA-256 / e1563f42175afe3501525f967bd40cc553ebbbea312d2c48d3c8825d5dbf9fd8

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n, parts):
    return math.comb(n-1,parts-1) if n>=parts else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 2)', solve(*(5, 2)), 4)
check('fixture 2: (3, 3)', solve(*(3, 3)), 1)
check('fixture 3: (2, 3)', solve(*(2, 3)), 0)
check('fixture 4: (0, 1)', solve(*(0, 1)), 0)
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
fixture 1: (5, 2)44Passed
fixture 2: (3, 3)11Passed
fixture 3: (2, 3)00Passed
fixture 4: (0, 1)00Passed

SHA-256 / d66e0ae1d0f0b20abfd783d8ee09434f30a5b901b2104f94c26c79e9aea0b73f

Verification & scope

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

Case digest / b4d7167fa1a356913fe362eeec4ee8b24c9a966b7d5bc799b49373e09ab6d79b