FA-63671 / Actuarial life tables / Open access
Abridged to single-year mortality: Groups are assumed to be five years wide · case 01
Infant and 1-4 groups trigger a false gap.
ROOT CAUSE
The next expected start ignores the group width.
VERIFIED REPAIR
Advance by the group width.
Unsuccessful approach: Advancing by n-1 reports overlaps as valid gaps.
Case contract
Input groups [[start age, width n, nqx per 100000]]; groups must be contiguous from the first start (else 'gap at <start>'). An nqx of 100000 is the open group and ends the table. Each closed group yields n equal single-year rates 1-(1-nqx)^(1/n) 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=[]; exp_start=x['groups'][0][0]
for st,n,q in x['groups']:
if st!=exp_start: return 'gap at '+str(st)
exp_start=st+5
if q>=100000: break
p1=(1-q/100000)**(1/n)
out.extend([round(1-p1,8)]*n)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['infant groups', {'groups': [[0, 1, 748], [1, 4, 209], [5, 5, 1651], [10, 5, 798], [15, 5, 931], [20, 5, 2632], [25, 5, 2702], [30, 20, 100000]]}, [0.00748, 0.00052291, 0.00052291, 0.00052291, 0.00052291, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00546337, 0.00546337, 0.00546337, 0.00546337, 0.00546337]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1101], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 510], [1, 4, 262], [5, 5, 2631], [10, 5, 696], [15, 5, 976], [20, 5, 1597], [25, 5, 730]]}, [0.0051, 0.00065564, 0.00065564, 0.00065564, 0.00065564, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.00146428, 0.00146428, 0.00146428, 0.00146428, 0.00146428]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 406], [1, 4, 137], [5, 5, 705], [10, 5, 2892], [15, 5, 1557], [20, 5, 589], [25, 5, 950], [30, 20, 100000]]}, [0.00406, 0.00034268, 0.00034268, 0.00034268, 0.00034268, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00585209, 0.00585209, 0.00585209, 0.00585209, 0.00585209, 0.00313358, 0.00313358, 0.00313358, 0.00313358, 0.00313358, 0.00118079, 0.00118079, 0.00118079, 0.00118079, 0.00118079, 0.00190726, 0.00190726, 0.00190726, 0.00190726, 0.00190726]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1102], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221378, 0.00221378, 0.00221378, 0.00221378, 0.00221378, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 431], [1, 4, 105], [5, 5, 1859], [10, 5, 1595], [15, 5, 2533], [20, 5, 876], [25, 5, 705]]}, [0.00431, 0.0002626, 0.0002626, 0.0002626, 0.0002626, 0.00374596, 0.00374596, 0.00374596, 0.00374596, 0.00374596, 0.00321055, 0.00321055, 0.00321055, 0.00321055, 0.00321055, 0.00511812, 0.00511812, 0.00511812, 0.00511812, 0.00511812, 0.00175817, 0.00175817, 0.00175817, 0.00175817, 0.00175817, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00141399]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 436], [1, 4, 270], [5, 5, 359], [10, 5, 2641], [15, 5, 346], [20, 5, 2991], [25, 5, 614], [30, 20, 100000]]}, [0.00436, 0.00067568, 0.00067568, 0.00067568, 0.00067568, 0.00071903, 0.00071903, 0.00071903, 0.00071903, 0.00071903, 0.0053387, 0.0053387, 0.0053387, 0.0053387, 0.0053387, 0.00069296, 0.00069296, 0.00069296, 0.00069296, 0.00069296, 0.00605488, 0.00605488, 0.00605488, 0.00605488, 0.00605488, 0.00123103, 0.00123103, 0.00123103, 0.00123103, 0.00123103]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1103], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.0022158, 0.0022158, 0.0022158, 0.0022158, 0.0022158, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 622], [1, 4, 298], [5, 5, 1431], [10, 5, 1208], [15, 5, 861], [20, 5, 1701], [25, 5, 1427]]}, [0.00622, 0.00074583, 0.00074583, 0.00074583, 0.00074583, 0.00287852, 0.00287852, 0.00287852, 0.00287852, 0.00287852, 0.00242776, 0.00242776, 0.00242776, 0.00242776, 0.00242776, 0.00172796, 0.00172796, 0.00172796, 0.00172796, 0.00172796, 0.00342539, 0.00342539, 0.00342539, 0.00342539, 0.00342539, 0.00287043, 0.00287043, 0.00287043, 0.00287043, 0.00287043]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 479], [1, 4, 217], [5, 5, 321], [10, 5, 2470], [15, 5, 1331], [20, 5, 2469], [25, 5, 1105], [30, 20, 100000]]}, [0.00479, 0.00054294, 0.00054294, 0.00054294, 0.00054294, 0.00064283, 0.00064283, 0.00064283, 0.00064283, 0.00064283, 0.00498954, 0.00498954, 0.00498954, 0.00498954, 0.00498954, 0.00267629, 0.00267629, 0.00267629, 0.00267629, 0.00267629, 0.0049875, 0.0049875, 0.0049875, 0.0049875, 0.0049875, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00221983]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1104], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221782, 0.00221782, 0.00221782, 0.00221782, 0.00221782, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 442], [1, 4, 179], [5, 5, 2837], [10, 5, 2146], [15, 5, 1469], [20, 5, 2654], [25, 5, 1744]]}, [0.00442, 0.0004478, 0.0004478, 0.0004478, 0.0004478, 0.00573951, 0.00573951, 0.00573951, 0.00573951, 0.00573951, 0.00432932, 0.00432932, 0.00432932, 0.00432932, 0.00432932, 0.00295542, 0.00295542, 0.00295542, 0.00295542, 0.00295542, 0.00536526, 0.00536526, 0.00536526, 0.00536526, 0.00536526, 0.00351259, 0.00351259, 0.00351259, 0.00351259, 0.00351259]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 877], [1, 4, 156], [5, 5, 1446], [10, 5, 2000], [15, 5, 2480], [20, 5, 1282], [25, 5, 2160], [30, 20, 100000]]}, [0.00877, 0.00039023, 0.00039023, 0.00039023, 0.00039023, 0.00290887, 0.00290887, 0.00290887, 0.00290887, 0.00290887, 0.00403239, 0.00403239, 0.00403239, 0.00403239, 0.00403239, 0.00500995, 0.00500995, 0.00500995, 0.00500995, 0.00500995, 0.00257725, 0.00257725, 0.00257725, 0.00257725, 0.00257725, 0.00435782, 0.00435782, 0.00435782, 0.00435782, 0.00435782]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1105], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 592], [1, 4, 103], [5, 5, 776], [10, 5, 936], [15, 5, 1068], [20, 5, 2381], [25, 5, 2847]]}, [0.00592, 0.0002576, 0.0002576, 0.0002576, 0.0002576, 0.00155684, 0.00155684, 0.00155684, 0.00155684, 0.00155684, 0.00187905, 0.00187905, 0.00187905, 0.00187905, 0.00187905, 0.00214518, 0.00214518, 0.00214518, 0.00214518, 0.00214518, 0.00480801, 0.00480801, 0.00480801, 0.00480801, 0.00480801, 0.00575997, 0.00575997, 0.00575997, 0.00575997, 0.00575997]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]]]
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 |
|---|---|---|---|
| infant groups | gap at 1 | [0.00748, 0.00052291, 0.00052291, 0.00052291, 0.00052291, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00546337, 0.00546337, 0.00546337, 0.00546337, 0.00546337] | Failed |
| adult table from 20 | gap at 40 | [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129] | Failed |
| closed without open group | gap at 1 | [0.0051, 0.00065564, 0.00065564, 0.00065564, 0.00065564, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.00146428, 0.00146428, 0.00146428, 0.00146428, 0.00146428] | Failed |
| gap between groups | gap at 1 | gap at 6 | Failed |
| overlapping groups | gap at 14 | gap at 14 | Passed |
| unsorted groups | gap at 10 | gap at 10 | Passed |
| open group early | [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475] | [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475] | Passed |
SHA-256 / f0f4475e6fcda6e87a8c7eec7c819adb272c1dab96b121ce9415df4e03325392
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=[]; exp_start=x['groups'][0][0]
for st,n,q in x['groups']:
if st!=exp_start: return 'gap at '+str(st)
exp_start=st+n-1
if q>=100000: break
p1=(1-q/100000)**(1/n)
out.extend([round(1-p1,8)]*n)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['infant groups', {'groups': [[0, 1, 748], [1, 4, 209], [5, 5, 1651], [10, 5, 798], [15, 5, 931], [20, 5, 2632], [25, 5, 2702], [30, 20, 100000]]}, [0.00748, 0.00052291, 0.00052291, 0.00052291, 0.00052291, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00546337, 0.00546337, 0.00546337, 0.00546337, 0.00546337]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1101], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 510], [1, 4, 262], [5, 5, 2631], [10, 5, 696], [15, 5, 976], [20, 5, 1597], [25, 5, 730]]}, [0.0051, 0.00065564, 0.00065564, 0.00065564, 0.00065564, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.00146428, 0.00146428, 0.00146428, 0.00146428, 0.00146428]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 406], [1, 4, 137], [5, 5, 705], [10, 5, 2892], [15, 5, 1557], [20, 5, 589], [25, 5, 950], [30, 20, 100000]]}, [0.00406, 0.00034268, 0.00034268, 0.00034268, 0.00034268, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00585209, 0.00585209, 0.00585209, 0.00585209, 0.00585209, 0.00313358, 0.00313358, 0.00313358, 0.00313358, 0.00313358, 0.00118079, 0.00118079, 0.00118079, 0.00118079, 0.00118079, 0.00190726, 0.00190726, 0.00190726, 0.00190726, 0.00190726]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1102], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221378, 0.00221378, 0.00221378, 0.00221378, 0.00221378, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 431], [1, 4, 105], [5, 5, 1859], [10, 5, 1595], [15, 5, 2533], [20, 5, 876], [25, 5, 705]]}, [0.00431, 0.0002626, 0.0002626, 0.0002626, 0.0002626, 0.00374596, 0.00374596, 0.00374596, 0.00374596, 0.00374596, 0.00321055, 0.00321055, 0.00321055, 0.00321055, 0.00321055, 0.00511812, 0.00511812, 0.00511812, 0.00511812, 0.00511812, 0.00175817, 0.00175817, 0.00175817, 0.00175817, 0.00175817, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00141399]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 436], [1, 4, 270], [5, 5, 359], [10, 5, 2641], [15, 5, 346], [20, 5, 2991], [25, 5, 614], [30, 20, 100000]]}, [0.00436, 0.00067568, 0.00067568, 0.00067568, 0.00067568, 0.00071903, 0.00071903, 0.00071903, 0.00071903, 0.00071903, 0.0053387, 0.0053387, 0.0053387, 0.0053387, 0.0053387, 0.00069296, 0.00069296, 0.00069296, 0.00069296, 0.00069296, 0.00605488, 0.00605488, 0.00605488, 0.00605488, 0.00605488, 0.00123103, 0.00123103, 0.00123103, 0.00123103, 0.00123103]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1103], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.0022158, 0.0022158, 0.0022158, 0.0022158, 0.0022158, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 622], [1, 4, 298], [5, 5, 1431], [10, 5, 1208], [15, 5, 861], [20, 5, 1701], [25, 5, 1427]]}, [0.00622, 0.00074583, 0.00074583, 0.00074583, 0.00074583, 0.00287852, 0.00287852, 0.00287852, 0.00287852, 0.00287852, 0.00242776, 0.00242776, 0.00242776, 0.00242776, 0.00242776, 0.00172796, 0.00172796, 0.00172796, 0.00172796, 0.00172796, 0.00342539, 0.00342539, 0.00342539, 0.00342539, 0.00342539, 0.00287043, 0.00287043, 0.00287043, 0.00287043, 0.00287043]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 479], [1, 4, 217], [5, 5, 321], [10, 5, 2470], [15, 5, 1331], [20, 5, 2469], [25, 5, 1105], [30, 20, 100000]]}, [0.00479, 0.00054294, 0.00054294, 0.00054294, 0.00054294, 0.00064283, 0.00064283, 0.00064283, 0.00064283, 0.00064283, 0.00498954, 0.00498954, 0.00498954, 0.00498954, 0.00498954, 0.00267629, 0.00267629, 0.00267629, 0.00267629, 0.00267629, 0.0049875, 0.0049875, 0.0049875, 0.0049875, 0.0049875, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00221983]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1104], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221782, 0.00221782, 0.00221782, 0.00221782, 0.00221782, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 442], [1, 4, 179], [5, 5, 2837], [10, 5, 2146], [15, 5, 1469], [20, 5, 2654], [25, 5, 1744]]}, [0.00442, 0.0004478, 0.0004478, 0.0004478, 0.0004478, 0.00573951, 0.00573951, 0.00573951, 0.00573951, 0.00573951, 0.00432932, 0.00432932, 0.00432932, 0.00432932, 0.00432932, 0.00295542, 0.00295542, 0.00295542, 0.00295542, 0.00295542, 0.00536526, 0.00536526, 0.00536526, 0.00536526, 0.00536526, 0.00351259, 0.00351259, 0.00351259, 0.00351259, 0.00351259]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 877], [1, 4, 156], [5, 5, 1446], [10, 5, 2000], [15, 5, 2480], [20, 5, 1282], [25, 5, 2160], [30, 20, 100000]]}, [0.00877, 0.00039023, 0.00039023, 0.00039023, 0.00039023, 0.00290887, 0.00290887, 0.00290887, 0.00290887, 0.00290887, 0.00403239, 0.00403239, 0.00403239, 0.00403239, 0.00403239, 0.00500995, 0.00500995, 0.00500995, 0.00500995, 0.00500995, 0.00257725, 0.00257725, 0.00257725, 0.00257725, 0.00257725, 0.00435782, 0.00435782, 0.00435782, 0.00435782, 0.00435782]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1105], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 592], [1, 4, 103], [5, 5, 776], [10, 5, 936], [15, 5, 1068], [20, 5, 2381], [25, 5, 2847]]}, [0.00592, 0.0002576, 0.0002576, 0.0002576, 0.0002576, 0.00155684, 0.00155684, 0.00155684, 0.00155684, 0.00155684, 0.00187905, 0.00187905, 0.00187905, 0.00187905, 0.00187905, 0.00214518, 0.00214518, 0.00214518, 0.00214518, 0.00214518, 0.00480801, 0.00480801, 0.00480801, 0.00480801, 0.00480801, 0.00575997, 0.00575997, 0.00575997, 0.00575997, 0.00575997]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]]]
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 |
|---|---|---|---|
| infant groups | gap at 1 | [0.00748, 0.00052291, 0.00052291, 0.00052291, 0.00052291, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00546337, 0.00546337, 0.00546337, 0.00546337, 0.00546337] | Failed |
| adult table from 20 | gap at 25 | [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129] | Failed |
| closed without open group | gap at 1 | [0.0051, 0.00065564, 0.00065564, 0.00065564, 0.00065564, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.00146428, 0.00146428, 0.00146428, 0.00146428, 0.00146428] | Failed |
| gap between groups | gap at 1 | gap at 6 | Failed |
| overlapping groups | gap at 19 | gap at 14 | Failed |
| unsorted groups | gap at 10 | gap at 10 | Passed |
| open group early | gap at 55 | [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475] | Failed |
SHA-256 / 7871be9fe481582779053ca45b89084245d258ad703912b5ef14e21cd9425120
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):
out=[]; exp_start=x['groups'][0][0]
for st,n,q in x['groups']:
if st!=exp_start: return 'gap at '+str(st)
exp_start=st+n
if q>=100000: break
p1=(1-q/100000)**(1/n)
out.extend([round(1-p1,8)]*n)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['infant groups', {'groups': [[0, 1, 748], [1, 4, 209], [5, 5, 1651], [10, 5, 798], [15, 5, 931], [20, 5, 2632], [25, 5, 2702], [30, 20, 100000]]}, [0.00748, 0.00052291, 0.00052291, 0.00052291, 0.00052291, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00546337, 0.00546337, 0.00546337, 0.00546337, 0.00546337]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1101], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 510], [1, 4, 262], [5, 5, 2631], [10, 5, 696], [15, 5, 976], [20, 5, 1597], [25, 5, 730]]}, [0.0051, 0.00065564, 0.00065564, 0.00065564, 0.00065564, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.00146428, 0.00146428, 0.00146428, 0.00146428, 0.00146428]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 406], [1, 4, 137], [5, 5, 705], [10, 5, 2892], [15, 5, 1557], [20, 5, 589], [25, 5, 950], [30, 20, 100000]]}, [0.00406, 0.00034268, 0.00034268, 0.00034268, 0.00034268, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00585209, 0.00585209, 0.00585209, 0.00585209, 0.00585209, 0.00313358, 0.00313358, 0.00313358, 0.00313358, 0.00313358, 0.00118079, 0.00118079, 0.00118079, 0.00118079, 0.00118079, 0.00190726, 0.00190726, 0.00190726, 0.00190726, 0.00190726]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1102], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221378, 0.00221378, 0.00221378, 0.00221378, 0.00221378, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 431], [1, 4, 105], [5, 5, 1859], [10, 5, 1595], [15, 5, 2533], [20, 5, 876], [25, 5, 705]]}, [0.00431, 0.0002626, 0.0002626, 0.0002626, 0.0002626, 0.00374596, 0.00374596, 0.00374596, 0.00374596, 0.00374596, 0.00321055, 0.00321055, 0.00321055, 0.00321055, 0.00321055, 0.00511812, 0.00511812, 0.00511812, 0.00511812, 0.00511812, 0.00175817, 0.00175817, 0.00175817, 0.00175817, 0.00175817, 0.00141399, 0.00141399, 0.00141399, 0.00141399, 0.00141399]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 436], [1, 4, 270], [5, 5, 359], [10, 5, 2641], [15, 5, 346], [20, 5, 2991], [25, 5, 614], [30, 20, 100000]]}, [0.00436, 0.00067568, 0.00067568, 0.00067568, 0.00067568, 0.00071903, 0.00071903, 0.00071903, 0.00071903, 0.00071903, 0.0053387, 0.0053387, 0.0053387, 0.0053387, 0.0053387, 0.00069296, 0.00069296, 0.00069296, 0.00069296, 0.00069296, 0.00605488, 0.00605488, 0.00605488, 0.00605488, 0.00605488, 0.00123103, 0.00123103, 0.00123103, 0.00123103, 0.00123103]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1103], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.0022158, 0.0022158, 0.0022158, 0.0022158, 0.0022158, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 622], [1, 4, 298], [5, 5, 1431], [10, 5, 1208], [15, 5, 861], [20, 5, 1701], [25, 5, 1427]]}, [0.00622, 0.00074583, 0.00074583, 0.00074583, 0.00074583, 0.00287852, 0.00287852, 0.00287852, 0.00287852, 0.00287852, 0.00242776, 0.00242776, 0.00242776, 0.00242776, 0.00242776, 0.00172796, 0.00172796, 0.00172796, 0.00172796, 0.00172796, 0.00342539, 0.00342539, 0.00342539, 0.00342539, 0.00342539, 0.00287043, 0.00287043, 0.00287043, 0.00287043, 0.00287043]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 479], [1, 4, 217], [5, 5, 321], [10, 5, 2470], [15, 5, 1331], [20, 5, 2469], [25, 5, 1105], [30, 20, 100000]]}, [0.00479, 0.00054294, 0.00054294, 0.00054294, 0.00054294, 0.00064283, 0.00064283, 0.00064283, 0.00064283, 0.00064283, 0.00498954, 0.00498954, 0.00498954, 0.00498954, 0.00498954, 0.00267629, 0.00267629, 0.00267629, 0.00267629, 0.00267629, 0.0049875, 0.0049875, 0.0049875, 0.0049875, 0.0049875, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00221983]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1104], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221782, 0.00221782, 0.00221782, 0.00221782, 0.00221782, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 442], [1, 4, 179], [5, 5, 2837], [10, 5, 2146], [15, 5, 1469], [20, 5, 2654], [25, 5, 1744]]}, [0.00442, 0.0004478, 0.0004478, 0.0004478, 0.0004478, 0.00573951, 0.00573951, 0.00573951, 0.00573951, 0.00573951, 0.00432932, 0.00432932, 0.00432932, 0.00432932, 0.00432932, 0.00295542, 0.00295542, 0.00295542, 0.00295542, 0.00295542, 0.00536526, 0.00536526, 0.00536526, 0.00536526, 0.00536526, 0.00351259, 0.00351259, 0.00351259, 0.00351259, 0.00351259]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]], [['infant groups', {'groups': [[0, 1, 877], [1, 4, 156], [5, 5, 1446], [10, 5, 2000], [15, 5, 2480], [20, 5, 1282], [25, 5, 2160], [30, 20, 100000]]}, [0.00877, 0.00039023, 0.00039023, 0.00039023, 0.00039023, 0.00290887, 0.00290887, 0.00290887, 0.00290887, 0.00290887, 0.00403239, 0.00403239, 0.00403239, 0.00403239, 0.00403239, 0.00500995, 0.00500995, 0.00500995, 0.00500995, 0.00500995, 0.00257725, 0.00257725, 0.00257725, 0.00257725, 0.00257725, 0.00435782, 0.00435782, 0.00435782, 0.00435782, 0.00435782]], ['adult table from 20', {'groups': [[20, 5, 900], [25, 5, 1105], [30, 10, 3000], [40, 20, 100000]]}, [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00221983, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129]], ['closed without open group', {'groups': [[0, 1, 592], [1, 4, 103], [5, 5, 776], [10, 5, 936], [15, 5, 1068], [20, 5, 2381], [25, 5, 2847]]}, [0.00592, 0.0002576, 0.0002576, 0.0002576, 0.0002576, 0.00155684, 0.00155684, 0.00155684, 0.00155684, 0.00155684, 0.00187905, 0.00187905, 0.00187905, 0.00187905, 0.00187905, 0.00214518, 0.00214518, 0.00214518, 0.00214518, 0.00214518, 0.00480801, 0.00480801, 0.00480801, 0.00480801, 0.00480801, 0.00575997, 0.00575997, 0.00575997, 0.00575997, 0.00575997]], ['gap between groups', {'groups': [[0, 1, 700], [1, 4, 200], [6, 4, 150]]}, 'gap at 6'], ['overlapping groups', {'groups': [[10, 5, 400], [14, 5, 500], [19, 5, 600]]}, 'gap at 14'], ['unsorted groups', {'groups': [[15, 5, 600], [10, 5, 400], [20, 5, 800]]}, 'gap at 10'], ['open group early', {'groups': [[50, 5, 20000], [55, 10, 100000]]}, [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475]]]]
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 |
|---|---|---|---|
| infant groups | [0.00748, 0.00052291, 0.00052291, 0.00052291, 0.00052291, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00546337, 0.00546337, 0.00546337, 0.00546337, 0.00546337] | [0.00748, 0.00052291, 0.00052291, 0.00052291, 0.00052291, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00332402, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00160112, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00186897, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00532031, 0.00546337, 0.00546337, 0.00546337, 0.00546337, 0.00546337] | Passed |
| adult table from 20 | [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129] | [0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00180652, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00221176, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129, 0.00304129] | Passed |
| closed without open group | [0.0051, 0.00065564, 0.00065564, 0.00065564, 0.00065564, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.00146428, 0.00146428, 0.00146428, 0.00146428, 0.00146428] | [0.0051, 0.00065564, 0.00065564, 0.00065564, 0.00065564, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00531827, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00139589, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.00195967, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.0032146, 0.00146428, 0.00146428, 0.00146428, 0.00146428, 0.00146428] | Passed |
| gap between groups | gap at 6 | gap at 6 | Passed |
| overlapping groups | gap at 14 | gap at 14 | Passed |
| unsorted groups | gap at 10 | gap at 10 | Passed |
| open group early | [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475] | [0.0436475, 0.0436475, 0.0436475, 0.0436475, 0.0436475] | Passed |
SHA-256 / e096640c0a3bf814b775eb217b383d823076371c86f0f7957af1aa53b810f9f7
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:16.623875+00:00.
Case digest / f057ea1a8b8a6dca8e184ae920d4344e0a1b5b31cf99f786d1dae549ff72dfb2