FA-5401 / Integer arithmetic / Open access
Clear lowest set bit · case 01
Subtracting one also sets trailing zero bits.
ROOT CAUSE
Subtracting one also sets trailing zero bits.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return n & (n-1)
Unsuccessful approach: Incrementing clears a run of low one bits rather than one set bit.
Case contract
Integer arguments; denominators, steps, moduli, and bit widths are positive. Unsigned word inputs fit the specified width except where masking is explicitly the operation. Sequence sizes are nonnegative. n is nonnegative; clear exactly its least significant one, or return zero for zero. Exact operational definition: n & (n-1)
Why this case matters
Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Integer mathematics 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-1
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (12,)', solve(*(12,)), 8)
check('fixture 2: (8,)', solve(*(8,)), 0)
check('fixture 3: (0,)', solve(*(0,)), 0)
check('fixture 4: (7,)', solve(*(7,)), 6)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (12,) | 11 | 8 | Failed |
| fixture 2: (8,) | 7 | 0 | Failed |
| fixture 3: (0,) | -1 | 0 | Failed |
| fixture 4: (7,) | 6 | 6 | Passed |
SHA-256 / 9df00322629c62f1cf1ce6fdbc3d61a39c0255ee9cf7bd61776406303027cdb9
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+1)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (12,)', solve(*(12,)), 8)
check('fixture 2: (8,)', solve(*(8,)), 0)
check('fixture 3: (0,)', solve(*(0,)), 0)
check('fixture 4: (7,)', solve(*(7,)), 6)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (12,) | 12 | 8 | Failed |
| fixture 2: (8,) | 8 | 0 | Failed |
| fixture 3: (0,) | 0 | 0 | Passed |
| fixture 4: (7,) | 0 | 6 | Failed |
SHA-256 / e247945ab2ddcbab29e682c8b134edd9688e57b28575692088c5e518b4821c24
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(n):
return n & (n-1)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (12,)', solve(*(12,)), 8)
check('fixture 2: (8,)', solve(*(8,)), 0)
check('fixture 3: (0,)', solve(*(0,)), 0)
check('fixture 4: (7,)', solve(*(7,)), 6)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: (12,) | 8 | 8 | Passed |
| fixture 2: (8,) | 0 | 0 | Passed |
| fixture 3: (0,) | 0 | 0 | Passed |
| fixture 4: (7,) | 6 | 6 | Passed |
SHA-256 / 9f77c26742fbecf660dc5bce1079e41da12bdeab716a6f64e1f3b8267f0b7e1c
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:49.183235+00:00.
Case digest / cd536b92ec5306b82df5023afbf78b7aa3a7fadbb7cf65a8a8517573ead11859