FAILURE MAP
← Case archive

FA-70441 / GIS polygon topology / Open access

Bounding box topological relation: equality test · case 01

Boxes that merely share a lower-left corner are reported as equal.

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

ROOT CAUSE

Equality compares only the minimum corner.

VERIFIED REPAIR

At the equality test step restore `if a == b:`, leaving the rest of the model unchanged.

Unsuccessful approach: Comparing the x extent only still reports boxes with different heights as equal.

Case contract

Input [a, b], closed boxes [minx, miny, maxx, maxy] with positive width and height. Return "equals" if identical, else "disjoint" if separated with no shared point, else "contains" if a covers b (shared edges allowed), "within" if b covers a, else "touches" if the boxes share only boundary, else "overlaps".

Why this case matters

Spatial indexes and map tile filters prune candidates with envelope relations before exact geometry tests.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    a, b = x
    if a[:2] == b[:2]:
        return 'equals'
    if a[2] < b[0] or b[2] < a[0] or a[3] < b[1] or b[3] < a[1]:
        return 'disjoint'
    if a[0] <= b[0] and a[1] <= b[1] and a[2] >= b[2] and a[3] >= b[3]:
        return 'contains'
    if b[0] <= a[0] and b[1] <= a[1] and b[2] >= a[2] and b[3] >= a[3]:
        return 'within'
    if a[2] == b[0] or b[2] == a[0] or a[3] == b[1] or b[3] == a[1]:
        return 'touches'
    return 'overlaps'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[3, 0, 9, 4], [9, 3, 13, 11]], 'touches'), ('control #1', [[6, 3, 7, 5], [3, 1, 9, 6]], 'within'), ('control #2', [[5, 9, 6, 10], [3, 9, 10, 13]], 'within'), ('control #3', [[8, 2, 9, 4], [1, 10, 4, 15]], 'disjoint'), ('control #4', [[1, 1, 7, 5], [4, 5, 9, 8]], 'touches'), ('control #5', [[9, 7, 16, 13], [1, 10, 7, 13]], 'disjoint'), ('boundary #18', [[0, 0, 5, 5], [0, 5, 5, 9]], 'touches'), ('boundary #19', [[0, 0, 10, 10], [0, 0, 5, 5]], 'contains')], [('control #3', [[8, 2, 9, 4], [1, 10, 4, 15]], 'disjoint'), ('control #4', [[1, 1, 7, 5], [4, 5, 9, 8]], 'touches'), ('control #5', [[9, 7, 16, 13], [1, 10, 7, 13]], 'disjoint'), ('control #6', [[3, 1, 4, 5], [8, 8, 12, 15]], 'disjoint'), ('control #7', [[1, 7, 6, 11], [0, 6, 7, 7]], 'touches'), ('control #8', [[2, 1, 4, 2], [3, 1, 6, 4]], 'overlaps'), ('regression #23', [[0, 0, 4, 9], [0, 0, 4, 3]], 'contains'), ('regression #24', [[0, 0, 4, 9], [0, 1, 4, 9]], 'contains')], [('control #6', [[3, 1, 4, 5], [8, 8, 12, 15]], 'disjoint'), ('control #7', [[1, 7, 6, 11], [0, 6, 7, 7]], 'touches'), ('control #8', [[2, 1, 4, 2], [3, 1, 6, 4]], 'overlaps'), ('control #9', [[7, 2, 15, 6], [8, 4, 14, 11]], 'overlaps'), ('control #10', [[7, 1, 10, 3], [7, 0, 14, 3]], 'within'), ('control #11', [[2, 7, 10, 9], [10, 8, 12, 13]], 'touches'), ('regression #24', [[0, 0, 4, 9], [0, 1, 4, 9]], 'contains'), ('regression #25', [[0, 0, 4, 4], [0, 0, 4, 6]], 'within')], [('control #9', [[7, 2, 15, 6], [8, 4, 14, 11]], 'overlaps'), ('control #10', [[7, 1, 10, 3], [7, 0, 14, 3]], 'within'), ('control #11', [[2, 7, 10, 9], [10, 8, 12, 13]], 'touches'), ('control #12', [[8, 9, 9, 16], [4, 4, 11, 11]], 'overlaps'), ('control #13', [[5, 3, 9, 9], [7, 8, 8, 15]], 'overlaps'), ('control #14', [[3, 2, 10, 3], [8, 5, 14, 7]], 'disjoint'), ('boundary #19', [[0, 0, 10, 10], [0, 0, 5, 5]], 'contains'), ('regression #25', [[0, 0, 4, 4], [0, 0, 4, 6]], 'within')], [('control #12', [[8, 9, 9, 16], [4, 4, 11, 11]], 'overlaps'), ('control #13', [[5, 3, 9, 9], [7, 8, 8, 15]], 'overlaps'), ('control #14', [[3, 2, 10, 3], [8, 5, 14, 7]], 'disjoint'), ('control #15', [[3, 5, 7, 12], [9, 2, 16, 3]], 'disjoint'), ('boundary #16', [[0, 0, 5, 5], [5, 0, 9, 5]], 'touches'), ('boundary #17', [[0, 0, 5, 5], [5, 5, 9, 9]], 'touches'), ('boundary #18', [[0, 0, 5, 5], [0, 5, 5, 9]], 'touches'), ('regression #23', [[0, 0, 4, 9], [0, 0, 4, 3]], 'contains')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
control #0touchestouchesPassed
control #1withinwithinPassed
control #2withinwithinPassed
control #3disjointdisjointPassed
control #4touchestouchesPassed
control #5disjointdisjointPassed
boundary #18touchestouchesPassed
boundary #19equalscontainsFailed

SHA-256 / 79d29e1f319a4153748c25c1cb3f528021895dba87f67fa0d3be58b297db8ae8

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    a, b = x
    if a[0] == b[0] and a[2] == b[2]:
        return 'equals'
    if a[2] < b[0] or b[2] < a[0] or a[3] < b[1] or b[3] < a[1]:
        return 'disjoint'
    if a[0] <= b[0] and a[1] <= b[1] and a[2] >= b[2] and a[3] >= b[3]:
        return 'contains'
    if b[0] <= a[0] and b[1] <= a[1] and b[2] >= a[2] and b[3] >= a[3]:
        return 'within'
    if a[2] == b[0] or b[2] == a[0] or a[3] == b[1] or b[3] == a[1]:
        return 'touches'
    return 'overlaps'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[3, 0, 9, 4], [9, 3, 13, 11]], 'touches'), ('control #1', [[6, 3, 7, 5], [3, 1, 9, 6]], 'within'), ('control #2', [[5, 9, 6, 10], [3, 9, 10, 13]], 'within'), ('control #3', [[8, 2, 9, 4], [1, 10, 4, 15]], 'disjoint'), ('control #4', [[1, 1, 7, 5], [4, 5, 9, 8]], 'touches'), ('control #5', [[9, 7, 16, 13], [1, 10, 7, 13]], 'disjoint'), ('boundary #18', [[0, 0, 5, 5], [0, 5, 5, 9]], 'touches'), ('boundary #19', [[0, 0, 10, 10], [0, 0, 5, 5]], 'contains')], [('control #3', [[8, 2, 9, 4], [1, 10, 4, 15]], 'disjoint'), ('control #4', [[1, 1, 7, 5], [4, 5, 9, 8]], 'touches'), ('control #5', [[9, 7, 16, 13], [1, 10, 7, 13]], 'disjoint'), ('control #6', [[3, 1, 4, 5], [8, 8, 12, 15]], 'disjoint'), ('control #7', [[1, 7, 6, 11], [0, 6, 7, 7]], 'touches'), ('control #8', [[2, 1, 4, 2], [3, 1, 6, 4]], 'overlaps'), ('regression #23', [[0, 0, 4, 9], [0, 0, 4, 3]], 'contains'), ('regression #24', [[0, 0, 4, 9], [0, 1, 4, 9]], 'contains')], [('control #6', [[3, 1, 4, 5], [8, 8, 12, 15]], 'disjoint'), ('control #7', [[1, 7, 6, 11], [0, 6, 7, 7]], 'touches'), ('control #8', [[2, 1, 4, 2], [3, 1, 6, 4]], 'overlaps'), ('control #9', [[7, 2, 15, 6], [8, 4, 14, 11]], 'overlaps'), ('control #10', [[7, 1, 10, 3], [7, 0, 14, 3]], 'within'), ('control #11', [[2, 7, 10, 9], [10, 8, 12, 13]], 'touches'), ('regression #24', [[0, 0, 4, 9], [0, 1, 4, 9]], 'contains'), ('regression #25', [[0, 0, 4, 4], [0, 0, 4, 6]], 'within')], [('control #9', [[7, 2, 15, 6], [8, 4, 14, 11]], 'overlaps'), ('control #10', [[7, 1, 10, 3], [7, 0, 14, 3]], 'within'), ('control #11', [[2, 7, 10, 9], [10, 8, 12, 13]], 'touches'), ('control #12', [[8, 9, 9, 16], [4, 4, 11, 11]], 'overlaps'), ('control #13', [[5, 3, 9, 9], [7, 8, 8, 15]], 'overlaps'), ('control #14', [[3, 2, 10, 3], [8, 5, 14, 7]], 'disjoint'), ('boundary #19', [[0, 0, 10, 10], [0, 0, 5, 5]], 'contains'), ('regression #25', [[0, 0, 4, 4], [0, 0, 4, 6]], 'within')], [('control #12', [[8, 9, 9, 16], [4, 4, 11, 11]], 'overlaps'), ('control #13', [[5, 3, 9, 9], [7, 8, 8, 15]], 'overlaps'), ('control #14', [[3, 2, 10, 3], [8, 5, 14, 7]], 'disjoint'), ('control #15', [[3, 5, 7, 12], [9, 2, 16, 3]], 'disjoint'), ('boundary #16', [[0, 0, 5, 5], [5, 0, 9, 5]], 'touches'), ('boundary #17', [[0, 0, 5, 5], [5, 5, 9, 9]], 'touches'), ('boundary #18', [[0, 0, 5, 5], [0, 5, 5, 9]], 'touches'), ('regression #23', [[0, 0, 4, 9], [0, 0, 4, 3]], 'contains')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
control #0touchestouchesPassed
control #1withinwithinPassed
control #2withinwithinPassed
control #3disjointdisjointPassed
control #4touchestouchesPassed
control #5disjointdisjointPassed
boundary #18equalstouchesFailed
boundary #19containscontainsPassed

SHA-256 / e846f7c2bba2fd17f1074c360a42240e7166da9668773898ad575fd85c21790a

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
    a, b = x
    if a == b:
        return 'equals'
    if a[2] < b[0] or b[2] < a[0] or a[3] < b[1] or b[3] < a[1]:
        return 'disjoint'
    if a[0] <= b[0] and a[1] <= b[1] and a[2] >= b[2] and a[3] >= b[3]:
        return 'contains'
    if b[0] <= a[0] and b[1] <= a[1] and b[2] >= a[2] and b[3] >= a[3]:
        return 'within'
    if a[2] == b[0] or b[2] == a[0] or a[3] == b[1] or b[3] == a[1]:
        return 'touches'
    return 'overlaps'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control #0', [[3, 0, 9, 4], [9, 3, 13, 11]], 'touches'), ('control #1', [[6, 3, 7, 5], [3, 1, 9, 6]], 'within'), ('control #2', [[5, 9, 6, 10], [3, 9, 10, 13]], 'within'), ('control #3', [[8, 2, 9, 4], [1, 10, 4, 15]], 'disjoint'), ('control #4', [[1, 1, 7, 5], [4, 5, 9, 8]], 'touches'), ('control #5', [[9, 7, 16, 13], [1, 10, 7, 13]], 'disjoint'), ('boundary #18', [[0, 0, 5, 5], [0, 5, 5, 9]], 'touches'), ('boundary #19', [[0, 0, 10, 10], [0, 0, 5, 5]], 'contains')], [('control #3', [[8, 2, 9, 4], [1, 10, 4, 15]], 'disjoint'), ('control #4', [[1, 1, 7, 5], [4, 5, 9, 8]], 'touches'), ('control #5', [[9, 7, 16, 13], [1, 10, 7, 13]], 'disjoint'), ('control #6', [[3, 1, 4, 5], [8, 8, 12, 15]], 'disjoint'), ('control #7', [[1, 7, 6, 11], [0, 6, 7, 7]], 'touches'), ('control #8', [[2, 1, 4, 2], [3, 1, 6, 4]], 'overlaps'), ('regression #23', [[0, 0, 4, 9], [0, 0, 4, 3]], 'contains'), ('regression #24', [[0, 0, 4, 9], [0, 1, 4, 9]], 'contains')], [('control #6', [[3, 1, 4, 5], [8, 8, 12, 15]], 'disjoint'), ('control #7', [[1, 7, 6, 11], [0, 6, 7, 7]], 'touches'), ('control #8', [[2, 1, 4, 2], [3, 1, 6, 4]], 'overlaps'), ('control #9', [[7, 2, 15, 6], [8, 4, 14, 11]], 'overlaps'), ('control #10', [[7, 1, 10, 3], [7, 0, 14, 3]], 'within'), ('control #11', [[2, 7, 10, 9], [10, 8, 12, 13]], 'touches'), ('regression #24', [[0, 0, 4, 9], [0, 1, 4, 9]], 'contains'), ('regression #25', [[0, 0, 4, 4], [0, 0, 4, 6]], 'within')], [('control #9', [[7, 2, 15, 6], [8, 4, 14, 11]], 'overlaps'), ('control #10', [[7, 1, 10, 3], [7, 0, 14, 3]], 'within'), ('control #11', [[2, 7, 10, 9], [10, 8, 12, 13]], 'touches'), ('control #12', [[8, 9, 9, 16], [4, 4, 11, 11]], 'overlaps'), ('control #13', [[5, 3, 9, 9], [7, 8, 8, 15]], 'overlaps'), ('control #14', [[3, 2, 10, 3], [8, 5, 14, 7]], 'disjoint'), ('boundary #19', [[0, 0, 10, 10], [0, 0, 5, 5]], 'contains'), ('regression #25', [[0, 0, 4, 4], [0, 0, 4, 6]], 'within')], [('control #12', [[8, 9, 9, 16], [4, 4, 11, 11]], 'overlaps'), ('control #13', [[5, 3, 9, 9], [7, 8, 8, 15]], 'overlaps'), ('control #14', [[3, 2, 10, 3], [8, 5, 14, 7]], 'disjoint'), ('control #15', [[3, 5, 7, 12], [9, 2, 16, 3]], 'disjoint'), ('boundary #16', [[0, 0, 5, 5], [5, 0, 9, 5]], 'touches'), ('boundary #17', [[0, 0, 5, 5], [5, 5, 9, 9]], 'touches'), ('boundary #18', [[0, 0, 5, 5], [0, 5, 5, 9]], 'touches'), ('regression #23', [[0, 0, 4, 9], [0, 0, 4, 3]], 'contains')]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
control #0touchestouchesPassed
control #1withinwithinPassed
control #2withinwithinPassed
control #3disjointdisjointPassed
control #4touchestouchesPassed
control #5disjointdisjointPassed
boundary #18touchestouchesPassed
boundary #19containscontainsPassed

SHA-256 / a06de6404c86a258ad8ed505c71985619aa1521698d9c8c25d89c85a1efa09e0

Verification & scope

Stipulated deterministic toy contract on a bounded input domain; results are rounded as stated and no conformance with any published standard or library is claimed. 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:48:20.709667+00:00.

Case digest / d09ed8c6288959786757f62d8afbaf153832f1915966991d062356ef6ed759d2