FA-62941 / Insurance premium rating / Open access
Increased limits factor layer pricing: Layer top ignores the attachment point · case 01
Excess layers are priced as if they ended at the layer width.
ROOT CAUSE
The upper ILF is evaluated at the layer limit rather than attachment plus limit.
VERIFIED REPAIR
Evaluate the upper factor at attachment + layer limit.
Unsuccessful approach: Using the larger of attachment and limit still loses the layer top.
Case contract
Input basic (premium at basic limit), ilf table [[limit, factor*1000]] ascending, attachment, layer_limit. ILF(0)=0 and ILF is linear between tabulated points (including from 0 to the basic limit); limits above the table are unrated. Layer premium = floor(basic*(ILF(att+lim)-ILF(att))/1000+1/2). layer_limit<=0 or attachment<0 -> 'invalid'.
Why this case matters
Premium rating engines apply ordered tabular rules where one misplaced boundary or step silently misprices policies.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
if x['layer_limit']<=0 or x['attachment']<0: return 'invalid'
tab=[[0,0]]+x['ilf']
def ilf(L):
if L>tab[-1][0]: return None
for (l0,f0),(l1,f1) in zip(tab,tab[1:]):
if l0<=L<=l1:
return f0+Fraction(f1-f0)*(L-l0)/(l1-l0)
top=ilf(x['layer_limit']); bot=ilf(x['attachment'])
if top is None or bot is None: return 'unrated'
return math.floor(x['basic']*(top-bot)/1000+Fraction(1,2))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['primary basic limit', {'basic': 43747, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 100000}, 43747], ['primary interpolated limit', {'basic': 104803, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 375000}, 150130], ['excess layer 500 xs 500', {'basic': 91047, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 500000, 'layer_limit': 500000}, 22944], ['excess layer interpolated', {'basic': 74589, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 130000, 'layer_limit': 650000}, 47298], ['layer up to maximum', {'basic': 60555, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1000000, 'layer_limit': 1000000}, 14897], ['layer beyond maximum', {'basic': 100477, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 110006, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 60000}, 66004], ['zero width layer rejected', {'basic': 64657, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 109079, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 61004, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 750000}, 30319]], [['primary basic limit', {'basic': 83688, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 100000}, 83688], ['primary interpolated limit', {'basic': 62537, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 400000}, 91554], ['excess layer 500 xs 500', {'basic': 72974, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 500000, 'layer_limit': 500000}, 18535], ['excess layer interpolated', {'basic': 96963, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 180000, 'layer_limit': 310000}, 36820], ['layer up to maximum', {'basic': 51640, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1000000, 'layer_limit': 1000000}, 12497], ['layer beyond maximum', {'basic': 96337, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 80166, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 25000}, 20042], ['zero width layer rejected', {'basic': 40984, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 99315, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 88492, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 750000}, 43715]], [['primary basic limit', {'basic': 103077, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 100000}, 103077], ['primary interpolated limit', {'basic': 75700, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 410000}, 112066], ['excess layer 500 xs 500', {'basic': 91514, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 500000, 'layer_limit': 500000}, 23428], ['excess layer interpolated', {'basic': 116014, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 180000, 'layer_limit': 330000}, 45723], ['layer up to maximum', {'basic': 104427, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1000000, 'layer_limit': 1000000}, 24854], ['layer beyond maximum', {'basic': 94873, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 82268, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 75000}, 61701], ['zero width layer rejected', {'basic': 98050, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105611, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 93132, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 750000}, 45728]], [['primary basic limit', {'basic': 99090, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 100000}, 99090], ['primary interpolated limit', {'basic': 69051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 470000}, 106504], ['excess layer 500 xs 500', {'basic': 103830, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 500000, 'layer_limit': 500000}, 26788], ['excess layer interpolated', {'basic': 41042, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 130000, 'layer_limit': 300000}, 17960], ['layer up to maximum', {'basic': 69534, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1000000, 'layer_limit': 1000000}, 16271], ['layer beyond maximum', {'basic': 116762, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 119876, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 60000}, 71926], ['zero width layer rejected', {'basic': 54051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 49440, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 49001, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 750000}, 23912]], [['primary basic limit', {'basic': 88505, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 100000}, 88505], ['primary interpolated limit', {'basic': 109050, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 315000}, 153597], ['excess layer 500 xs 500', {'basic': 53196, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 500000, 'layer_limit': 500000}, 13831], ['excess layer interpolated', {'basic': 106149, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 230000, 'layer_limit': 370000}, 34357], ['layer up to maximum', {'basic': 43019, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1000000, 'layer_limit': 1000000}, 9894], ['layer beyond maximum', {'basic': 50180, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 81006, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 85000}, 68855], ['zero width layer rejected', {'basic': 54442, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105893, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 110451, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 750000}, 53569]]]
for label, args, expected in fixtures[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 |
|---|---|---|---|
| primary basic limit | 43747 | 43747 | Passed |
| primary interpolated limit | 150130 | 150130 | Passed |
| excess layer 500 xs 500 | 0 | 22944 | Failed |
| excess layer interpolated | 42411 | 47298 | Failed |
| layer up to maximum | 0 | 14897 | Failed |
| layer beyond maximum | -12359 | unrated | Failed |
| limit below basic | 66004 | 66004 | Passed |
| zero width layer rejected | invalid | invalid | Passed |
| negative attachment rejected | invalid | invalid | Passed |
| high excess layer | 22632 | 30319 | Failed |
SHA-256 / 0e6ba8d213ccc00fed63a089e3834d84ae3f5f8d90b1eab2b099dc1863f797e8
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
if x['layer_limit']<=0 or x['attachment']<0: return 'invalid'
tab=[[0,0]]+x['ilf']
def ilf(L):
if L>tab[-1][0]: return None
for (l0,f0),(l1,f1) in zip(tab,tab[1:]):
if l0<=L<=l1:
return f0+Fraction(f1-f0)*(L-l0)/(l1-l0)
top=ilf(max(x['attachment'],x['layer_limit'])); bot=ilf(x['attachment'])
if top is None or bot is None: return 'unrated'
return math.floor(x['basic']*(top-bot)/1000+Fraction(1,2))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['primary basic limit', {'basic': 43747, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 100000}, 43747], ['primary interpolated limit', {'basic': 104803, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 375000}, 150130], ['excess layer 500 xs 500', {'basic': 91047, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 500000, 'layer_limit': 500000}, 22944], ['excess layer interpolated', {'basic': 74589, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 130000, 'layer_limit': 650000}, 47298], ['layer up to maximum', {'basic': 60555, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1000000, 'layer_limit': 1000000}, 14897], ['layer beyond maximum', {'basic': 100477, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 110006, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 60000}, 66004], ['zero width layer rejected', {'basic': 64657, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 109079, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 61004, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 750000}, 30319]], [['primary basic limit', {'basic': 83688, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 100000}, 83688], ['primary interpolated limit', {'basic': 62537, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 400000}, 91554], ['excess layer 500 xs 500', {'basic': 72974, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 500000, 'layer_limit': 500000}, 18535], ['excess layer interpolated', {'basic': 96963, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 180000, 'layer_limit': 310000}, 36820], ['layer up to maximum', {'basic': 51640, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1000000, 'layer_limit': 1000000}, 12497], ['layer beyond maximum', {'basic': 96337, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 80166, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 25000}, 20042], ['zero width layer rejected', {'basic': 40984, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 99315, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 88492, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 750000}, 43715]], [['primary basic limit', {'basic': 103077, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 100000}, 103077], ['primary interpolated limit', {'basic': 75700, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 410000}, 112066], ['excess layer 500 xs 500', {'basic': 91514, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 500000, 'layer_limit': 500000}, 23428], ['excess layer interpolated', {'basic': 116014, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 180000, 'layer_limit': 330000}, 45723], ['layer up to maximum', {'basic': 104427, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1000000, 'layer_limit': 1000000}, 24854], ['layer beyond maximum', {'basic': 94873, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 82268, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 75000}, 61701], ['zero width layer rejected', {'basic': 98050, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105611, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 93132, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 750000}, 45728]], [['primary basic limit', {'basic': 99090, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 100000}, 99090], ['primary interpolated limit', {'basic': 69051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 470000}, 106504], ['excess layer 500 xs 500', {'basic': 103830, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 500000, 'layer_limit': 500000}, 26788], ['excess layer interpolated', {'basic': 41042, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 130000, 'layer_limit': 300000}, 17960], ['layer up to maximum', {'basic': 69534, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1000000, 'layer_limit': 1000000}, 16271], ['layer beyond maximum', {'basic': 116762, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 119876, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 60000}, 71926], ['zero width layer rejected', {'basic': 54051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 49440, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 49001, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 750000}, 23912]], [['primary basic limit', {'basic': 88505, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 100000}, 88505], ['primary interpolated limit', {'basic': 109050, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 315000}, 153597], ['excess layer 500 xs 500', {'basic': 53196, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 500000, 'layer_limit': 500000}, 13831], ['excess layer interpolated', {'basic': 106149, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 230000, 'layer_limit': 370000}, 34357], ['layer up to maximum', {'basic': 43019, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1000000, 'layer_limit': 1000000}, 9894], ['layer beyond maximum', {'basic': 50180, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 81006, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 85000}, 68855], ['zero width layer rejected', {'basic': 54442, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105893, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 110451, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 750000}, 53569]]]
for label, args, expected in fixtures[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 |
|---|---|---|---|
| primary basic limit | 43747 | 43747 | Passed |
| primary interpolated limit | 150130 | 150130 | Passed |
| excess layer 500 xs 500 | 0 | 22944 | Failed |
| excess layer interpolated | 42411 | 47298 | Failed |
| layer up to maximum | 0 | 14897 | Failed |
| layer beyond maximum | 0 | unrated | Failed |
| limit below basic | 66004 | 66004 | Passed |
| zero width layer rejected | invalid | invalid | Passed |
| negative attachment rejected | invalid | invalid | Passed |
| high excess layer | 22632 | 30319 | Failed |
SHA-256 / 08a75b6f03e7eb95163aae80ebc4adec857abff50da9dbb760e458b43f50a14a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
if x['layer_limit']<=0 or x['attachment']<0: return 'invalid'
tab=[[0,0]]+x['ilf']
def ilf(L):
if L>tab[-1][0]: return None
for (l0,f0),(l1,f1) in zip(tab,tab[1:]):
if l0<=L<=l1:
return f0+Fraction(f1-f0)*(L-l0)/(l1-l0)
top=ilf(x['attachment']+x['layer_limit']); bot=ilf(x['attachment'])
if top is None or bot is None: return 'unrated'
return math.floor(x['basic']*(top-bot)/1000+Fraction(1,2))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['primary basic limit', {'basic': 43747, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 100000}, 43747], ['primary interpolated limit', {'basic': 104803, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 375000}, 150130], ['excess layer 500 xs 500', {'basic': 91047, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 500000, 'layer_limit': 500000}, 22944], ['excess layer interpolated', {'basic': 74589, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 130000, 'layer_limit': 650000}, 47298], ['layer up to maximum', {'basic': 60555, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1000000, 'layer_limit': 1000000}, 14897], ['layer beyond maximum', {'basic': 100477, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 110006, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 0, 'layer_limit': 60000}, 66004], ['zero width layer rejected', {'basic': 64657, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 109079, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 61004, 'ilf': [[100000, 1000], [250000, 1310], [500000, 1555], [1000000, 1807], [2000000, 2053]], 'attachment': 250000, 'layer_limit': 750000}, 30319]], [['primary basic limit', {'basic': 83688, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 100000}, 83688], ['primary interpolated limit', {'basic': 62537, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 400000}, 91554], ['excess layer 500 xs 500', {'basic': 72974, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 500000, 'layer_limit': 500000}, 18535], ['excess layer interpolated', {'basic': 96963, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 180000, 'layer_limit': 310000}, 36820], ['layer up to maximum', {'basic': 51640, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1000000, 'layer_limit': 1000000}, 12497], ['layer beyond maximum', {'basic': 96337, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 80166, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 0, 'layer_limit': 25000}, 20042], ['zero width layer rejected', {'basic': 40984, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 99315, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 88492, 'ilf': [[100000, 1000], [250000, 1320], [500000, 1560], [1000000, 1814], [2000000, 2056]], 'attachment': 250000, 'layer_limit': 750000}, 43715]], [['primary basic limit', {'basic': 103077, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 100000}, 103077], ['primary interpolated limit', {'basic': 75700, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 410000}, 112066], ['excess layer 500 xs 500', {'basic': 91514, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 500000, 'layer_limit': 500000}, 23428], ['excess layer interpolated', {'basic': 116014, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 180000, 'layer_limit': 330000}, 45723], ['layer up to maximum', {'basic': 104427, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1000000, 'layer_limit': 1000000}, 24854], ['layer beyond maximum', {'basic': 94873, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 82268, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 0, 'layer_limit': 75000}, 61701], ['zero width layer rejected', {'basic': 98050, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105611, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 93132, 'ilf': [[100000, 1000], [250000, 1330], [500000, 1565], [1000000, 1821], [2000000, 2059]], 'attachment': 250000, 'layer_limit': 750000}, 45728]], [['primary basic limit', {'basic': 99090, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 100000}, 99090], ['primary interpolated limit', {'basic': 69051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 470000}, 106504], ['excess layer 500 xs 500', {'basic': 103830, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 500000, 'layer_limit': 500000}, 26788], ['excess layer interpolated', {'basic': 41042, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 130000, 'layer_limit': 300000}, 17960], ['layer up to maximum', {'basic': 69534, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1000000, 'layer_limit': 1000000}, 16271], ['layer beyond maximum', {'basic': 116762, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 119876, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 0, 'layer_limit': 60000}, 71926], ['zero width layer rejected', {'basic': 54051, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 49440, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 49001, 'ilf': [[100000, 1000], [250000, 1340], [500000, 1570], [1000000, 1828], [2000000, 2062]], 'attachment': 250000, 'layer_limit': 750000}, 23912]], [['primary basic limit', {'basic': 88505, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 100000}, 88505], ['primary interpolated limit', {'basic': 109050, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 315000}, 153597], ['excess layer 500 xs 500', {'basic': 53196, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 500000, 'layer_limit': 500000}, 13831], ['excess layer interpolated', {'basic': 106149, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 230000, 'layer_limit': 370000}, 34357], ['layer up to maximum', {'basic': 43019, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1000000, 'layer_limit': 1000000}, 9894], ['layer beyond maximum', {'basic': 50180, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 1500000, 'layer_limit': 1000000}, 'unrated'], ['limit below basic', {'basic': 81006, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 0, 'layer_limit': 85000}, 68855], ['zero width layer rejected', {'basic': 54442, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 0}, 'invalid'], ['negative attachment rejected', {'basic': 105893, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': -50000, 'layer_limit': 100000}, 'invalid'], ['high excess layer', {'basic': 110451, 'ilf': [[100000, 1000], [250000, 1350], [500000, 1575], [1000000, 1835], [2000000, 2065]], 'attachment': 250000, 'layer_limit': 750000}, 53569]]]
for label, args, expected in fixtures[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 |
|---|---|---|---|
| primary basic limit | 43747 | 43747 | Passed |
| primary interpolated limit | 150130 | 150130 | Passed |
| excess layer 500 xs 500 | 22944 | 22944 | Passed |
| excess layer interpolated | 47298 | 47298 | Passed |
| layer up to maximum | 14897 | 14897 | Passed |
| layer beyond maximum | unrated | unrated | Passed |
| limit below basic | 66004 | 66004 | Passed |
| zero width layer rejected | invalid | invalid | Passed |
| negative attachment rejected | invalid | invalid | Passed |
| high excess layer | 30319 | 30319 | Passed |
SHA-256 / e2e3d07c004686436b5bb96f0891d7e1db9e30acf1560be07023527514a697fb
Verification & scope
A deterministic bounded teaching model of a stipulated toy rating contract. Amounts are integer cents and factors exact rationals; it makes no claim of conformance with any filed rating plan, bureau manual or jurisdiction. 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:09.480823+00:00.
Case digest / ebc2826d488ce52d9c835dbfe074dd83a2c27334acdd2075ddd36dcd69bec355