FAILURE MAP
← Case archive

FA-5696 / Combinatorics / Open access

Binomial probability rational · case 01

One arrangement is mistaken for all arrangements with k successes.

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

ROOT CAUSE

One arrangement is mistaken for all arrangements with k successes.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction(math.comb(n,k),2**n))

Unsuccessful approach: The denominator counts trials rather than equiprobable outcomes.

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. Binomial probability rational. Exact operational definition: str(Fraction(math.comb(n,k),2**n))

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 str(Fraction(1,2**n))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 2)', solve(*(4, 2)), '3/8')
check('fixture 2: (3, 0)', solve(*(3, 0)), '1/8')
check('fixture 3: (0, 0)', solve(*(0, 0)), '1')
check('fixture 4: (2, 3)', solve(*(2, 3)), '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, 2)1/163/8Failed
fixture 2: (3, 0)1/81/8Passed
fixture 3: (0, 0)11Passed
fixture 4: (2, 3)1/40Failed

SHA-256 / a9b001274ac7c733b2be36b415d2133ac2a4f7435f16bdd5156df962ebeface5

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 str(Fraction(math.comb(n,k),n)) if n else "1"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 2)', solve(*(4, 2)), '3/8')
check('fixture 2: (3, 0)', solve(*(3, 0)), '1/8')
check('fixture 3: (0, 0)', solve(*(0, 0)), '1')
check('fixture 4: (2, 3)', solve(*(2, 3)), '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, 2)3/23/8Failed
fixture 2: (3, 0)1/31/8Failed
fixture 3: (0, 0)11Passed
fixture 4: (2, 3)00Passed

SHA-256 / 7a477dadcee40900eea0e1529e059979898f04f285aaed9fd49f9ddad7e2c9cb

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 str(Fraction(math.comb(n,k),2**n))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (4, 2)', solve(*(4, 2)), '3/8')
check('fixture 2: (3, 0)', solve(*(3, 0)), '1/8')
check('fixture 3: (0, 0)', solve(*(0, 0)), '1')
check('fixture 4: (2, 3)', solve(*(2, 3)), '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, 2)3/83/8Passed
fixture 2: (3, 0)1/81/8Passed
fixture 3: (0, 0)11Passed
fixture 4: (2, 3)00Passed

SHA-256 / 1cbba233aa3e29320180dd131e7b64acbbe71d0f6544ce8fc0a2c5074e04ec6b

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

Case digest / b8c3eb6bce4077a00dc3e97ecadc65d46aff2f21bc2eb2d0fef167c23568cf7c