FAILURE MAP
← Case archive

FA-5636 / Combinatorics / Open access

Polygon diagonal count · case 01

Polygon sides are included as diagonals.

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

ROOT CAUSE

Polygon sides are included as diagonals.

THE FAILURE

Polygon sides are included as diagonals.

Unsuccessful approach: Each diagonal is counted from both endpoints.

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>=3; count unordered vertex pairs excluding adjacent vertices. Exact operational definition: n*(n-3)//2

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):
    return n*(n-1)//2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3,)', solve(*(3,)), 0)
check('fixture 2: (4,)', solve(*(4,)), 2)
check('fixture 3: (5,)', solve(*(5,)), 5)
check('fixture 4: (8,)', solve(*(8,)), 20)
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,)30Failed
fixture 2: (4,)62Failed
fixture 3: (5,)105Failed
fixture 4: (8,)2820Failed

SHA-256 / 050d49f215318e87737b01fd16a59990c4223c75a004f373c20eadb1d28691e8

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):
    return n*(n-3)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3,)', solve(*(3,)), 0)
check('fixture 2: (4,)', solve(*(4,)), 2)
check('fixture 3: (5,)', solve(*(5,)), 5)
check('fixture 4: (8,)', solve(*(8,)), 20)
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,)00Passed
fixture 2: (4,)42Failed
fixture 3: (5,)105Failed
fixture 4: (8,)4020Failed

SHA-256 / 3165b5f8293c7d71ce9eee2e51441112052866f25edaa4b5ad3f3bc05c94c924

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

Case digest / 3e71be20217ff5ca8d8256ffa165ceefa812b9c07594572cf01939b234d3e4f8