Commit fdafd1a
committed
impl(sprint-11/wave-E): D-CSV-9 — 8-channel ↔ SPO-palette transcoder (Option R-3) at thinking-engine L3 commit boundary
Wave E other half — D-CSV-9 per plan §11 + L-12 Option R-3:
collapse the 8-channel `thinking_engine::layered::CausalEdge64`
(BECOMES / CAUSES / SUPPORTS / REFINES / GROUNDS / ABSTRACTS /
RELATES / CONTRADICTS) into one SPO-palette `causal_edge::CausalEdge64`
at the L3 commit boundary, and the inverse (lossy) projection back.
W-E1 (Sonnet) — `impl CausalEdge64` block in
`crates/thinking-engine/src/layered.rs` (+258 LOC including tests).
Public API
- `pub const CHANNEL_NAMES: [&str; 8]` — diagnostic labels matching
`causal-edge-64-thinking-engine-variant.md`
- `pub fn channel(&self, idx) -> i8` / `pub fn set_channel(&mut self,
idx, value)` — per-byte signed accessors (SIMD-friendly bitcast;
out-of-range idx is a defensive no-op on set, debug_assert on get)
- `pub fn dominant_channel(&self) -> usize` — max |net_strength|;
ties break to lowest channel idx (stable per L-12)
- `pub fn active_channel_count(&self) -> u8` — for confidence proxy
- `pub fn to_spo(&self, s_idx, p_idx, o_idx) -> SpoEdge` — Option R-3
collapse: dominant channel → (mantissa magnitude, causal_mask) per
the table in §11 D-CSV-9; mantissa sign = sign of dominant net;
freq = |net|/32 quantized to u8; conf = active_channel_count/8
quantized; direction triad = 0b000 (sign carried by signed mantissa
per L-9); W-slot = 0, truth = Crystalline, spare = 0 (caller stamps
later via `with_routing` / `with_spare`)
- `pub fn from_spo(spo: SpoEdge) -> Self` — inverse projection (lossy
by design — 8 channels collapse to 1 in the forward direction; the
inverse picks the dominant-equivalent channel and writes the
mantissa magnitude × frequency back as the channel net_strength).
Used for round-trip tests + debugging visualisations.
Channel → mantissa mapping table (per §11 D-CSV-9):
| Channel | Mantissa magnitude | Mask | Sign convention |
|---|---|---|---|
| 0 BECOMES | 1 (Deduction) | SPO | + forward |
| 1 CAUSES | 6 (Intervention/Counterfactual per L-9) | SPO | sign = direction |
| 2 SUPPORTS | 4 (Revision +) | PO | + only |
| 3 REFINES | 5 (Synthesis) | PO | + only |
| 4 GROUNDS | 1 (Deduction, S-grounded) | S | + only |
| 5 ABSTRACTS | 2 (Induction) | P | + only |
| 6 RELATES | 0 (Identity/neutral) | None | sign-aware |
| 7 CONTRADICTS | 1 (Abduction backward) | SPO | sign = polarity |
8 transcoder tests added (per §11 D-CSV-9 "16-mapping round-trip
test" target):
- channel get/set round-trip across [-128, -1, 0, 1, 127] ×
all 8 channels
- dominant_channel zero-default (idx 0 when all-zero)
- dominant_channel picks max |net_strength| (with ties to lower idx)
- to_spo BECOMES → mantissa +1 (Deduction)
- to_spo CAUSES with negative net → mantissa -6 (Counterfactual per L-9)
- to_spo RELATES → mantissa 0 (Identity/neutral)
- 16-mapping round-trip: for each (dom, sign) pair the back-channel
lands in the documented equivalence class
- set_channel out-of-range no-op
Cargo.toml: added `causal-edge = { path = "../causal-edge" }` to
`crates/thinking-engine/Cargo.toml` deps. causal-edge is zero-dep
itself, so this preserves the thinking-engine architecture stance.
Combined with the prior commit (W-E2 D-CSV-8 MUL i4 SIMD evaluation
in `lance-graph-contract::mul::i4_eval`), this PR completes Wave E's
two parallel-worker scope: the contract-side i4 MUL evaluator + the
thinking-engine-side dual-CausalEdge64 reunification transcoder.
E-META-7 dual-type debt status (per `causal-edge-64-synergies-and-
pr-trajectory.md`): unchanged in shape (the two `CausalEdge64`
types still exist), but Option R-3 is now wired — downstream
consumers can call `.to_spo()` at the L3 commit boundary to bridge
without re-implementing the mapping each time.
https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS1 parent da8e8f7 commit fdafd1a
3 files changed
Lines changed: 265 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
0 commit comments