FAILURE MAP
← Case archive

FA-62451 / Tax bracket computation / Open access

A tapered allowance is allowed to go negative · case 01

Very high earners are taxed on more than their income.

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

ROOT CAUSE

The tapered allowance is not floored at zero.

VERIFIED REPAIR

Floor the tapered allowance at 0.

Unsuccessful approach: Zeroing the allowance only above 150000 still leaves negative allowances between 125142 and 150000.

Case contract

solve(income, pension): stipulated allowance taper in whole pounds. Adjusted net income ani = income - pension. The personal allowance 12570 is reduced by 1 for every 2 whole pounds of ani above 100000 (floor of half the excess), never below 0. Taxable = max(0, ani - allowance). Taxable income is taxed 20% up to 37700, 40% from 37700 to 125140, 45% above 125140. Return tax in integer pence.

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

N = 1
observations = []
def solve(income, pension):
    ani = income - pension
    allow = 12570
    if ani > 100000: allow = allow - (ani - 100000) // 2
    taxable = max(0, ani - allow)
    basic = min(taxable, 37700)
    higher = max(0, min(taxable, 125140) - 37700)
    additional = max(0, taxable - 125140)
    return basic * 20 + higher * 40 + additional * 45
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression allowance-floor 1', (140000, 0), 4920300), ('regression allowance-floor 2', (200000, 0), 7620300),
  ('partial repair guard 2', (125143, 0), 4251735), ('control: basic and higher', (50000, 0), 748600),
  ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200),
  ('control: allowance exhausted exactly', (125140, 0), 4251600)],
 [('regression allowance-floor 1', (125143, 0), 4251735), ('regression allowance-floor 2', (125142, 0), 4251690),
  ('partial repair guard 2', (195853, 51587), 5112270), ('control: fully tapered', (200000, 0), 7620300),
  ('control: allowance exhausted exactly', (125140, 0), 4251600), ('control: below allowance', (9000, 0), 0),
  ('control: large pension', (160000, 60000), 2743200)],
 [('regression allowance-floor 1', (286985, 0), 11534625), ('regression allowance-floor 2', (196467, 5000), 7236315),
  ('partial repair guard 1', (127056, 1), 4337775), ('partial repair guard 2', (129722, 1), 4457745),
  ('control: below allowance', (9000, 0), 0), ('control: large pension', (160000, 60000), 2743200),
  ('control: mid taper', (140000, 0), 4920300), ('control: basic and higher', (50000, 0), 748600)],
 [('regression allowance-floor 1', (233138, 36810), 7455060),
  ('regression allowance-floor 2', (260916, 5000), 10136520), ('partial repair guard 1', (128692, 0), 4411440),
  ('partial repair guard 2', (145918, 8578), 4800600), ('control: basic and higher', (50000, 0), 748600),
  ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300)],
 [('regression allowance-floor 1', (291558, 0), 11740410), ('regression allowance-floor 2', (220311, 12207), 7984980),
  ('partial repair guard 1', (127233, 1), 4345740), ('partial repair guard 2', (151401, 22890), 4403295),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 0)]]
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 allowance-floor 152546504920300Failed
regression allowance-floor 293046507620300Failed
partial repair guard 242517804251735Failed
control: basic and higher748600748600Passed
control: odd excess in taper33432403343240Passed
control: pension restores allowance42432004243200Passed
control: allowance exhausted exactly42516004251600Passed

SHA-256 / 24ecf27e54759d48c738e67764743e78605b24e2fd349555e7affbc4a13891a0

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(income, pension):
    ani = income - pension
    allow = 12570
    if ani > 100000: allow = 0 if ani >= 150000 else allow - (ani - 100000) // 2
    taxable = max(0, ani - allow)
    basic = min(taxable, 37700)
    higher = max(0, min(taxable, 125140) - 37700)
    additional = max(0, taxable - 125140)
    return basic * 20 + higher * 40 + additional * 45
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression allowance-floor 1', (140000, 0), 4920300), ('regression allowance-floor 2', (200000, 0), 7620300),
  ('partial repair guard 2', (125143, 0), 4251735), ('control: basic and higher', (50000, 0), 748600),
  ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200),
  ('control: allowance exhausted exactly', (125140, 0), 4251600)],
 [('regression allowance-floor 1', (125143, 0), 4251735), ('regression allowance-floor 2', (125142, 0), 4251690),
  ('partial repair guard 2', (195853, 51587), 5112270), ('control: fully tapered', (200000, 0), 7620300),
  ('control: allowance exhausted exactly', (125140, 0), 4251600), ('control: below allowance', (9000, 0), 0),
  ('control: large pension', (160000, 60000), 2743200)],
 [('regression allowance-floor 1', (286985, 0), 11534625), ('regression allowance-floor 2', (196467, 5000), 7236315),
  ('partial repair guard 1', (127056, 1), 4337775), ('partial repair guard 2', (129722, 1), 4457745),
  ('control: below allowance', (9000, 0), 0), ('control: large pension', (160000, 60000), 2743200),
  ('control: mid taper', (140000, 0), 4920300), ('control: basic and higher', (50000, 0), 748600)],
 [('regression allowance-floor 1', (233138, 36810), 7455060),
  ('regression allowance-floor 2', (260916, 5000), 10136520), ('partial repair guard 1', (128692, 0), 4411440),
  ('partial repair guard 2', (145918, 8578), 4800600), ('control: basic and higher', (50000, 0), 748600),
  ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300)],
 [('regression allowance-floor 1', (291558, 0), 11740410), ('regression allowance-floor 2', (220311, 12207), 7984980),
  ('partial repair guard 1', (127233, 1), 4345740), ('partial repair guard 2', (151401, 22890), 4403295),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 0)]]
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 allowance-floor 152546504920300Failed
regression allowance-floor 276203007620300Passed
partial repair guard 242517804251735Failed
control: basic and higher748600748600Passed
control: odd excess in taper33432403343240Passed
control: pension restores allowance42432004243200Passed
control: allowance exhausted exactly42516004251600Passed

SHA-256 / 0607bf8033ee2937eb54fd891840035d81c25ba96ca79e96aeba635078490217

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(income, pension):
    ani = income - pension
    allow = 12570
    if ani > 100000: allow = max(0, allow - (ani - 100000) // 2)
    taxable = max(0, ani - allow)
    basic = min(taxable, 37700)
    higher = max(0, min(taxable, 125140) - 37700)
    additional = max(0, taxable - 125140)
    return basic * 20 + higher * 40 + additional * 45
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression allowance-floor 1', (140000, 0), 4920300), ('regression allowance-floor 2', (200000, 0), 7620300),
  ('partial repair guard 2', (125143, 0), 4251735), ('control: basic and higher', (50000, 0), 748600),
  ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200),
  ('control: allowance exhausted exactly', (125140, 0), 4251600)],
 [('regression allowance-floor 1', (125143, 0), 4251735), ('regression allowance-floor 2', (125142, 0), 4251690),
  ('partial repair guard 2', (195853, 51587), 5112270), ('control: fully tapered', (200000, 0), 7620300),
  ('control: allowance exhausted exactly', (125140, 0), 4251600), ('control: below allowance', (9000, 0), 0),
  ('control: large pension', (160000, 60000), 2743200)],
 [('regression allowance-floor 1', (286985, 0), 11534625), ('regression allowance-floor 2', (196467, 5000), 7236315),
  ('partial repair guard 1', (127056, 1), 4337775), ('partial repair guard 2', (129722, 1), 4457745),
  ('control: below allowance', (9000, 0), 0), ('control: large pension', (160000, 60000), 2743200),
  ('control: mid taper', (140000, 0), 4920300), ('control: basic and higher', (50000, 0), 748600)],
 [('regression allowance-floor 1', (233138, 36810), 7455060),
  ('regression allowance-floor 2', (260916, 5000), 10136520), ('partial repair guard 1', (128692, 0), 4411440),
  ('partial repair guard 2', (145918, 8578), 4800600), ('control: basic and higher', (50000, 0), 748600),
  ('control: odd excess in taper', (110001, 0), 3343240),
  ('control: pension restores allowance', (130000, 5000), 4243200), ('control: fully tapered', (200000, 0), 7620300)],
 [('regression allowance-floor 1', (291558, 0), 11740410), ('regression allowance-floor 2', (220311, 12207), 7984980),
  ('partial repair guard 1', (127233, 1), 4345740), ('partial repair guard 2', (151401, 22890), 4403295),
  ('control: fully tapered', (200000, 0), 7620300), ('control: allowance exhausted exactly', (125140, 0), 4251600),
  ('control: just beyond exhaustion', (125143, 0), 4251735), ('control: below allowance', (9000, 0), 0)]]
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 allowance-floor 149203004920300Passed
regression allowance-floor 276203007620300Passed
partial repair guard 242517354251735Passed
control: basic and higher748600748600Passed
control: odd excess in taper33432403343240Passed
control: pension restores allowance42432004243200Passed
control: allowance exhausted exactly42516004251600Passed

SHA-256 / 52df35701c6155f0a8384c2f23e5ddb3574e8226ed68bde4917f77b1d7dd9592

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

Case digest / 6343856b86636f4bbfee831898f26c2bee7055c885932d618e623cf907059734