from research import *
s=begin(1136,'Bound the residual age freedom by the whole cap','Do positivity and all nine cap inequalities identify the shared age scale?',{},['C1134–C1135','File18 §3.1.3'])
base=[930,912,905,910,895,962,365,969,777]
def ages(m,s,k):return [2*m,s,460-3*m-s-k,k,m,127-m,m,67,52]
def output(v):return [min(l,601+sum(v[i:])) for i,l in enumerate(base)]
witnesses=[ages(48,105,70),ages(65,105,70),ages(126,1,1)]
data={'positivity':['m>0','s>0','k>0','460-3m-s-k>0','127-m>0'],'nonclipped_bounds':['m>=48','m+k>=63','2m+s<=402'],'integer_m_range':[48,126],'witnesses':witnesses,'outputs':[output(v) for v in witnesses],'scope':'formal positive-age alternatives, not newly admitted source biographies'}
a=artifact('model/SP_age_cap_inequalities.json',json.dumps(data,indent=2)+'\n')
finish(s,{'inequality_model':a,'integer_scale_range':[48,126]},'The full cap permits a broad positive-age scale interval; explicit alternatives at48 and126 retain every capped lifespan. Its source value65 needs additional information.','Test the source-motivated five-year grid and observed early-age order with65 retained.',{'all_positive':all(min(v)>0 for v in witnesses),'same_nine_outputs':all(output(v)==[930,912,905,910,895,847,365,720,653] for v in witnesses),'bounds_witnessed':witnesses[0][4]==48 and witnesses[-1][4]==126})
