FA-62631 / Tax bracket computation / Open access
The benefit cap is applied per extra part instead of per extra half-part · case 01
Each child's half-part is capped at half the stipulated amount.
ROOT CAUSE
The cap uses 1759 per full extra part (extra_halves / 2).
VERIFIED REPAIR
Allow 1759 per extra half-part.
Unsuccessful approach: Flooring the extra halves to whole parts ignores an odd half-part entirely.
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 * Fraction(halves - 2 * base, 2)
return int(max(full, capped))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression cap-unit 1', (80000, 6, True), 7054), ('regression cap-unit 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-unit 1', (250000, 8, True), 63921), ('regression cap-unit 2', (40000, 7, False), 51),
('partial repair guard 1', (30000, 5, True), 194), ('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-unit 1', (150000, 6, True), 28054), ('regression cap-unit 2', (80000, 6, False), 10250),
('partial repair guard 1', (40000, 7, False), 51), ('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-unit 1', (193969, 6, True), 44466), ('regression cap-unit 2', (150000, 8, True), 24536),
('partial repair guard 1', (80000, 6, False), 10250), ('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-unit 1', (80000, 8, False), 6732), ('regression cap-unit 2', (274066, 8, True), 73788),
('partial repair guard 1', (150000, 8, True), 24536), ('partial repair guard 2', (40000, 5, True), 1294),
('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-unit 1 | 8813 | 7054 | Failed |
| regression cap-unit 2 | 10406 | 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 / b2426cab50e85f3681b6ed7e123c1fffb0b6d2dda717b021d56c52415e30e140
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) // 2)
return int(max(full, capped))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression cap-unit 1', (80000, 6, True), 7054), ('regression cap-unit 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-unit 1', (250000, 8, True), 63921), ('regression cap-unit 2', (40000, 7, False), 51),
('partial repair guard 1', (30000, 5, True), 194), ('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-unit 1', (150000, 6, True), 28054), ('regression cap-unit 2', (80000, 6, False), 10250),
('partial repair guard 1', (40000, 7, False), 51), ('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-unit 1', (193969, 6, True), 44466), ('regression cap-unit 2', (150000, 8, True), 24536),
('partial repair guard 1', (80000, 6, False), 10250), ('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-unit 1', (80000, 8, False), 6732), ('regression cap-unit 2', (274066, 8, True), 73788),
('partial repair guard 1', (150000, 8, True), 24536), ('partial repair guard 2', (40000, 5, True), 1294),
('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-unit 1 | 8813 | 7054 | Failed |
| regression cap-unit 2 | 11286 | 9527 | Failed |
| control: single one part | 5286 | 5286 | Passed |
| control: couple two parts | 10572 | 10572 | Passed |
| control: low income family | 815 | 194 | Failed |
| control: too few parts | ERR:parts | ERR:parts | Passed |
SHA-256 / 82da8a57c31a488ad529e865379ebe52b502a06870c7cddfe5ebabaaa1fe3f54
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-unit 1', (80000, 6, True), 7054), ('regression cap-unit 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-unit 1', (250000, 8, True), 63921), ('regression cap-unit 2', (40000, 7, False), 51),
('partial repair guard 1', (30000, 5, True), 194), ('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-unit 1', (150000, 6, True), 28054), ('regression cap-unit 2', (80000, 6, False), 10250),
('partial repair guard 1', (40000, 7, False), 51), ('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-unit 1', (193969, 6, True), 44466), ('regression cap-unit 2', (150000, 8, True), 24536),
('partial repair guard 1', (80000, 6, False), 10250), ('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-unit 1', (80000, 8, False), 6732), ('regression cap-unit 2', (274066, 8, True), 73788),
('partial repair guard 1', (150000, 8, True), 24536), ('partial repair guard 2', (40000, 5, True), 1294),
('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-unit 1 | 7054 | 7054 | Passed |
| regression cap-unit 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 / 93e1eb0dd6c7dcd41ecbb5f329a29835e903f5bc074292c1cedc399d86dfaf7a
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.500133+00:00.
Case digest / 27e200282d163c055718bd87034f27bc3bc359858ce6a9d5556d1b86a0b2fc4e