FA-62626 / Tax bracket computation / Open access
The half-part benefit cap lowers tax instead of limiting the benefit · case 01
Families with extra parts pay less than the capped amount.
ROOT CAUSE
The result is min(full, capped) instead of max(full, capped).
VERIFIED REPAIR
Take the larger of the full-quotient tax and the capped tax.
Unsuccessful approach: Applying the cap only beyond two extra half-parts ignores it for smaller families.
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 p * prog(Fraction(income) / p, scale)
full = tax_for(Fraction(halves, 2))
capped = tax_for(Fraction(base)) - 1759 * (halves - 2 * base)
return int(min(full, capped))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression cap-direction 1', (80000, 6, True), 7054), ('regression cap-direction 2', (60000, 3, False), 9527),
('control: single one part', (40000, 2, False), 5286), ('control: couple two parts', (80000, 4, True), 10572),
('control: low income family', (30000, 5, True), 194), ('control: too few parts', (50000, 3, True), 'ERR:parts')],
[('regression cap-direction 1', (30000, 5, True), 194), ('regression cap-direction 2', (250000, 8, True), 63921),
('partial repair guard 1', (150000, 6, True), 28054), ('partial repair guard 2', (193969, 6, True), 44466),
('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 cap-direction 1', (40000, 7, False), 51), ('regression cap-direction 2', (40000, 8, True), 0),
('partial repair guard 1', (150000, 4, False), 42210), ('partial repair guard 2', (70423, 3, False), 12654),
('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),
('control: couple with two children', (80000, 6, True), 7054)],
[('regression cap-direction 1', (150000, 6, True), 28054), ('regression cap-direction 2', (16143, 5, False), 0),
('partial repair guard 1', (287118, 5, True), 84416), ('partial repair guard 2', (247910, 5, True), 68341),
('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 cap-direction 1', (80000, 6, False), 10250), ('regression cap-direction 2', (193969, 6, True), 44466),
('partial repair guard 1', (80000, 4, False), 13768), ('partial repair guard 2', (80000, 3, False), 15527),
('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression cap-direction 1 | 5072 | 7054 | Failed |
| regression cap-direction 2 | 7929 | 9527 | Failed |
| control: single one part | 5286 | 5286 | Passed |
| control: couple two parts | 10572 | 10572 | Passed |
| control: low income family | -943 | 194 | Failed |
| control: too few parts | ERR:parts | ERR:parts | Passed |
SHA-256 / ba9d5604f834540ce36e0b73c22a12aa7112b458337ad7c78ddb6a12fc46633f
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 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) if halves - 2 * base > 2 else full)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression cap-direction 1', (80000, 6, True), 7054), ('regression cap-direction 2', (60000, 3, False), 9527),
('control: single one part', (40000, 2, False), 5286), ('control: couple two parts', (80000, 4, True), 10572),
('control: low income family', (30000, 5, True), 194), ('control: too few parts', (50000, 3, True), 'ERR:parts')],
[('regression cap-direction 1', (30000, 5, True), 194), ('regression cap-direction 2', (250000, 8, True), 63921),
('partial repair guard 1', (150000, 6, True), 28054), ('partial repair guard 2', (193969, 6, True), 44466),
('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 cap-direction 1', (40000, 7, False), 51), ('regression cap-direction 2', (40000, 8, True), 0),
('partial repair guard 1', (150000, 4, False), 42210), ('partial repair guard 2', (70423, 3, False), 12654),
('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),
('control: couple with two children', (80000, 6, True), 7054)],
[('regression cap-direction 1', (150000, 6, True), 28054), ('regression cap-direction 2', (16143, 5, False), 0),
('partial repair guard 1', (287118, 5, True), 84416), ('partial repair guard 2', (247910, 5, True), 68341),
('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 cap-direction 1', (80000, 6, False), 10250), ('regression cap-direction 2', (193969, 6, True), 44466),
('partial repair guard 1', (80000, 4, False), 13768), ('partial repair guard 2', (80000, 3, False), 15527),
('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression cap-direction 1 | 5072 | 7054 | Failed |
| regression cap-direction 2 | 7929 | 9527 | Failed |
| control: single one part | 5286 | 5286 | Passed |
| control: couple two parts | 10572 | 10572 | Passed |
| control: low income family | 194 | 194 | Passed |
| control: too few parts | ERR:parts | ERR:parts | Passed |
SHA-256 / dab705bdba62dd97b1f31c69d53a1e5ecaca5fed92dd4719903b37c9191a44f8
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(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 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 cap-direction 1', (80000, 6, True), 7054), ('regression cap-direction 2', (60000, 3, False), 9527),
('control: single one part', (40000, 2, False), 5286), ('control: couple two parts', (80000, 4, True), 10572),
('control: low income family', (30000, 5, True), 194), ('control: too few parts', (50000, 3, True), 'ERR:parts')],
[('regression cap-direction 1', (30000, 5, True), 194), ('regression cap-direction 2', (250000, 8, True), 63921),
('partial repair guard 1', (150000, 6, True), 28054), ('partial repair guard 2', (193969, 6, True), 44466),
('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 cap-direction 1', (40000, 7, False), 51), ('regression cap-direction 2', (40000, 8, True), 0),
('partial repair guard 1', (150000, 4, False), 42210), ('partial repair guard 2', (70423, 3, False), 12654),
('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),
('control: couple with two children', (80000, 6, True), 7054)],
[('regression cap-direction 1', (150000, 6, True), 28054), ('regression cap-direction 2', (16143, 5, False), 0),
('partial repair guard 1', (287118, 5, True), 84416), ('partial repair guard 2', (247910, 5, True), 68341),
('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 cap-direction 1', (80000, 6, False), 10250), ('regression cap-direction 2', (193969, 6, True), 44466),
('partial repair guard 1', (80000, 4, False), 13768), ('partial repair guard 2', (80000, 3, False), 15527),
('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression cap-direction 1 | 7054 | 7054 | Passed |
| regression cap-direction 2 | 9527 | 9527 | Passed |
| control: single one part | 5286 | 5286 | Passed |
| control: couple two parts | 10572 | 10572 | Passed |
| control: low income family | 194 | 194 | Passed |
| control: too few parts | ERR:parts | ERR:parts | Passed |
SHA-256 / d390b1267b6eb0b13ac7fd9064a8ca829eff549cde0c0220f5865d4d7a380c88
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.417704+00:00.
Case digest / c6a23f2d4ac49fec914b279be69f318f1682e34ce020ff2aa372875f293dfa60