from research import *
s=begin(881,'Classify all nine two-Key grid domains','Which ordered pairs differ between final and stagewise membership?',{'inventory':'E,P,J each followed by E,P,J'},['C880'])
from math import lcm
keys={'E':E,'P':P,'J':J};out=[]
for a,x in keys.items():
 for b,y in keys.items():
  product=x*y;d=lcm(x.denominator,product.denominator)
  out.append({'execution':a+'→'+b,'coefficient':str(product),'final_integer_domain':product.denominator,'all_stage_integer_domain':d,'all_stage_5Z_domain':5*d})
a=artifact('model/two_key_domains.json',json.dumps(out,indent=2)+'\n')
finish(s,{'matrix':a,'rows':out},'Eight of nine ordered pairs have the same final and stagewise integer domain. P→J is the exception: its final domain is6877Z, but its intermediate stage requires20631Z. Scalar products commute while partial integer-grid actions can differ.','Expose the P/J asymmetry with the denominator-forced minimal example.',{'complete':len(out)==9,'unique_exception':[r['execution'] for r in out if r['final_integer_domain']!=r['all_stage_integer_domain']]==['P→J']})
