FAILURE MAP
← Case archive

FA-14366 / Numerics / Open access

Linear congruence solutions: solvability · case 01

The exact linear congruence solutions result violates the stated contract at solvability.

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

ROOT CAUSE

The solvability step uses b != 0 instead of b%g != 0.

THE FAILURE

The solvability step uses b != 0 instead of b%g != 0.

Unsuccessful approach: The partial repair b%m != 0 still violates the solvability invariant.

Case contract

Input [a,b,m], m>0; sorted all x in [0,m) with a*x congruent b modulo m.

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    a,b,m=x
    g=math.gcd(a,m)
    if b != 0: return []
    q=m//g
    r=((b//g)*pow(a//g,-1,q))%q if q>1 else 0
    return sorted(r+k*q for k in range(g))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, -6, 1], [0]), ([1, -6, 4], [2]), ([11, 6, 12], [6]), ([1, -6, 2], [0]), ([1, -6, 3], [0]), ([1, -6, 5], [4]), ([1, -6, 6], [0]), ([1, -6, 7], [1])], [([1, -6, 2], [0]), ([1, -6, 8], [2]), ([1, -6, 1], [0]), ([11, 6, 12], [6]), ([1, -5, 6], [1]), ([1, -5, 7], [2]), ([1, -5, 8], [3]), ([1, -5, 9], [4])], [([1, -6, 3], [0]), ([1, -6, 11], [5]), ([1, -6, 1], [0]), ([11, 6, 12], [6]), ([1, -4, 11], [7]), ([1, -4, 12], [8]), ([1, -3, 1], [0]), ([1, -3, 2], [1])], [([1, -6, 4], [2]), ([1, -5, 3], [1]), ([1, -6, 1], [0]), ([11, 6, 12], [6]), ([1, -2, 4], [2]), ([1, -2, 5], [3]), ([1, -2, 6], [4]), ([1, -2, 7], [5])], [([1, -6, 5], [4]), ([1, -5, 7], [2]), ([1, -6, 1], [0]), ([11, 6, 12], [6]), ([1, -1, 9], [8]), ([1, -1, 10], [9]), ([1, -1, 11], [10]), ([1, -1, 12], [11])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 0[][0]Failed
explicit oracle 1[][2]Failed
explicit oracle 2[][6]Failed
explicit oracle 3[][0]Failed
explicit oracle 4[][0]Failed
explicit oracle 5[][4]Failed
explicit oracle 6[][0]Failed
explicit oracle 7[][1]Failed

SHA-256 / b3a532a22af9d570aa97fef4493209d9f42ffe8e6c8e80891aaa1f97fe312e49

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    a,b,m=x
    g=math.gcd(a,m)
    if b%m != 0: return []
    q=m//g
    r=((b//g)*pow(a//g,-1,q))%q if q>1 else 0
    return sorted(r+k*q for k in range(g))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, -6, 1], [0]), ([1, -6, 4], [2]), ([11, 6, 12], [6]), ([1, -6, 2], [0]), ([1, -6, 3], [0]), ([1, -6, 5], [4]), ([1, -6, 6], [0]), ([1, -6, 7], [1])], [([1, -6, 2], [0]), ([1, -6, 8], [2]), ([1, -6, 1], [0]), ([11, 6, 12], [6]), ([1, -5, 6], [1]), ([1, -5, 7], [2]), ([1, -5, 8], [3]), ([1, -5, 9], [4])], [([1, -6, 3], [0]), ([1, -6, 11], [5]), ([1, -6, 1], [0]), ([11, 6, 12], [6]), ([1, -4, 11], [7]), ([1, -4, 12], [8]), ([1, -3, 1], [0]), ([1, -3, 2], [1])], [([1, -6, 4], [2]), ([1, -5, 3], [1]), ([1, -6, 1], [0]), ([11, 6, 12], [6]), ([1, -2, 4], [2]), ([1, -2, 5], [3]), ([1, -2, 6], [4]), ([1, -2, 7], [5])], [([1, -6, 5], [4]), ([1, -5, 7], [2]), ([1, -6, 1], [0]), ([11, 6, 12], [6]), ([1, -1, 9], [8]), ([1, -1, 10], [9]), ([1, -1, 11], [10]), ([1, -1, 12], [11])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 0[0][0]Passed
explicit oracle 1[][2]Failed
explicit oracle 2[][6]Failed
explicit oracle 3[0][0]Passed
explicit oracle 4[0][0]Passed
explicit oracle 5[][4]Failed
explicit oracle 6[0][0]Passed
explicit oracle 7[][1]Failed

SHA-256 / cf8a655e7e0c2fc3eb2a9fbdbb13ab6532f0f8e65a79b59ba7ed6774d373fe84

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. 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:39:16.223138+00:00.

Case digest / 681029457eaa872caf9daf6326c1474f9cdc4e56e61111337d14eae34f4c87f0