FAILURE MAP
← Case archive

FA-5601 / Combinatorics / Open access

Multiset selection count · case 01

Distinct-subset counting forbids permitted repeats.

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

ROOT CAUSE

Distinct-subset counting forbids permitted repeats.

VERIFIED REPAIR

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

Unsuccessful approach: Ordered tuples distinguish arrangements that represent the same multiset.

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. Multiset selection count. Exact operational definition: math.comb(n+k-1,k) if n else int(k==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, k):
    return math.comb(n,k)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 2)', solve(*(3, 2)), 6)
check('fixture 2: (2, 3)', solve(*(2, 3)), 4)
check('fixture 3: (0, 0)', solve(*(0, 0)), 1)
check('fixture 4: (0, 2)', solve(*(0, 2)), 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: (3, 2)36Failed
fixture 2: (2, 3)04Failed
fixture 3: (0, 0)11Passed
fixture 4: (0, 2)00Passed

SHA-256 / 4a39ea83b94b72d64a977dd239e200bc0e8f4378ef21b170ae545104b240b270

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, k):
    return n**k
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 2)', solve(*(3, 2)), 6)
check('fixture 2: (2, 3)', solve(*(2, 3)), 4)
check('fixture 3: (0, 0)', solve(*(0, 0)), 1)
check('fixture 4: (0, 2)', solve(*(0, 2)), 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: (3, 2)96Failed
fixture 2: (2, 3)84Failed
fixture 3: (0, 0)11Passed
fixture 4: (0, 2)00Passed

SHA-256 / 311610e6694cf5157e5ebaa394128ad5c28f1ed428cb328fcf5e28f7c119da49

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

SHA-256 / dbf6dc92cf4a369f455255989629dbe143480d6fa4a81b2571ebcb179ab61f64

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

Case digest / 625d76acee58033b7d0c75e5895f05c1304e66fee0e39fc6cf02a60f34418fe6