"""Illustrative dimensionless arithmetic, not measured remuneration or validated policy."""
from pathlib import Path
import csv
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
R=Path(__file__).parent
xs=[0.5+i*0.025 for i in range(141)]
with (R/"normalized-rule.csv").open("w",newline="",encoding="utf-8") as f:
 w=csv.writer(f);w.writerow(["relative_C","inverse_square_A_ratio","inverse_linear_comparator"])
 w.writerows((x,1/x**2,1/x) for x in xs)
fig,ax=plt.subplots(figsize=(8,4.7),layout="constrained")
ax.plot(xs,[1/x**2 for x in xs],label="Stated equation: A / A₀ = (C / C₀)⁻²",color="#6937b8",lw=2.5)
ax.plot(xs,[1/x for x in xs],label="Inverse-linear wording: A / A₀ = (C / C₀)⁻¹",color="#267ea8",ls="--",lw=2)
ax.scatter([1,2],[1,.25],color="#6937b8",zorder=4)
ax.annotate("Double C → one quarter of A",(2,.25),xytext=(2.1,1.6),arrowprops={"arrowstyle":"->","color":"#444"},fontsize=10)
ax.set(xlabel="Evaluation coefficient relative to baseline, C / C₀",ylabel="Calculated remuneration relative to baseline, A / A₀",title="What the equation implies — with performance B held fixed",xlim=(.5,4),ylim=(0,4.2))
ax.grid(alpha=.2);ax.legend(fontsize=9)
fig.text(.02,-.055,"Illustrative calculation, not observations. B and C₀ positive and fixed; C > 0. No fairness or benefit is established.",fontsize=9)
fig.savefig(R/"normalized-rule.svg",bbox_inches="tight")
fig.savefig(R/"normalized-rule.png",dpi=160,bbox_inches="tight")
assert 1/2**2==.25 and 1/.5**2==4
print("141 analytic rows and two figure formats generated; anchor arithmetic passed.")
