FAILURE MAP
← Case archive

FA-62621 / Tax bracket computation / Open access

The tax on the per-part quotient is not multiplied back by the parts · case 01

A couple's tax is roughly halved.

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

ROOT CAUSE

tax_for returns T(income/p) instead of p * T(income/p).

THE FAILURE

tax_for returns T(income/p) instead of p * T(income/p).

Unsuccessful approach: Multiplying by the number of half-parts doubles the household tax.

Case contract

solve(income, halves, couple): stipulated household quotient. Parts p = halves/2; the base is 2 parts for a couple and 1 otherwise (fewer halves than the base returns 'ERR:parts'). Tax with all parts = p * T(income/p) using slices 0% to 11294, 11% to 28797, 30% to 82341, 41% to 177106, 45% above. The benefit of each half-part beyond the base is capped at 1759: tax = max(full, T_base - 1759 * extra_halves) where T_base = base * T(income/base). Return whole units rounded down.

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(income, halves, couple):
    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))
    
    base = 2 if couple else 1
    if halves < 2 * base: return 'ERR:parts'
    scale = [[11294, '0'], [28797, '11'], [82341, '30'], [177106, '41'], [None, '45']]
    def tax_for(p): return prog(Fraction(income) / p, scale)
    full = tax_for(Fraction(halves, 2))
    capped = tax_for(Fraction(base)) - 1759 * (halves - 2 * base)
    return int(max(full, capped))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression quotient-multiplier 1', (80000, 4, True), 10572),
  ('regression quotient-multiplier 2', (80000, 6, True), 7054), ('partial repair guard 2', (40000, 2, False), 5286),
  ('control: low income family', (30000, 5, True), 194), ('control: too few parts', (50000, 3, True), 'ERR:parts'),
  ('control: single parent', (60000, 3, False), 9527),
  ('control: large family high income', (250000, 8, True), 63921)],
 [('regression quotient-multiplier 1', (30000, 5, True), 194),
  ('regression quotient-multiplier 2', (250000, 8, True), 63921), ('partial repair guard 1', (80000, 6, True), 7054),
  ('control: too few parts', (50000, 3, True), 'ERR:parts'), ('control: single parent', (60000, 3, False), 9527),
  ('control: single one part', (40000, 2, False), 5286), ('control: couple two parts', (80000, 4, True), 10572)],
 [('regression quotient-multiplier 1', (40000, 7, False), 51),
  ('regression quotient-multiplier 2', (150000, 6, True), 28054), ('partial repair guard 1', (60000, 3, False), 9527),
  ('partial repair guard 2', (250000, 8, True), 63921), ('control: single one part', (40000, 2, False), 5286),
  ('control: couple two parts', (80000, 4, True), 10572), ('control: couple with two children', (80000, 6, True), 7054),
  ('control: low income family', (30000, 5, True), 194)],
 [('regression quotient-multiplier 1', (150000, 4, True), 31572),
  ('regression quotient-multiplier 2', (193969, 6, True), 44466), ('partial repair guard 1', (40000, 7, False), 51),
  ('partial repair guard 2', (150000, 6, True), 28054), ('control: couple with two children', (80000, 6, True), 7054),
  ('control: low income family', (30000, 5, True), 194), ('control: too few parts', (50000, 3, True), 'ERR:parts'),
  ('control: single parent', (60000, 3, False), 9527)],
 [('regression quotient-multiplier 1', (150000, 8, True), 24536),
  ('regression quotient-multiplier 2', (40000, 5, True), 1294), ('partial repair guard 1', (80000, 6, False), 10250),
  ('partial repair guard 2', (150000, 4, True), 31572), ('control: single parent', (60000, 3, False), 9527),
  ('control: large family high income', (250000, 8, True), 63921),
  ('control: single one part', (40000, 2, False), 5286), ('control: couple two parts', (80000, 4, True), 10572)]]
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 quotient-multiplier 1528610572Failed
regression quotient-multiplier 217687054Failed
partial repair guard 252865286Passed
control: low income family77194Failed
control: too few partsERR:partsERR:partsPassed
control: single parent95279527Passed
control: large family high income2844263921Failed

SHA-256 / 9e24f12f0b028a65d386322186fb6a093bfc37d3f270153fa02d3ab648ea2552

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(income, halves, couple):
    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))
    
    base = 2 if couple else 1
    if halves < 2 * base: return 'ERR:parts'
    scale = [[11294, '0'], [28797, '11'], [82341, '30'], [177106, '41'], [None, '45']]
    def tax_for(p): return 2 * p * prog(Fraction(income) / p, scale)
    full = tax_for(Fraction(halves, 2))
    capped = tax_for(Fraction(base)) - 1759 * (halves - 2 * base)
    return int(max(full, capped))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression quotient-multiplier 1', (80000, 4, True), 10572),
  ('regression quotient-multiplier 2', (80000, 6, True), 7054), ('partial repair guard 2', (40000, 2, False), 5286),
  ('control: low income family', (30000, 5, True), 194), ('control: too few parts', (50000, 3, True), 'ERR:parts'),
  ('control: single parent', (60000, 3, False), 9527),
  ('control: large family high income', (250000, 8, True), 63921)],
 [('regression quotient-multiplier 1', (30000, 5, True), 194),
  ('regression quotient-multiplier 2', (250000, 8, True), 63921), ('partial repair guard 1', (80000, 6, True), 7054),
  ('control: too few parts', (50000, 3, True), 'ERR:parts'), ('control: single parent', (60000, 3, False), 9527),
  ('control: single one part', (40000, 2, False), 5286), ('control: couple two parts', (80000, 4, True), 10572)],
 [('regression quotient-multiplier 1', (40000, 7, False), 51),
  ('regression quotient-multiplier 2', (150000, 6, True), 28054), ('partial repair guard 1', (60000, 3, False), 9527),
  ('partial repair guard 2', (250000, 8, True), 63921), ('control: single one part', (40000, 2, False), 5286),
  ('control: couple two parts', (80000, 4, True), 10572), ('control: couple with two children', (80000, 6, True), 7054),
  ('control: low income family', (30000, 5, True), 194)],
 [('regression quotient-multiplier 1', (150000, 4, True), 31572),
  ('regression quotient-multiplier 2', (193969, 6, True), 44466), ('partial repair guard 1', (40000, 7, False), 51),
  ('partial repair guard 2', (150000, 6, True), 28054), ('control: couple with two children', (80000, 6, True), 7054),
  ('control: low income family', (30000, 5, True), 194), ('control: too few parts', (50000, 3, True), 'ERR:parts'),
  ('control: single parent', (60000, 3, False), 9527)],
 [('regression quotient-multiplier 1', (150000, 8, True), 24536),
  ('regression quotient-multiplier 2', (40000, 5, True), 1294), ('partial repair guard 1', (80000, 6, False), 10250),
  ('partial repair guard 2', (150000, 4, True), 31572), ('control: single parent', (60000, 3, False), 9527),
  ('control: large family high income', (250000, 8, True), 63921),
  ('control: single one part', (40000, 2, False), 5286), ('control: couple two parts', (80000, 4, True), 10572)]]
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 quotient-multiplier 12114410572Failed
regression quotient-multiplier 2176267054Failed
partial repair guard 2105725286Failed
control: low income family388194Failed
control: too few partsERR:partsERR:partsPassed
control: single parent208139527Failed
control: large family high income13487863921Failed

SHA-256 / 63f898a96c55aa50f579302056ffecfae5082d4c3737bd20efb3653ff618efa6

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 7 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 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:06.343380+00:00.

Case digest / 830ad8e3c4d599583aa78f8293316b72dd6132e922cc06555b258fd430d37d25