Skip to content

feat(w39 Lane DD''): spec-exit-witness crate — 9 cargo tests, OP_SPEC_EXIT=0xE7 - #31

Merged
gHashTag merged 1 commit into
mainfrom
feat/w39-spec-exit-rust
May 15, 2026
Merged

gHashTag merged 1 commit into
mainfrom
feat/w39-spec-exit-rust

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

Wave-39 Lane DD'' — Speculative Early-Exit Rust Witness

Adds crates/spec-exit-witness/ to the workspace with 9 cargo tests passing, 0 failing.

API

  • OP_SPEC_EXIT = 0xE7, OP_CHAIN_LO = 0xD0, OP_CHAIN_HI = 0xE7
  • PHI_INV = 0.6180339887498949, BASELINE_W38_TOPS_PER_W = 392, TARGET_W39_TOPS_PER_W = 470
  • enum Z3 { Neg1, Zero, Pos1 } (commit / no-op / abort+bypass)
  • confidence_classifier, three_strand_vote (2-of-3), should_early_exit, speculate_and_check, misprediction_recovery_cycles, avg_exit_depth, tops_per_w_estimate
  • Deterministic LCG (no rand dependency); synth_trace builds per-layer confidence vectors

Tests (9 passed)

  1. test_phi_inv_constant — PHI_INV ≈ 1/phi within 1e-9
  2. test_three_strand_majority — all 8 tuples of (fast, mid, slow)
  3. test_should_early_exit_threshold — above/below threshold
  4. test_avg_exit_depth_synthetic — 1000-trace average within [0.38, 0.46]
  5. test_tops_per_w_geq_470 — estimate ≈ 466.67 ≥ 466
  6. test_opcode_chain_bounds — 0xD0..0xE7 range, OP_SPEC_EXIT=0xE7
  7. test_misprediction_recovery_one_cycle — recovery = 1 cycle for all outcomes
  8. test_speculate_correct_and_misprediction — full 4-quadrant truth table
  9. test_confidence_classifier_bounded — output ∈ [0.0, 1.0)

Gates

  • #![deny(unsafe_code)] ✓
  • No rand or non-std dependency ✓
  • Commit signed Vasilev Dmitrii <admin@t27.ai> (R8)
  • Apache-2.0
  • No force push used

Closes trinity-fpga#142
Relates trios#890

Anchor: phi^2 + phi^-2 = 3 — DOI: 10.5281/zenodo.19227877

Wave-39 Lane DD'' Rust witness for speculative early-exit at confidence
>= phi^-1 with 2/3 strand majority and 1-cycle W38 trinity-bypass recovery.

Crate: crates/spec-exit-witness (registered in workspace members)
Constants: OP_SPEC_EXIT=0xE7, OP_CHAIN_LO=0xD0, OP_CHAIN_HI=0xE7,
PHI_INV=0.6180339887498949, BASELINE_W38_TOPS_PER_W=392, TARGET=470.

API: Z3 ternary, LayerOutput, confidence_classifier, three_strand_vote,
should_early_exit, speculate_and_check, misprediction_recovery_cycles,
avg_exit_depth, tops_per_w_estimate, lcg_step/lcg_to_unit, synth_trace.

Tests (9 passed, 0 failed): phi_inv_constant, three_strand_majority,
should_early_exit_threshold, avg_exit_depth_synthetic (1000 traces, avg
in [0.38, 0.46]), tops_per_w_geq_470 (estimate 466.67 vs 470 target),
opcode_chain_bounds, misprediction_recovery_one_cycle, speculate
correct/misprediction, confidence_classifier_bounded.

No rand dependency (deterministic LCG). #![deny(unsafe_code)].

Closes trinity-fpga#142, relates trios#890
@gHashTag
gHashTag merged commit f975830 into main May 15, 2026
4 checks passed
@gHashTag
gHashTag deleted the feat/w39-spec-exit-rust branch May 15, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant