FAILURE MAP
← Case archive

FA-5701 / Combinatorics / Open access

Hypergeometric numerator · case 01

Independent selection counts are added instead of multiplied.

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

ROOT CAUSE

Independent selection counts are added instead of multiplied.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return math.comb(good,successes)*math.comb(bad,draws-successes)

Unsuccessful approach: All draws are counted without the success constraint.

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. good,bad,draws,successes>=0 and successes<=draws. Count unlabelled draws with exactly successes good objects; impossible population selections return zero. Exact operational definition: math.comb(good,successes)*math.comb(bad,draws-successes)

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(good, bad, draws, successes):
    return math.comb(good,successes)+math.comb(bad,draws-successes)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 3, 3, 2)', solve(*(4, 3, 3, 2)), 18)
check('fixture 2: (2, 2, 2, 0)', solve(*(2, 2, 2, 0)), 1)
check('fixture 3: (3, 0, 2, 2)', solve(*(3, 0, 2, 2)), 3)
check('fixture 4: (1, 4, 2, 2)', solve(*(1, 4, 2, 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: (4, 3, 3, 2)918Failed
fixture 2: (2, 2, 2, 0)21Failed
fixture 3: (3, 0, 2, 2)43Failed
fixture 4: (1, 4, 2, 2)10Failed

SHA-256 / 1d80965b8cffe0b86f786ee0dbdbfc1cd0726d8270c38607cff893f04dd77085

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(good, bad, draws, successes):
    return math.comb(good+bad,draws)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 3, 3, 2)', solve(*(4, 3, 3, 2)), 18)
check('fixture 2: (2, 2, 2, 0)', solve(*(2, 2, 2, 0)), 1)
check('fixture 3: (3, 0, 2, 2)', solve(*(3, 0, 2, 2)), 3)
check('fixture 4: (1, 4, 2, 2)', solve(*(1, 4, 2, 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: (4, 3, 3, 2)3518Failed
fixture 2: (2, 2, 2, 0)61Failed
fixture 3: (3, 0, 2, 2)33Passed
fixture 4: (1, 4, 2, 2)100Failed

SHA-256 / b88fb9d16b392e50b870b120315d397922b9d804ec8bec26b224561f4dde9c54

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(good, bad, draws, successes):
    return math.comb(good,successes)*math.comb(bad,draws-successes)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 3, 3, 2)', solve(*(4, 3, 3, 2)), 18)
check('fixture 2: (2, 2, 2, 0)', solve(*(2, 2, 2, 0)), 1)
check('fixture 3: (3, 0, 2, 2)', solve(*(3, 0, 2, 2)), 3)
check('fixture 4: (1, 4, 2, 2)', solve(*(1, 4, 2, 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: (4, 3, 3, 2)1818Passed
fixture 2: (2, 2, 2, 0)11Passed
fixture 3: (3, 0, 2, 2)33Passed
fixture 4: (1, 4, 2, 2)00Passed

SHA-256 / 917d6c55b7420a9613bc31220d536ff9529d203cecb5baf4b8ddd40fa055b5fb

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

Case digest / 18f4ff0c8286f4419e62cdb587c2deba5f39d5f0ae261b0f36fab804e5e4ce77