FAILURE MAP
← Case archive

FA-62581 / Tax bracket computation / Open access

Associated companies do not share the limits · case 01

Each company in a group gets the full small-profits limit.

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

ROOT CAUSE

The limits are not divided by associates + 1.

VERIFIED REPAIR

Divide both limits by the number of associated companies plus one.

Unsuccessful approach: Dividing only the upper limit still gives each company the full lower limit.

Case contract

solve(profits, dividends, associates, days): stipulated small-profits relief. Limits L = 50000 and U = 250000 are divided by (associates + 1) and prorated by days/365 (exact fractions). Augmented profits A = profits + dividends decide the band: A <= L taxes profits N at 19%; A >= U at 25%; otherwise tax = 25% of N minus 3/200 * (U - A) * N / A. Return integer cents rounded half-up.

Why this case matters

Tax computations hinge on which slice, threshold, ordering and rounding rule applies at each step; a misplaced boundary silently misstates liabilities.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(profits, dividends, associates, days):
    def prog(x, br):
        tax, lower = Fraction(0), 0
        for upper, rate in br:
            top = x if upper is None else min(x, upper)
            if top > lower: tax += (top - lower) * Fraction(rate) / 100
            if upper is None or x <= upper: break
            lower = upper
        return tax
    def cents(v):
        v = v * 100
        return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
    
    div = 1
    L = Fraction(50000 * days, 365 * div)
    U = Fraction(250000 * days, 365 * div)
    A = profits + dividends
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A) * N / A
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression associated-divisor 1', (60000, 0, 1, 365), 1402500),
  ('regression associated-divisor 2', (70000, 5000, 2, 200), 1750000),
  ('partial repair guard 1', (30000, 0, 1, 365), 607500), ('partial repair guard 2', (30000, 0, 4, 300), 733356),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression associated-divisor 1', (100000, 5000, 1, 365), 2471429),
  ('regression associated-divisor 2', (100000, 0, 4, 300), 2500000),
  ('partial repair guard 1', (30000, 0, 2, 365), 670000), ('partial repair guard 2', (50000, 0, 4, 365), 1250000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000)],
 [('regression associated-divisor 1', (180000, 25000, 2, 300), 4500000),
  ('regression associated-divisor 2', (180000, 0, 4, 365), 4500000),
  ('partial repair guard 1', (50000, 0, 1, 365), 1137500), ('partial repair guard 2', (50000, 0, 2, 365), 1200000),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000)],
 [('regression associated-divisor 1', (30000, 25000, 4, 365), 750000),
  ('regression associated-divisor 2', (50000, 0, 2, 181), 1250000),
  ('partial repair guard 1', (30000, 0, 2, 300), 692260), ('partial repair guard 2', (30000, 5000, 1, 365), 634286),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression associated-divisor 1', (50000, 0, 2, 90), 1250000),
  ('regression associated-divisor 2', (50000, 0, 1, 300), 1170890),
  ('partial repair guard 1', (30000, 0, 1, 365), 607500), ('partial repair guard 2', (30000, 0, 4, 300), 733356),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
for label, args, expected in cases[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
regression associated-divisor 112150001402500Failed
regression associated-divisor 216632191750000Failed
partial repair guard 1570000607500Failed
partial repair guard 2570000733356Failed
control: small profits760000760000Passed
control: relief zone22750002275000Passed
control: main rate75000007500000Passed
control: with dividends23500002350000Passed

SHA-256 / 47c3ea2009a96c3d78d1aa3eb135973bac2f158d5a6244ce78a9bbae834c93fe

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(profits, dividends, associates, days):
    def prog(x, br):
        tax, lower = Fraction(0), 0
        for upper, rate in br:
            top = x if upper is None else min(x, upper)
            if top > lower: tax += (top - lower) * Fraction(rate) / 100
            if upper is None or x <= upper: break
            lower = upper
        return tax
    def cents(v):
        v = v * 100
        return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
    
    div = associates + 1
    L = Fraction(50000 * days, 365)
    U = Fraction(250000 * days, 365 * div)
    A = profits + dividends
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A) * N / A
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression associated-divisor 1', (60000, 0, 1, 365), 1402500),
  ('regression associated-divisor 2', (70000, 5000, 2, 200), 1750000),
  ('partial repair guard 1', (30000, 0, 1, 365), 607500), ('partial repair guard 2', (30000, 0, 4, 300), 733356),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression associated-divisor 1', (100000, 5000, 1, 365), 2471429),
  ('regression associated-divisor 2', (100000, 0, 4, 300), 2500000),
  ('partial repair guard 1', (30000, 0, 2, 365), 670000), ('partial repair guard 2', (50000, 0, 4, 365), 1250000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000)],
 [('regression associated-divisor 1', (180000, 25000, 2, 300), 4500000),
  ('regression associated-divisor 2', (180000, 0, 4, 365), 4500000),
  ('partial repair guard 1', (50000, 0, 1, 365), 1137500), ('partial repair guard 2', (50000, 0, 2, 365), 1200000),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000)],
 [('regression associated-divisor 1', (30000, 25000, 4, 365), 750000),
  ('regression associated-divisor 2', (50000, 0, 2, 181), 1250000),
  ('partial repair guard 1', (30000, 0, 2, 300), 692260), ('partial repair guard 2', (30000, 5000, 1, 365), 634286),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression associated-divisor 1', (50000, 0, 2, 90), 1250000),
  ('regression associated-divisor 2', (50000, 0, 1, 300), 1170890),
  ('partial repair guard 1', (30000, 0, 1, 365), 607500), ('partial repair guard 2', (30000, 0, 4, 300), 733356),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
for label, args, expected in cases[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
regression associated-divisor 114025001402500Passed
regression associated-divisor 217500001750000Passed
partial repair guard 1570000607500Failed
partial repair guard 2570000733356Failed
control: small profits760000760000Passed
control: relief zone22750002275000Passed
control: main rate75000007500000Passed
control: with dividends23500002350000Passed

SHA-256 / b128311d818476c08250450e4b3eb47c283fc7dd9e0bc50807359f24b59d0854

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(profits, dividends, associates, days):
    def prog(x, br):
        tax, lower = Fraction(0), 0
        for upper, rate in br:
            top = x if upper is None else min(x, upper)
            if top > lower: tax += (top - lower) * Fraction(rate) / 100
            if upper is None or x <= upper: break
            lower = upper
        return tax
    def cents(v):
        v = v * 100
        return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
    
    div = associates + 1
    L = Fraction(50000 * days, 365 * div)
    U = Fraction(250000 * days, 365 * div)
    A = profits + dividends
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A) * N / A
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression associated-divisor 1', (60000, 0, 1, 365), 1402500),
  ('regression associated-divisor 2', (70000, 5000, 2, 200), 1750000),
  ('partial repair guard 1', (30000, 0, 1, 365), 607500), ('partial repair guard 2', (30000, 0, 4, 300), 733356),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000),
  ('control: main rate', (300000, 0, 0, 365), 7500000), ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression associated-divisor 1', (100000, 5000, 1, 365), 2471429),
  ('regression associated-divisor 2', (100000, 0, 4, 300), 2500000),
  ('partial repair guard 1', (30000, 0, 2, 365), 670000), ('partial repair guard 2', (50000, 0, 4, 365), 1250000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000)],
 [('regression associated-divisor 1', (180000, 25000, 2, 300), 4500000),
  ('regression associated-divisor 2', (180000, 0, 4, 365), 4500000),
  ('partial repair guard 1', (50000, 0, 1, 365), 1137500), ('partial repair guard 2', (50000, 0, 2, 365), 1200000),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000)],
 [('regression associated-divisor 1', (30000, 25000, 4, 365), 750000),
  ('regression associated-divisor 2', (50000, 0, 2, 181), 1250000),
  ('partial repair guard 1', (30000, 0, 2, 300), 692260), ('partial repair guard 2', (30000, 5000, 1, 365), 634286),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression associated-divisor 1', (50000, 0, 2, 90), 1250000),
  ('regression associated-divisor 2', (50000, 0, 1, 300), 1170890),
  ('partial repair guard 1', (30000, 0, 1, 365), 607500), ('partial repair guard 2', (30000, 0, 4, 300), 733356),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
for label, args, expected in cases[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
regression associated-divisor 114025001402500Passed
regression associated-divisor 217500001750000Passed
partial repair guard 1607500607500Passed
partial repair guard 2733356733356Passed
control: small profits760000760000Passed
control: relief zone22750002275000Passed
control: main rate75000007500000Passed
control: with dividends23500002350000Passed

SHA-256 / e5f57f933b2fc52fd8a228f8bf5d6819126a1639229caab4c1a591b3ad049446

Verification & scope

A deterministic, bounded teaching model with a stipulated toy contract; it makes no claim of conformance to any real regulation, standard, or institution's rules. 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:47:05.972977+00:00.

Case digest / cddb9606bb00bf3409eb4b59a78996a0e4ac46f69c8a649bc1894bf5b2e596ab