FAILURE MAP
← Case archive

FA-5481 / Number theory / Open access

Gcd zero identity · case 01

The smaller operand is not generally a common divisor.

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

ROOT CAUSE

The smaller operand is not generally a common divisor.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return math.gcd(a,b)

Unsuccessful approach: Rejecting a zero operand violates the GCD identity.

Case contract

Integer inputs; n is positive unless a zero or negative fixture explicitly extends that operation. A modulus is greater than one; p is prime; exponent k may be signed when an inverse exists. a and b may be signed or zero; GCD is nonnegative and gcd(0,0)=0. Exact operational definition: math.gcd(a,b)

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Number theory 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 min(abs(a),abs(b))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0, 9)', solve(*(0, 9)), 9)
check('fixture 2: (12, 18)', solve(*(12, 18)), 6)
check('fixture 3: (-12, 18)', solve(*(-12, 18)), 6)
check('fixture 4: (0, 0)', solve(*(0, 0)), 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: (0, 9)09Failed
fixture 2: (12, 18)126Failed
fixture 3: (-12, 18)126Failed
fixture 4: (0, 0)00Passed

SHA-256 / 8b8d39ed96d2466c88a15c465eb7932d3be1f25e85681678ffec5992d34eb872

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 0 if not a or not b else math.gcd(a,b)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0, 9)', solve(*(0, 9)), 9)
check('fixture 2: (12, 18)', solve(*(12, 18)), 6)
check('fixture 3: (-12, 18)', solve(*(-12, 18)), 6)
check('fixture 4: (0, 0)', solve(*(0, 0)), 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: (0, 9)09Failed
fixture 2: (12, 18)66Passed
fixture 3: (-12, 18)66Passed
fixture 4: (0, 0)00Passed

SHA-256 / 4e5dd9b45e1f00fc5bad31339c0b355a577f1bc2402718077b3aac87b8109db3

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 math.gcd(a,b)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0, 9)', solve(*(0, 9)), 9)
check('fixture 2: (12, 18)', solve(*(12, 18)), 6)
check('fixture 3: (-12, 18)', solve(*(-12, 18)), 6)
check('fixture 4: (0, 0)', solve(*(0, 0)), 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: (0, 9)99Passed
fixture 2: (12, 18)66Passed
fixture 3: (-12, 18)66Passed
fixture 4: (0, 0)00Passed

SHA-256 / fc5e8e2e01117223cf1d95e44e73bcd414dfdfefdebdf5073318ccc3e0d0ba62

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

Case digest / fb6f7594ee7b80a74090a9373b05fe5ff1c094bfd200e10fc9a39ee28ebd02cc