"""Reference realization of specified paper equations, not recovered production code. Author: Aboudy Keddeh (source architecture). AI contribution: experiment harness. Sources: KEX/BRAINK Zeroless Computational Standard v1, sections 3-12; KEX LAW 3 ZEROLESS PROTOCOL. Current author definitions preserved separately. """ from fractions import Fraction from pathlib import Path import hashlib,itertools,json,subprocess ROOT=Path(__file__).parent def canon(o): return json.dumps(o,sort_keys=True,separators=(',',':'),ensure_ascii=False) def digest(o):return hashlib.sha256(canon(o).encode()).hexdigest() P=(-3,-2,1,2,3) # EXACT paper topology, not axis coordinates rank={x:i+1 for i,x in enumerate(P)} def delta(a,b):return rank[b]-rank[a] def balanced(a,observer='observer-A',family='family-A'): a=Fraction(a) return {'class':'BALANCED','operands':[[a.numerator,a.denominator],[-a.numerator,a.denominator]],'origin':1,'whole':'whole-A','observer':observer,'family':family,'path':['source-positive','source-negative'],'rule':'STANDARD-V1-EQ20','projection':0} records=[balanced(n) for n in range(1,1001)] text=canon(records) (ROOT/'balanced_records.json').write_text(text) readback=json.loads((ROOT/'balanced_records.json').read_text()) recovery=sum(Fraction(*x['operands'][0])==n and sum(Fraction(*a) for a in x['operands'])==0 for n,x in enumerate(readback,1)) base=balanced(9);mutations={} for k,v in {'operands':[[10,1],[-10,1]],'observer':'observer-B','family':'family-B','path':['source-negative','source-positive'],'rule':'OTHER','whole':'whole-B'}.items(): x=dict(base);x[k]=v;mutations[k]=digest(x)!=digest(base) zero_classes=[{'class':c,'reason':c.lower(),'origin':1,'observer':'observer-A','projection':0} for c in ['ABSENT','UNKNOWN','UNTRANSLATED','BASELINE','BALANCED','EQUILIBRIUM','INVALID']] exact=[{'numerator':100+10*c+t,'scale':100} for c in range(1,10) for t in range(1,10)] node_script="const fs=require('fs'),crypto=require('crypto');const x=JSON.parse(fs.readFileSync(process.argv[1],'utf8'));function c(x){if(Array.isArray(x))return '['+x.map(c).join(',')+']';if(x&&typeof x==='object')return '{'+Object.keys(x).sort().map(k=>JSON.stringify(k)+':'+c(x[k])).join(',')+'}';return JSON.stringify(x)};console.log(crypto.createHash('sha256').update(c(x)).digest('hex'))" node_digest=subprocess.check_output(['node','-e',node_script,str(ROOT/'balanced_records.json')],text=True).strip() gradient=[{'from':a,'to':b,'scalar':b-a,'topological':delta(a,b)} for a,b in zip(P,P[1:])] report={'scope':'Reference realization of paper equations. Not full ZCG production conformance; not jitter qualification.', 'sources':{'standard':'https://drive.google.com/file/d/1VE4Nh2Dg0yosmTn-gyJOYVNza284FaWL/view?usp=drivesdk','law3':'https://drive.google.com/file/d/1_vNOhRS8s8alw7j4TRcpnTwhNf1LnP0a/view?usp=drivesdk'},'verbatim_author_definitions':['0.297 is a literal JITTER function thats it','ORIGINS have NO 1,1 or 1,1,1 the ONLY have 1'], 'topology':{'paper_domain':P,'gradients':gradient,'scalar_total':sum(x['scalar'] for x in gradient),'topological_total':sum(x['topological'] for x in gradient),'pair_cases':25,'antisymmetric':all(delta(a,b)==-delta(b,a) for a,b in itertools.product(P,repeat=2)),'composition_cases':125,'composition_holds':all(delta(a,b)+delta(b,c)==delta(a,c) for a,b,c in itertools.product(P,repeat=3)),'self_displacement':delta(1,1),'active_origin':1},'causal_retention':{'balanced_records':1000,'distinct_scalar_outputs':len({x['projection'] for x in records}),'distinct_canonical_states':len({canon(x) for x in records}),'recovered_after_storage':recovery,'mutations_change_digest':mutations,'digest_python':digest(records),'digest_node':node_digest,'cross_language_digest_equal':digest(records)==node_digest},'typed_zero':{'classes':len(zero_classes),'distinct_canonical_states':len({canon(x) for x in zero_classes}),'distinct_projections':len({x['projection'] for x in zero_classes})},'coordinate_exactness':{'tested_coordinates':len(exact),'distinct_integer_scale_encodings':len({canon(x) for x in exact}),'float_same_value_comparison':(.1+.2)==.3,'exact_same_value_comparison':Fraction(1,10)+Fraction(2,10)==Fraction(3,10)},'boundary_conflict':{'law3_register_unknown':-1,'standard_requires_unknown_class':True,'conclusion':'A loopback register value alone does not preserve unknown, invalid and baseline classification; a typed state envelope is required. Historical policies require version-specific application.'}} (ROOT/'results.json').write_text(json.dumps(report,indent=2)) print(json.dumps(report,indent=2))