FAILURE MAP
← Case archive

FA-5546 / Number theory / Open access

Modular negative exponent · case 01

A negative exponent is replaced with its magnitude.

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

ROOT CAUSE

A negative exponent is replaced with its magnitude.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return pow(a,k,m)

Unsuccessful approach: Returning zero for inverse powers violates the multiplicative group contract.

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 may be signed, k integer, m>1, and gcd(a,m)=1 when k<0. Return a**k modulo m. Exact operational definition: pow(a,k,m)

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, k, m):
    return pow(a,abs(k),m)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, -1, 5)', solve(*(2, -1, 5)), 3)
check('fixture 2: (2, -2, 5)', solve(*(2, -2, 5)), 4)
check('fixture 3: (3, 0, 7)', solve(*(3, 0, 7)), 1)
check('fixture 4: (3, 2, 7)', solve(*(3, 2, 7)), 2)
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: (2, -1, 5)23Failed
fixture 2: (2, -2, 5)44Passed
fixture 3: (3, 0, 7)11Passed
fixture 4: (3, 2, 7)22Passed

SHA-256 / 4b386a4f852ae1630b02234554b3f5855a0c5d73035d8066411edf65e5de8e13

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, k, m):
    return pow(a,k,m) if k>=0 else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, -1, 5)', solve(*(2, -1, 5)), 3)
check('fixture 2: (2, -2, 5)', solve(*(2, -2, 5)), 4)
check('fixture 3: (3, 0, 7)', solve(*(3, 0, 7)), 1)
check('fixture 4: (3, 2, 7)', solve(*(3, 2, 7)), 2)
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: (2, -1, 5)03Failed
fixture 2: (2, -2, 5)04Failed
fixture 3: (3, 0, 7)11Passed
fixture 4: (3, 2, 7)22Passed

SHA-256 / abede09983a2d9ab46ece8b01bb49640781a80b7233c13483179df0ea355983a

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, k, m):
    return pow(a,k,m)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, -1, 5)', solve(*(2, -1, 5)), 3)
check('fixture 2: (2, -2, 5)', solve(*(2, -2, 5)), 4)
check('fixture 3: (3, 0, 7)', solve(*(3, 0, 7)), 1)
check('fixture 4: (3, 2, 7)', solve(*(3, 2, 7)), 2)
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: (2, -1, 5)33Passed
fixture 2: (2, -2, 5)44Passed
fixture 3: (3, 0, 7)11Passed
fixture 4: (3, 2, 7)22Passed

SHA-256 / 93bacfb6342d2c18bb88f77b2a46d10296b6f3e1b350478aaf19850cc486c9d8

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

Case digest / 1d1f3ec92036ac3bd1c52f40f76207dcdc340b386e1cd38b1eaaacc45c174c02