from research import *
s=begin(999,'Complete fixed-pivot Key-pair field','Which of the nine fixed E/P/J pairs have an integral staged domain?',{'pivots':[14006,4836],'status':'diagnostic compositions; not nine newly authorized routes'},['C998','File46'])
from math import gcd
a,b=s['inputs']['pivots'];rows=[]
for n1,k1 in [('E',E),('P',P),('J',J)]:
 for n2,k2 in [('E',E),('P',P),('J',J)]:
  p,q=k1.numerator,k1.denominator;v=k2.denominator;g=gcd(p,v);ok=(b-a)%g==0
  r={'pair':n1+'→'+n2,'gcd':g,'nonempty':ok}
  if ok:
   mod=v//g;t=((b-a)//g*pow(p//g,-1,mod))%mod;period=q*mod;r.update(residue=(a+q*t)%period,period=period)
  rows.append(r)
aout=artifact('model/fixed_pivot_key_domains.json',json.dumps(rows,indent=2)+'\n')
finish(s,{'complete_field':aout,'empty_pairs':[r['pair'] for r in rows if not r['nonempty']]},'Eight fixed-pivot pairs have one residue-class domain. J→P alone has no all-stage integer input under these pivots. Representatives are congruence labels, not event dates.','Verify every nonempty class and explain the single obstruction.',{'nine_pairs':len(rows)==9,'only_obstruction':[r['pair'] for r in rows if not r['nonempty']]==['J→P']})
