{
  "item": "pi-five",
  "status": "blocked_incomplete",
  "credit": "Taylor (gtmcknight) authored the original replica, Gaussian filter, tables, dynamic program and qmdp solver. This report and prototype build on that work.",
  "blocked": {
    "step": "regenerate_saved_action_values",
    "error": "timeout 470 terminated the unmodified pinned dp.py solve with exit 124 before convergence or saved VN arrays. No complete probability-axis policy or full Q scores were produced."
  },
  "hashes": {
    "repository": {
      "url": "https://github.com/gtmcknight/amm-sim",
      "commit": "4812a6382311624e1506aca131ca35c378f930d9",
      "verified_head": "4812a6382311624e1506aca131ca35c378f930d9"
    },
    "artifacts": {
      "qt1": {
        "sha256": "8a6e303b662e1a5ea9bb47f31acedd3988ef65b3ddb66d074517aa59ad41ca40",
        "bytes": 62223,
        "url": "https://api.imdnotdead.fun/artifacts/8a6e303b662e1a5ea9bb47f31acedd3988ef65b3ddb66d074517aa59ad41ca40",
        "match": true
      },
      "TC": {
        "sha256": "d3c849db2ac31e567b57e52b80b86e8c24c842e5b4125b9d75c78e3cb07115b9",
        "bytes": 23156,
        "url": "https://api.imdnotdead.fun/artifacts/d3c849db2ac31e567b57e52b80b86e8c24c842e5b4125b9d75c78e3cb07115b9",
        "match": true
      },
      "COMBO": {
        "sha256": "d360bea6c8c982717b7b43a8069a87013169c89ee3e4da25622db4d880b936d4",
        "bytes": 25626,
        "url": "https://api.imdnotdead.fun/artifacts/d360bea6c8c982717b7b43a8069a87013169c89ee3e4da25622db4d880b936d4",
        "match": true
      },
      "QMS1": {
        "sha256": "17d249ab0c33fc44931d9b105cf3f9e3846a560bd518b67310c2a56defacdecc",
        "bytes": 29486,
        "url": "https://api.imdnotdead.fun/artifacts/17d249ab0c33fc44931d9b105cf3f9e3846a560bd518b67310c2a56defacdecc",
        "match": true
      }
    },
    "extracted": {
      "qmref.py": {
        "sha256": "1dfc9b7a3c2237ff7a93dd9f0af54b9bdab16f2ce0a7eb00784cb4432598db92",
        "bytes": 7739,
        "published_sha256": "1dfc9b7a3c2237ff7a93dd9f0af54b9bdab16f2ce0a7eb00784cb4432598db92",
        "match": true
      },
      "twocomp.py": {
        "sha256": "9d3c1833321493fb51bbde4e1b4dabc2f8978bd6d774ee2af8dc8aed13f0f0af",
        "bytes": 11202,
        "published_sha256": "9d3c1833321493fb51bbde4e1b4dabc2f8978bd6d774ee2af8dc8aed13f0f0af",
        "match": true
      },
      "combo.py": {
        "sha256": "c5b711a0b4fb4783e8879a484bf87a427171f4a11aa5eb5ec3513c24ead1a796",
        "bytes": 5929,
        "published_sha256": "c5b711a0b4fb4783e8879a484bf87a427171f4a11aa5eb5ec3513c24ead1a796",
        "match": true
      },
      "blob.bin": {
        "sha256": "3ac7cb8811ecfb6a17f499aa4e9b70dd55f7fb6432b3aec3b904e11a3dece38e",
        "bytes": 10167,
        "published_sha256": "3ac7cb8811ecfb6a17f499aa4e9b70dd55f7fb6432b3aec3b904e11a3dece38e",
        "match": true
      },
      "Strategy.sol": {
        "sha256": "c68887cff61180e12ba2b1ceb333edf76a830f91f63b5d775a8806fb9ec08aca",
        "bytes": 42990,
        "published_sha256": "c68887cff61180e12ba2b1ceb333edf76a830f91f63b5d775a8806fb9ec08aca",
        "match": true
      }
    },
    "pinned_source_files": {
      "README.md": {
        "sha256": "02d2b51f17adbb5411a2a67f7a37255143ba381a73ff10abba557d7d23c0cef2",
        "bytes": 10483,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/README.md"
      },
      "gates.py": {
        "sha256": "603280c1f595ca163ffaf2ba1ebdc7945fdb08dabae67fc53c922d39e1cce604",
        "bytes": 792,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/gates.py"
      },
      "replica2.py": {
        "sha256": "6e37b4e61e1ffa5ffb1e43912ddb8659105989aa986eb48fcd1d7608f8dca685",
        "bytes": 7503,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/replica2.py"
      },
      "evalpol.py": {
        "sha256": "6e67667bfed7798bdd3384652a6efc6ba0b1fce653740d0f9af2bcbcb8e6a27c",
        "bytes": 4610,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/evalpol.py"
      },
      "real.py": {
        "sha256": "1305b5333731c046c3e6736cc2578eff4635c88132a39c22f5780d78aef2c81e",
        "bytes": 9586,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/real.py"
      },
      "latt.py": {
        "sha256": "925c0fe996b19fd51fb79a85d5e4dba4bc2f5453d0a156cc1e480f65a6a00cc8",
        "bytes": 8893,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/latt.py"
      },
      "pol_mid.json": {
        "sha256": "efbb5ee102db4d312f64565d9bf7232b6becbe02b624164f744a402bbbf2983b",
        "bytes": 780061,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/pol_mid.json"
      },
      "qm_k1e-5.json": {
        "sha256": "5ff53e42ca87390e5f65d1caa3f7a480e67a8212fb0670274dfd562b05ba1afd",
        "bytes": 7892018,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/qm_k1e-5.json"
      },
      "dp.py": {
        "sha256": "ca4e7c378d23c46c7def4716611135c471a831d15234b984fe30d58d9eec5734",
        "bytes": 15595,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/dp.py"
      },
      "qmdp.py": {
        "sha256": "63b8c35048718c37eb0a5dae9e70849fa3af257c335e4a2e3a625c833f1dc1eb",
        "bytes": 8609,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/qmdp.py"
      },
      "calib_out_2048.json": {
        "sha256": "fdf24c7aa2b604d770336a5783276da8ed4d50bca9dbcc02e98b4da58f608d26",
        "bytes": 2948144,
        "url": "https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/calib_out_2048.json"
      }
    }
  },
  "gates_output": "seed   perfect-info      gaussian+plain    gaussian+qm       lattice+qm\n10000  448.261189  443.455598  443.522608  443.663520\n10001  576.779199  571.463409  571.623551  571.977293\n10002  531.886497  525.168028  525.865859  526.411631\n",
  "gates": {
    "P": {
      "passed": true,
      "comparisons": 12,
      "precision_decimals": 6,
      "before_changes": true
    },
    "actual_qt1": {
      "passed": true,
      "seeds": [
        10000,
        10001,
        10002
      ],
      "edges": [
        443.1017411146794,
        571.454483381923,
        525.908441161234
      ],
      "expected_6dp": [
        443.101741,
        571.454483,
        525.908441
      ],
      "elapsed_seconds": 24.815685029141605
    },
    "Q": {
      "passed": false,
      "reason": "No candidate chosen, frozen, or scored."
    },
    "F": {
      "status": "not_applicable",
      "reason": "Replica-only item; no contract."
    }
  },
  "task_findings": {
    "verified": "Taylor Gaussian+qm is not qt1; both distinct baseline gates reproduce. All four artifact hashes and all five extracted published hashes match.",
    "equations": [
      "Anchor at retail mean mt: w=ln(own spot/exp(mt))/H; delta=(lp-mt)/H; Ra=ln(s2_arb/exp(lp))/H; Rr=ln(s2_ret/exp(mt))/H. H=5e-4.",
      "Uarb(a,b)=VN0(w-delta,Ra,a-delta,b+delta).",
      "Uret(a,b)=sum_e q_sd(e) VN1(w-e,r(e),a-e,b+e), where r(e)=Rr-e if synced_ret else clip(Rr-e,-6,6).",
      "At each pi knot, U_pi=pi*Uarb+(1-pi)*Uret; choose argmax over a common physical quote grid, then use Taylor local parabolic refinement. Interpolate the five optimized knot results linearly in pi.",
      "Averaging argmax branch quotes generally differs from argmax of expected action values; the synthetic test demonstrates that distinction."
    ],
    "remaining_parameterization": "Preserving COMBO belief requires delta, retail sd, separate branch rival estimates Ra/Rr and retail synced mode, in addition to own displacement and pi. A pi-only axis with a moment-matched Gaussian does not preserve that belief. The prototype exposes these inputs but does not build their full tensor or choose knots. Arb phase is 0, retail phase is 1 for an ambiguous first callback.",
    "prototype_information_bonus": "kappa=0 explicitly; no claim of matching the information bonus in COMBO's kappa=1e-5 quote tables. No candidate setting was selected.",
    "filter": "No COMBO filter edits. No integrated policy was built; fixed-filter and hidden-input invariance have therefore NOT been certified."
  },
  "seed_coverage": {
    "choose": {
      "requested": [
        64000,
        65023
      ],
      "evaluated": [],
      "n": 0
    },
    "report": {
      "requested": [
        10000,
        12047
      ],
      "candidate_evaluated": [],
      "n": 0
    },
    "baseline_only": [
      10000,
      10001,
      10002
    ],
    "report_used_for_selection": false,
    "engine_seeds": []
  },
  "frozen_spec": null,
  "policy": {
    "choose": {
      "vs_COMBO": null,
      "vs_qt1": null
    },
    "report": {
      "vs_COMBO": null,
      "vs_qt1": null
    },
    "sum_d": null,
    "sum_d2": null,
    "paired_schema": "When measured: n, mean_diff, se=sample_sd(diff)/sqrt(n), worst5=[{seed,diff}], sum_d, sum_d2. No fabricated empty-sample scores."
  },
  "convergence": {
    "converged": false,
    "last_logged_sweep": 10,
    "last_logged_diff": 0.0217,
    "last_logged_gain_per_run": 551.817,
    "last_logged_solver_seconds": 449,
    "note": "Intermediate solver gain is not a replica policy score. Later sweeps were not logged before timeout.",
    "observed_log": [
      "geometry 44.2s  nq 62  h [0.55067104 0.34722702 0.2331101 ]  grid NW 321 N2 49 NA 43",
      "sweep 1 t 148s gain/step 0.0576476 -> 576.476 per run  diff 3.40e-02",
      "sweep 2 t 182s gain/step 0.0583772 -> 583.772 per run  diff 3.05e-02",
      "sweep 3 t 214s gain/step 0.0582014 -> 582.014 per run  diff 2.82e-02",
      "sweep 10 t 449s gain/step 0.0551817 -> 551.817 per run  diff 2.17e-02"
    ]
  },
  "table": {
    "pi_knots": [
      0,
      0.25,
      0.5,
      0.75,
      1
    ],
    "shape": null,
    "bytes": null,
    "compression_error": null,
    "generated": false
  },
  "checks": {
    "synthetic_operator": "PASS: synthetic pi endpoints, pre-argmax mixture, pi interpolation, zero-variance direct values, multilinear interpolation, identical components",
    "original_action_value_endpoints": "not_run",
    "live_hidden_input_invariance": "not_run",
    "complete_choose_report": "not_run"
  },
  "runtime": {
    "solver_timeout_seconds": 470,
    "solver_exit_code": 124,
    "total_wall_seconds": null,
    "setup": "System numpy import failed. venv failed: ensurepip is not available. Scratch-local pip --target installation then succeeded.",
    "versions": {
      "python": "3.12.3",
      "numpy": "2.5.4",
      "numba": "0.68.1",
      "llvmlite": "0.50.0"
    },
    "solver_environment": {
      "DP_SAVEVN": "1",
      "DP_AMINL": "-12",
      "DP_NA": "43",
      "NUMBA_NUM_THREADS": "8"
    },
    "commands": [
      "python3 -I gates.py",
      "timeout 470 python3 -I <explicit-local-import wrapper invoking dp.py solve 0.8 9.45 20 scratch/regen.json>",
      "python3 -I test_pi_values.py"
    ]
  },
  "rerunnable_source": {
    "pi_values.py": {
      "sha256": "260497f90818d565957ac5390260fe158401f4e5d77a7839357499dac2ac35f2",
      "text": "\"\"\"Pi-five action-value extension of Taylor (gtmcknight)'s qmdp.py.\nResearch prototype, not a validated policy. All offsets are in lattice units.\nInputs use explicit local imports; invoke with python3 -I through a local driver.\n\"\"\"\nimport math\n\nPI_KNOTS = (0., .25, .5, .75, 1.)\n\n\ndef mix_actions(arb_values, retail_values, pi):\n    \"\"\"Expected action values BEFORE argmax; both arrays share physical quotes.\"\"\"\n    if not 0 <= pi <= 1:\n        raise ValueError('pi outside [0,1]')\n    if (len(arb_values) != len(retail_values) or not arb_values\n            or any(len(ar) != len(rr) for ar,rr in zip(arb_values,retail_values))):\n        raise ValueError('empty or incompatible action grids')\n    return [[pi * a + (1-pi) * r for a, r in zip(ar, rr)]\n            for ar, rr in zip(arb_values, retail_values)]\n\n\ndef optimize(U, own_w, amin):\n    \"\"\"Taylor's qtab tie breaking and local parabolic quote refinement.\"\"\"\n    n = len(U)\n    if any(len(row) != n for row in U):\n        raise ValueError('action grid must be square')\n    bi, bj = max(((i,j) for i in range(n) for j in range(n)), key=lambda ij: U[ij[0]][ij[1]])\n    al, bl = float(amin + bi), float(amin + bj)\n    if al <= own_w:\n        al = float(own_w)\n    elif 0 < bi < n-1 and amin + bi - 1 >= own_w:\n        vm,v0,vp = U[bi-1][bj],U[bi][bj],U[bi+1][bj]\n        den = vm - 2*v0 + vp\n        if den < 0: al += max(-.5,min(.5,.5*(vm-vp)/den))\n    if bl <= -own_w:\n        bl = float(-own_w)\n    elif 0 < bj < n-1 and amin + bj - 1 >= -own_w:\n        vm,v0,vp = U[bi][bj-1],U[bi][bj],U[bi][bj+1]\n        den = vm - 2*v0 + vp\n        if den < 0: bl += max(-.5,min(.5,.5*(vm-vp)/den))\n    return al,bl,U[bi][bj],bi,bj\n\n\ndef pi_table(arb_values, retail_values, own_w, amin):\n    return [optimize(mix_actions(arb_values,retail_values,p),own_w,amin) for p in PI_KNOTS]\n\n\ndef interpolate_pi(table, pi):\n    \"\"\"Interpolate optimized table knots, not the two optimized branch quotes.\"\"\"\n    if not 0 <= pi <= 1: raise ValueError('pi outside [0,1]')\n    k = min(3,int(pi*4)); f = pi*4-k\n    return tuple(table[k][i]*(1-f)+table[k+1][i]*f for i in (0,1))\n\n\ndef grid_pos(knots, x):\n    if x <= knots[0]: return 0,0.\n    if x >= knots[-1]: return len(knots)-2,1.\n    lo,hi = 0,len(knots)-1\n    while hi-lo > 1:\n        m=(lo+hi)//2\n        if knots[m] <= x: lo=m\n        else: hi=m\n    return lo,(x-knots[lo])/(knots[lo+1]-knots[lo])\n\n\ndef linear_pos(x,n):\n    x=max(0.,min(n-1.,x)); i=min(n-2,int(x)); return i,x-i\n\n\ndef read_value(V, w, rival, a, b, w0, amin, rival_knots):\n    \"\"\"Four-dimensional linear interpolation with original qmdp boundary clamps.\n    V is Taylor's saved VN[phase], shape [NW,N2,NA,NA].\n    \"\"\"\n    axes=(linear_pos(w+w0,len(V)),grid_pos(rival_knots,rival),\n          linear_pos(a-amin,len(V[0][0])),linear_pos(b-amin,len(V[0][0])))\n    total=0.\n    for mask in range(16):\n        ix=[];weight=1.\n        for d,(i,f) in enumerate(axes):\n            bit=(mask>>d)&1;ix.append(i+bit);weight*=f if bit else 1-f\n        if weight:\n            total+=weight*float(V[ix[0]][ix[1]][ix[2]][ix[3]])\n    return total\n\n\ndef branch_values(V, own_w, rival, mean_shift, errors, weights,\n                  w0, amin, na, rival_knots, clipped, fb=6.):\n    \"\"\"One component's values for a COMMON grid anchored at retail mean mt.\n    own_w=ln(own spot/exp(mt))/H. mean_shift=(component mean-mt)/H.\n    rival=ln(component rival estimate/exp(component mean))/H.\n    Arb: VN0, mean_shift=(lp-mt)/H, errors=[0], weights=[1], clipped=True.\n    Retail: VN1, shift=0, qmdp.ebel(sd), clipped=not synced_ret.\n    Gaussian quadrature and finite-grid clamping inherit qmdp's approximation.\n    \"\"\"\n    if len(errors)!=len(weights) or abs(sum(weights)-1)>1e-10:\n        raise ValueError('quadrature must be normalized')\n    out=[[0.]*na for _ in range(na)]\n    for e,p in zip(errors,weights):\n        shift=mean_shift+e; r=rival-e\n        if clipped: r=max(-fb,min(fb,r))\n        for ia in range(na):\n            for ib in range(na):\n                out[ia][ib]+=p*read_value(V,own_w-shift,r,amin+ia-shift,\n                                         amin+ib+shift,w0,amin,rival_knots)\n    return out\n\n\ndef solve_cell(V0, Vr, own_w, delta, ra, rr, errors, weights,\n               w0, amin, na, band_knots, rival_knots, synced_ret):\n    \"\"\"One table cell across all five pi knots. Kappa=0, no information bonus.\n    Retain delta, both rival estimates and retail sd as independent table axes.\n    Phase is 0 for arb, caller-selected retail phase (COMBO uses 1).\n    \"\"\"\n    ua=branch_values(V0,own_w,ra,delta,[0.],[1.],w0,amin,na,band_knots,True)\n    ur=branch_values(Vr,own_w,rr,0.,errors,weights,w0,amin,na,rival_knots,not synced_ret)\n    return pi_table(ua,ur,own_w,amin)\n",
      "status": "synthetic-tested prototype only"
    },
    "test_pi_values.py": {
      "sha256": "74269e9124c38b9c076048ac4705e86727d99653a1fc7b0dc9da2ea5891aa9a2",
      "text": "\"\"\"Synthetic operator checks; credit Taylor (gtmcknight) for qmdp's action semantics.\nThese checks do not certify the production VN arrays, policy, or full Q gate.\n\"\"\"\nimport pathlib,sys\nsys.path.insert(0,str(pathlib.Path(__file__).resolve().parent))\nfrom pi_values import *\na=[[-(i-1)**2-(j-1)**2 for j in range(5)] for i in range(5)]\nr=[[-4*(i-3)**2-4*(j-3)**2 for j in range(5)] for i in range(5)]\nt=pi_table(a,r,0,0)\nassert t[0]==optimize(r,0,0) and t[-1]==optimize(a,0,0)\nassert t[2][:2] != tuple((t[0][k]+t[-1][k])/2 for k in (0,1))\nassert interpolate_pi(t,.25)==t[1][:2]\nassert all(optimize(a,0,0)==z for z in pi_table(a,a,0,0))\nV=[[[[float(100*w+10*r+2*a+b) for b in range(5)] for a in range(5)] for r in range(3)] for w in range(5)]\nU=branch_values(V,0,0,0,[0],[1],2,-2,5,[-1,0,1],False)\nassert all(U[a][b]==V[2][1][a][b] for a in range(5) for b in range(5))\nassert read_value(V,.5,.5,-.5,.5,2,-2,[-1,0,1])==270.5\nassert all(x==optimize(U,0,-2) for x in solve_cell(V,V,0,0,0,0,[0],[1],2,-2,5,[-1,0,1],[-1,0,1],False))\nprint('PASS: synthetic pi endpoints, pre-argmax mixture, pi interpolation, zero-variance direct values, multilinear interpolation, identical components')\n",
      "status": "synthetic-tested prototype only"
    }
  },
  "rebuild_recipe": {
    "prototype": "Extract rerunnable_source filenames and text into one directory; run python3 -I test_pi_values.py. Standard library only. This reproduces synthetic checks, not a complete policy or full Q.",
    "baseline": "Checkout the verified commit. Run python3 -I gates.py from research/solved. Extract the first python fence after qt1 ## Python reference with one final newline; similarly extract TC ## Code and COMBO Complete `combo.py`; decode the base64 fence under QMS1 ## Data. Verify hashes in this report. Explicitly insert the local solved directory and extraction directory into sys.path under python3 -I. Run replica2.run(seed, QMRef(blob_path)) for each baseline seed with a fresh policy.",
    "action_values": "Original README command: DP_SAVEVN=1 DP_AMINL=-12 DP_NA=43 python dp.py solve 0.8 9.45 20 pol_mid.json. Here it was invoked via python3 -I with explicit local imports and timeout 470, targeting scratch/regen.json. It did not finish; no regenerated table checksum exists.",
    "unfinished": "Checkpoint/resume the DP across bounded commands, verify original action-value limits, implement and chunk the full parameter tensor, integrate with the unchanged COMBO filter, choose only on 64000..65023, freeze generator/model digest, score full 10000..12047 paired against both COMBO and actual qt1.",
    "offline_scope": "Only the embedded synthetic prototype/test are offline complete. No NumPy/Numba installation, original source archive, trained table or executable candidate is delivered; dependencies used temporarily are not a shipped policy."
  },
  "limitations": [
    "This is a failure report with a tested algebraic prototype, not completion of the requested experiment.",
    "No table generator/slab driver, trained model, source freeze, policy integration or full paired scoring.",
    "Synthetic checks are not the requested comparisons against original saved action values.",
    "No live-policy hidden-input invariance test.",
    "Finite action-grid clamping can alter endpoint equivalence for nonzero component separation; original-value tests are required before use.",
    "No gas, bytecode, engine or leaderboard claim."
  ]
}
