FAILURE MAP
← Case archive

FA-5666 / Combinatorics / Open access

Onto function count · case 01

All functions are accepted without requiring every target.

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

ROOT CAUSE

All functions are accepted without requiring every target.

THE FAILURE

All functions are accepted without requiring every target.

Unsuccessful approach: The first inclusion-exclusion term overcorrects overlapping missing targets.

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. n labelled source elements and k labelled target elements; every target must be used. The unique empty-to-empty function is counted. Exact operational definition: sum((-1)**i*math.comb(k,i)*(k-i)**n for i in range(k+1))

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 k**n
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)), 0)
check('fixture 3: (0, 0)', solve(*(0, 0)), 1)
check('fixture 4: (4, 3)', solve(*(4, 3)), 36)
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)86Failed
fixture 2: (2, 3)90Failed
fixture 3: (0, 0)11Passed
fixture 4: (4, 3)8136Failed

SHA-256 / b1b23b6a6e584ec17c1587d796b39a420321daf0435a55adec503e48b0f03439

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 k**n-k*(k-1)**n
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)), 0)
check('fixture 3: (0, 0)', solve(*(0, 0)), 1)
check('fixture 4: (4, 3)', solve(*(4, 3)), 36)
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)-30Failed
fixture 3: (0, 0)11Passed
fixture 4: (4, 3)3336Failed

SHA-256 / dea736e0bc5ea39aa6bc5edfd17cf45fdb299f10dc66b119d2bc2d54150f44ce

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 4 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 6ab11485b90c9036221fce2938085a0946de1ba8f693b0ef2e09c2547ca623f2