FAILURE MAP
← Case archive

FA-5781 / Planar geometry / Open access

Squared point distance · case 01

Manhattan distance replaces squared Euclidean distance.

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

ROOT CAUSE

Manhattan distance replaces squared Euclidean distance.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return sum((x-y)**2 for x,y in zip(a,b))

Unsuccessful approach: Squaring the sum introduces cross terms and cancellation.

Case contract

Integer coordinates and lengths, with exact arithmetic except for indicated division results. Lengths are nonnegative. Rectangles are (xmin,ymin,xmax,ymax) with ordered bounds; coordinate vectors have matching dimensions. Squared point distance. Exact operational definition: sum((x-y)**2 for x,y in zip(a,b))

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Planar geometry 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(a, b):
    return sum(abs(x-y) for x,y in zip(a,b))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ((0, 0), (3, 4))', solve(*((0, 0), (3, 4))), 25)
check('fixture 2: ((1, 2), (1, 2))', solve(*((1, 2), (1, 2))), 0)
check('fixture 3: ((0, 0), (1, -1))', solve(*((0, 0), (1, -1))), 2)
check('fixture 4: ((-2, 0), (2, 0))', solve(*((-2, 0), (2, 0))), 16)
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: ((0, 0), (3, 4))725Failed
fixture 2: ((1, 2), (1, 2))00Passed
fixture 3: ((0, 0), (1, -1))22Passed
fixture 4: ((-2, 0), (2, 0))416Failed

SHA-256 / fb776eacedca275cd58f636e61f0d930709f0f108c708e18e989e54e96104ac6

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(a, b):
    return sum(x-y for x,y in zip(a,b))**2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ((0, 0), (3, 4))', solve(*((0, 0), (3, 4))), 25)
check('fixture 2: ((1, 2), (1, 2))', solve(*((1, 2), (1, 2))), 0)
check('fixture 3: ((0, 0), (1, -1))', solve(*((0, 0), (1, -1))), 2)
check('fixture 4: ((-2, 0), (2, 0))', solve(*((-2, 0), (2, 0))), 16)
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: ((0, 0), (3, 4))4925Failed
fixture 2: ((1, 2), (1, 2))00Passed
fixture 3: ((0, 0), (1, -1))02Failed
fixture 4: ((-2, 0), (2, 0))1616Passed

SHA-256 / b00ce21369ae2f13944eba9811902b4e1d380ac6cf5dec1f099e8d178c823807

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(a, b):
    return sum((x-y)**2 for x,y in zip(a,b))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ((0, 0), (3, 4))', solve(*((0, 0), (3, 4))), 25)
check('fixture 2: ((1, 2), (1, 2))', solve(*((1, 2), (1, 2))), 0)
check('fixture 3: ((0, 0), (1, -1))', solve(*((0, 0), (1, -1))), 2)
check('fixture 4: ((-2, 0), (2, 0))', solve(*((-2, 0), (2, 0))), 16)
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: ((0, 0), (3, 4))2525Passed
fixture 2: ((1, 2), (1, 2))00Passed
fixture 3: ((0, 0), (1, -1))22Passed
fixture 4: ((-2, 0), (2, 0))1616Passed

SHA-256 / c2cb9d3b008c956983d2249f706c9f1cd9a190251c94ac2946bbc590d1b5a3db

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

Case digest / 15f2cfaeb7f8a4859c0efe46f377c9d39861eaba00f55f3c37262c4040d0bac8