Moves all classification authority from Python into Lean:
- Adds `0-Core-Formalism/lean/Semantics/PistClassifyTrace.lean` executable.
Reads a raw trace JSON and emits spectral radius, RRC shape, and tactic
family using `Semantics.PIST.Spectral` and `Semantics.PIST.Classify`.
- Registers `pist-classify-trace` in `lakefile.toml`.
- Fixes `Semantics.PIST.Spectral` power iteration to handle directed
transition matrices:
- `symmetrize` now preserves half-integer weights as Q16_16 raw values.
- `matVecMul` uses saturated Q16_16 arithmetic to prevent overflow.
- Rewrites `4-Infrastructure/shim/pist_trace_classify_offline.py` as a pure
I/O wrapper: reads JSON, calls the Lean classifier, optionally calls
`rrc-watchdog`, and emits the combined JSON. Removes Python-side spectral
computation, shape thresholds, tactic heuristic, and KNN.
- Updates `AGENTS.md` and `4-Infrastructure/AGENTS.md` with the new build
baseline and shim contract.
Verification:
- `lake build` → 8604 jobs, 0 errors
- Canary trace outputs match previous Python outputs to within Q16_16 rounding
(e.g., apply_chain λ_q16 = 59044 vs 59045).
- `python3 -m py_compile` on the rewritten shim passes.
This squashes all local history (768 commits) onto the scrubbed PR #90
baseline. Individual commits were lost during filter-repo corruption;
the working tree content is preserved intact.
Build: N/A (working tree state only)
- lakefile.toml: add Compiler lean_lib with 5 blessed roots
(Semantics.RRC.Emit, Semantics.AVMIsa.Emit, Semantics.AVMIsa.Run,
Semantics.ReceiptCore, Semantics.RRCLogogramProjection);
defaultTargets = ["Semantics", "Compiler"]
- PistSimulation.lean: restore goldenContractionEnergyDecrease theorem body
(was commented out as TODO forward-ref to arrayKineticEnergy); moved to
after burgersPhiEnergyStep where all dependencies are in scope;
proof stub retained with sorry + TODO(lean-port) comment
- AGENTS.md: document blessed Compiler surface, Goal A receipt shape,
quarantine table, pending proof work, and key Lean 4.30 API notes
Build: 3566 jobs, 0 errors (lake build)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AVMIsa.Emit (new, Semantics/AVMIsa/Emit.lean):
- Three canary programs: boolean NOT, AND, OR
- checkTopBool classifies Outcome State against expected value
- canaryReceipt mints a ReceiptCore.leanBuildReceipt keyed per-canary
- canaryLogogramReceipt maps allPassed → RRCLogogramProjection.LogogramReceipt
(uglyAsymmetricPruning / normal lane on pass; horribleManifoldTearing on fail)
- Minimal JSON serializer (no Float, no external deps, all ReceiptCore/RRC
fields faithfully encoded)
- emit : EmitResult collapses the whole pipeline into one call
- #eval output: valid JSON with schema avm_canary_emit_v1, all_canaries_passed
true, three receipts, rrc_logogram projectionAdmissible+mergeAdmissible true,
lane normalProjection — passes python3 -m json.tool
Adaptation.lean: replace ⟨UInt32_expr⟩ → ofRawInt N throughout
(Q16_16 is a Subtype {x:Int//...}; ⟨·⟩ needs both val + property;
ofRawInt handles clamping to range); same fix for inline let bindings
and Q16_16.mk literals in isLawful
TorsionalPIST.lean: replace { val := N } Fix16/Q16_16 struct literals with
Semantics.Q16_16.ofRawInt N (Fix16 is abbrev for Q16_16)
lakefile.toml: remove HybridTSMPISTTorus from PIST roots
(pre-existing sorry + property failures, zero importers, quarantined
pending Lean 4.30 port — still on disk, just not a build root)
Result: lake build PIST Semantics.AVMIsa.Emit → Build completed (3326 jobs)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
lakefile.toml (PIST lib roots):
- Remove "PISTMachine" — PISTMachine.lean does not exist; dead root
would cause lake build PIST to fail with "unknown module" error
- "Trace" was already added in the prior dirty change; committed here
paired with the file it requires
2-Search-Space/PIST/Trace.lean (new):
- Lean 4 tactic `trace_state_json "tag"` for Tier 2 flexure recording
- Emits structured goal-state JSON (target, hypotheses, goal_count)
prefixed with @@PIST_TRACE_JSON@@ sentinel to logInfo stdout
- Python trace bridge parses the sentinel to capture mid-proof state
- Namespace: PIST.Trace; no sorry, no float, no external deps beyond Lean
Generated with Devin (https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>