FA-63576 / Actuarial life tables / Open access
Mortality improvement projection: Years before the base year are not de-improved · case 01
Historical-year rates equal base-year rates.
ROOT CAUSE
Negative projection spans are floored at zero.
THE FAILURE
Negative projection spans are floored at zero.
Unsuccessful approach: The absolute span improves historical rates instead of de-improving them.
Case contract
Input q {age: per 100000 at base_year}, aa {age: annual improvement per 10000}, age, year, n, mode static|generational. For k<n: attained age age+k, projection year = year+k (generational) or year (static); q = min(1, q_base*(1-AA)^(year-base)) with negative exponents de-improving. Missing age -> 'missing age <a>'. Return rates rounded to 8.
Why this case matters
Life-table arithmetic compounds across ages, so one misplaced index or assumption shifts every downstream value.
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):
out=[]
for k in range(x['n']):
age=x['age']+k
yr=x['year']+k if x['mode']=='generational' else x['year']
key=str(age)
if key not in x['q'] or key not in x['aa']: return 'missing age '+key
f=(1-Fraction(x['aa'][key],10000))**max(0,yr-x['base_year'])
q=min(Fraction(1),Fraction(x['q'][key],100000)*f)
out.append(round(float(q),8))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['generational projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345]], ['static projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00510686, 0.00591448, 0.00673016, 0.00755396]], ['before base year', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00836511, 0.00919216, 0.01000074]], ['de-improvement near one', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01982084, 1.0]], ['base year exactly', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00681, 0.00771, 0.00861]], ['missing age', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041]]], [['generational projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00635578, 0.00711541, 0.00786552, 0.00860862, 0.00934717]], ['static projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00431585, 0.0051155, 0.00592316, 0.00673889]], ['before base year', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00646222, 0.00731812, 0.00815134]], ['de-improvement near one', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.0198327, 1.0]], ['base year exactly', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00682, 0.00772, 0.00862]], ['missing age', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049447, 0.00574956, 0.00653755, 0.00731149, 0.00807408, 0.00882794, 0.00957561, 0.01031953]]], [['generational projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.0063651, 0.00712463, 0.00787464, 0.00861767, 0.00935614]], ['static projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00674762, 0.00757151, 0.00840357, 0.00924387]], ['before base year', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00647314, 0.00732885, 0.0081619]], ['de-improvement near one', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01984456, 1.0]], ['base year exactly', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00683, 0.00773, 0.00863]], ['missing age', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00495455, 0.00575928, 0.00654714, 0.00732096, 0.00808345, 0.00883722, 0.0095848, 0.01032864]]], [['generational projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00723147, 0.00798761, 0.00873591, 0.00947886, 0.01021888]], ['static projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00594053, 0.00675635, 0.00758028, 0.00841239]], ['before base year', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 64, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00934568, 0.01015928, 0.01095652]], ['de-improvement near one', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01985643, 1.0]], ['base year exactly', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00684, 0.00774, 0.00864]], ['missing age', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049644, 0.00576899, 0.00655672, 0.00733043, 0.00809281, 0.00884649, 0.00959399, 0.01033776]]], [['generational projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00638374, 0.00714306, 0.00789289, 0.00863575, 0.00937408]], ['static projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00434164, 0.00514142, 0.00594922, 0.00676507]], ['before base year', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00552935, 0.00640079, 0.00724741]], ['de-improvement near one', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01986829, 1.0]], ['base year exactly', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00685, 0.00775, 0.00865]], ['missing age', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00497425, 0.0057787, 0.00656631, 0.0073399, 0.00810218, 0.00885576, 0.00960318, 0.01034688]]]]
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 |
|---|---|---|---|
| generational projection | [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345] | [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345] | Passed |
| static projection | [0.00510686, 0.00591448, 0.00673016, 0.00755396] | [0.00510686, 0.00591448, 0.00673016, 0.00755396] | Passed |
| before base year | [0.00771, 0.00861, 0.00951] | [0.00836511, 0.00919216, 0.01000074] | Failed |
| de-improvement near one | [0.01671, 0.99] | [0.01982084, 1.0] | Failed |
| base year exactly | [0.00681, 0.00771, 0.00861] | [0.00681, 0.00771, 0.00861] | Passed |
| missing age | missing age 75 | missing age 75 | Passed |
| long generational | [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041] | [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041] | Passed |
SHA-256 / e92730e51c66310e1cc7c67ec5a6fe2c425001efebff3368f7397a45de2680a5
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):
out=[]
for k in range(x['n']):
age=x['age']+k
yr=x['year']+k if x['mode']=='generational' else x['year']
key=str(age)
if key not in x['q'] or key not in x['aa']: return 'missing age '+key
f=(1-Fraction(x['aa'][key],10000))**abs(yr-x['base_year'])
q=min(Fraction(1),Fraction(x['q'][key],100000)*f)
out.append(round(float(q),8))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['generational projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345]], ['static projection', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00510686, 0.00591448, 0.00673016, 0.00755396]], ['before base year', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00836511, 0.00919216, 0.01000074]], ['de-improvement near one', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01982084, 1.0]], ['base year exactly', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00681, 0.00771, 0.00861]], ['missing age', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 501, '61': 591, '62': 681, '63': 771, '64': 861, '65': 951, '66': 1041, '67': 1131, '68': 1221, '69': 1311, '70': 1401, '71': 1491, '72': 1581, '73': 1671, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041]]], [['generational projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00635578, 0.00711541, 0.00786552, 0.00860862, 0.00934717]], ['static projection', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00431585, 0.0051155, 0.00592316, 0.00673889]], ['before base year', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00646222, 0.00731812, 0.00815134]], ['de-improvement near one', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.0198327, 1.0]], ['base year exactly', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00682, 0.00772, 0.00862]], ['missing age', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 502, '61': 592, '62': 682, '63': 772, '64': 862, '65': 952, '66': 1042, '67': 1132, '68': 1222, '69': 1312, '70': 1402, '71': 1492, '72': 1582, '73': 1672, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049447, 0.00574956, 0.00653755, 0.00731149, 0.00807408, 0.00882794, 0.00957561, 0.01031953]]], [['generational projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.0063651, 0.00712463, 0.00787464, 0.00861767, 0.00935614]], ['static projection', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00674762, 0.00757151, 0.00840357, 0.00924387]], ['before base year', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 61, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00647314, 0.00732885, 0.0081619]], ['de-improvement near one', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01984456, 1.0]], ['base year exactly', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00683, 0.00773, 0.00863]], ['missing age', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 503, '61': 593, '62': 683, '63': 773, '64': 863, '65': 953, '66': 1043, '67': 1133, '68': 1223, '69': 1313, '70': 1403, '71': 1493, '72': 1583, '73': 1673, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00495455, 0.00575928, 0.00654714, 0.00732096, 0.00808345, 0.00883722, 0.0095848, 0.01032864]]], [['generational projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 63, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00723147, 0.00798761, 0.00873591, 0.00947886, 0.01021888]], ['static projection', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00594053, 0.00675635, 0.00758028, 0.00841239]], ['before base year', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 64, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00934568, 0.01015928, 0.01095652]], ['de-improvement near one', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01985643, 1.0]], ['base year exactly', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00684, 0.00774, 0.00864]], ['missing age', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 504, '61': 594, '62': 684, '63': 774, '64': 864, '65': 954, '66': 1044, '67': 1134, '68': 1224, '69': 1314, '70': 1404, '71': 1494, '72': 1584, '73': 1674, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.0049644, 0.00576899, 0.00655672, 0.00733043, 0.00809281, 0.00884649, 0.00959399, 0.01033776]]], [['generational projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, [0.00638374, 0.00714306, 0.00789289, 0.00863575, 0.00937408]], ['static projection', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2030, 'n': 4, 'mode': 'static', 'base_year': 2020}, [0.00434164, 0.00514142, 0.00594922, 0.00676507]], ['before base year', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2014, 'n': 3, 'mode': 'generational', 'base_year': 2020}, [0.00552935, 0.00640079, 0.00724741]], ['de-improvement near one', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 73, 'year': 2000, 'n': 2, 'mode': 'static', 'base_year': 2020}, [0.01986829, 1.0]], ['base year exactly', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 62, 'year': 2020, 'n': 3, 'mode': 'static', 'base_year': 2020}, [0.00685, 0.00775, 0.00865]], ['missing age', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 72, 'year': 2025, 'n': 5, 'mode': 'generational', 'base_year': 2020}, 'missing age 75'], ['long generational', {'q': {'60': 505, '61': 595, '62': 685, '63': 775, '64': 865, '65': 955, '66': 1045, '67': 1135, '68': 1225, '69': 1315, '70': 1405, '71': 1495, '72': 1585, '73': 1675, '74': 99000}, 'aa': {'60': 150, '61': 145, '62': 140, '63': 135, '64': 130, '65': 125, '66': 120, '67': 115, '68': 110, '69': 105, '70': 100, '71': 95, '72': 90, '73': 85, '74': 80}, 'age': 60, 'year': 2021, 'n': 8, 'mode': 'generational', 'base_year': 2020}, [0.00497425, 0.0057787, 0.00656631, 0.0073399, 0.00810218, 0.00885576, 0.00960318, 0.01034688]]]]
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 |
|---|---|---|---|
| generational projection | [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345] | [0.00464535, 0.00541411, 0.00617001, 0.00691562, 0.00765345] | Passed |
| static projection | [0.00510686, 0.00591448, 0.00673016, 0.00755396] | [0.00510686, 0.00591448, 0.00673016, 0.00755396] | Passed |
| before base year | [0.00710619, 0.00806471, 0.00904334] | [0.00836511, 0.00919216, 0.01000074] | Failed |
| de-improvement near one | [0.0140874, 0.84307971] | [0.01982084, 1.0] | Failed |
| base year exactly | [0.00681, 0.00771, 0.00861] | [0.00681, 0.00771, 0.00861] | Passed |
| missing age | missing age 75 | missing age 75 | Passed |
| long generational | [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041] | [0.00493485, 0.00573985, 0.00652797, 0.00730202, 0.00806471, 0.00881867, 0.00956642, 0.01031041] | Passed |
SHA-256 / b7331d91b8981eca079b1844565c1f3e9493c78f996af8e2cfb98d328cfece4d
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 of a stipulated toy actuarial contract. Rates are small synthetic tables, exact rationals are used where practical and floats are rounded at the output; it makes no claim of conformance with any published table, standard of practice or regulation. 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:15.780007+00:00.
Case digest / 7cc4357d50522471a882cbd136a56ec7292c9918d87de22f1922fff30123c3a9