{
 "idea": "Router identity read two-sided. After an own retail leg, an interior split of the router equalizes marginal prices, so the rival's post-trade spot equals cand = s*(1-fb)/G2 (pool bought X) or s*G2/(1-fa) (pool sold X), exactly; a corner fill (whole order to us) gives only a bound on it. TellPolicy/real.py already uses cand as a one-sided bound (min/max). Change: when cand lies on the side the bound cannot move, move s2h toward cand in log by alpha.",
 "finding_exact": "Diagnostic on seeds 60000..60003 with the replica's true rival spot: 27,216 of 30,361 own retail legs (90%) are interior, and there cand equals the rival's post-trade spot (|log err| < 1e-9). But a leg's paid amount is (r*(y2+g2*size)-y1)/d or the whole order: one number with two unknowns (rival reserve and order size), on no grid. We found no exact test that tells interior from corner fills. Where cand would move s2h against the bound (3,867 legs), only 744 (19%) are interior. There cand rms error is 7.96 bps vs s2h's 5.83 bps, so the read can only be a partial pull. Nothing exact about the true price follows, because the rival's pre-leg reserve depends on the unknown order size. Conclusion: no new exact information beyond what real.py already uses as a bound; a soft two-sided use gains a little.",
 "frozen_params": {
  "base": "tellpol.TellPolicy soft=1 qm=qm_k1e-5.json",
  "alpha": 0.35,
  "alpha2": 0.35
 },
 "tuning_summary": {
  "seeds": "60000..60255, paired vs alpha=0 (identical to TellPolicy)",
  "alpha_0.1": "+0.046 se 0.012",
  "alpha_0.25": "+0.081 se 0.017",
  "alpha_0.25_alpha2_0": "+0.076 se 0.015",
  "alpha_0.35": "+0.089 se 0.019",
  "alpha_0.5": "+0.088 se 0.022",
  "alpha_0.75": "+0.063 se 0.025"
 },
 "holdout_paired_vs_tell_qm": {
  "n": 2048,
  "mean_diff": 0.091,
  "se": 0.0071,
  "sum": 186.3655,
  "sumsq": 226.4262,
  "worst5": [
   [
    11696,
    -2.1039
   ],
   [
    10822,
    -1.6081
   ],
   [
    11022,
    -1.5135
   ],
   [
    11277,
    -1.326
   ],
   [
    11413,
    -1.2409
   ]
  ]
 },
 "holdout_paired_vs_local_tellpol_rerun": {
  "n": 2048,
  "mean_diff": 0.093,
  "se": 0.007,
  "sum": 190.511,
  "sumsq": 225.6556,
  "worst5": [
   [
    11696,
    -2.0865
   ],
   [
    11022,
    -1.5345
   ],
   [
    10822,
    -1.5252
   ],
   [
    11277,
    -1.3462
   ],
   [
    10676,
    -1.1806
   ]
  ]
 },
 "holdout_vs_HA": "+6.998 se 0.064 (10000..11023), +7.134 se 0.059 (11024..12047); TellPolicy local rerun +6.900 / +7.045",
 "libm_note": "This machine's libm moves the gate edges: TellPolicy gives 446.79826, 574.32668, 529.63799 on 10000..10002 vs README 446.7525, 574.32668, 529.60915. Local TellPolicy vs tell_qm.json: -0.002 se 0.0012 over 2048 seeds. Against the local rerun the idea scores +0.093 se 0.007, so the gain is not a libm artifact.",
 "verdict": "Positive but below the 0.2 bar for A's next contract: +0.09 se 0.007 on the replica holdout.",
 "portability": "State: none new (uses s2h, fb/fa in force, s, cnt that the Gaussian+qm contract already keeps). Ops per retail callback when the bound does not bind: one ln(cand) - ln(s2h) (ln(s) and ln(s2h) are already computed for lookups), one multiply by alpha, one exp, and a second table lookup if the fee is recomputed after the move (or do the move before the single lookup, which is the same thing). Est. +60..120 bytes; gas about +3k..+6k on the affected calls (one exp, or a few hundred if the log-domain s2h is kept), plus a lookup only if not fused. Within the 245,000 gas peak if fused before the existing lookup.",
 "code_file": "give.py (module beside run.py; class GivePolicy)",
 "code_sha256": "8d871a6b4fe3fda47404282239939f558b1656a651fcc03eb86f1d4f56cc1b3e",
 "code_zb64": "eNqNVE1v2zAMvftXENmh1uq6ibHT+gHsUHSnYSh66M2gY7kRpkiaJcc1hv33UbJjeWkL1EAQmXokHx9Jr1arRy7lTy3FdoBzaHXneAui5soJN0DLsQa0gOB6fWHJXgO3TuzRcdANuB2HVhxQnlkw2roL12LNwRrt8uRb42OhAt0riuRQSJD8ORs9Aj4g4foGtqhqSC1xgSdwGjrL4BJujxdVN8ATA5Q9DjaDydzvuAoUrJHCQU9EhaKcQrd5sqhLKzlQRG4DuNKdqq8oltkh7PWBzLbYUdIe23rKJxRI/cxihuAEtSawIsaVUHW+Wq0SsTe6dUB67DLQRM0ONvl+93BHHLXNDdnzWrQK9zw9vmNl/X9alo2QvCwZS8hrvBPK8tal6wx8EHaMT32QGTgqyWgZjVT2FgvfoIfkvqCUHpffF0mylWgt3IsDHzVIJ988ysK+JkBPzRsoS6GEK0vfgCaDRyrFuJsfWvEJ5B8yUYZabF3qj7qFP3/ZfOs981HTG2ikxoDKjTbpWTCfZbDO1+wtj+Idl4J8IooxcvoEEv1U0RxZP4AI1nEzx3xdZf5mbWwuXasyzOx0LWxJs5YBvtCP/l0GdKJDI/H5VJGmoj41uCb6gWZTTXwbjKp1XrU3eH0scZRLNGNsAmJbefkXktMGkbjgZ3cp62iOhP1Di9i1yvOKnSCGA63by2wJW0BVwWdINxT4wtfqN5KmjIiMZIFLywOGrJczENeRNB6lGWkea9iqsPSbKUJkPDv6vfQM0sDkdsTQmrLT9CPgOgKWgvlVHSORXPhhOaZQlN7vdc5fTBoO9ElII5FzikjyzDeeCCMBXkNPh94Oahuqe2w7Pl+Zne/D5h2RojS9lyUm8SkDfs+IzoZ/uYK++B8yUz5BLgbZz/GxV1LrX51J+4wCZZ5WNtZkf9OXKSAOU4CTuhbzT7EecvoI7U2TNhXLFm8YvSbxx/TJP1Uq94U=",
 "commands": [
  "B=https://raw.githubusercontent.com/gtmcknight/amm-sim/66604b3426d8e97a73e2c39940b9b4dece51cc73/research; curl -LsSf $B/tell/fetch.sh -o test/scratch/fetch.sh && sh test/scratch/fetch.sh $B test/scratch/amm",
  "python3 -I run.py give:GivePolicy 60000 256 tune_A.json soft=1 qm=qm_k1e-5.json alpha=A   (A in 0,0.1,0.25,0.35,0.5,0.75; and alpha=0.25 alpha2=0)",
  "python3 -I pair.py tune_A.json tune_a0.json",
  "python3 -I run.py give:GivePolicy 10000 1024 hold_a.json soft=1 qm=qm_k1e-5.json alpha=0.35; same 11024 1024 hold_b.json",
  "python3 -I run.py tellpol:TellPolicy 10000 1024 base_a.json soft=1 qm=qm_k1e-5.json; same 11024 1024 base_b.json",
  "python3 -I pair.py hold_a.json,hold_b.json tell_qm.json  (+ stats script for sum/sumsq)"
 ],
 "not_done": [
  "No exact interior/corner test was found; we did not search further for float-level signatures of the router quotient (d=0 fallback size/2, clamp at u1=size).",
  "Tuned on 256 seeds only; we did not try alpha conditioned on order size, on the gap between cand and s2h, or on fees.",
  "No Solidity port or engine run (out of scope for this item)."
 ],
 "sources": "see sources.json"
}