Conversation
…correction) Completes the input pipeline for TemporalCoordinationDetection. phaseLockingValue (PR #298): PLV expects phases in radians but didn't prescribe how events become phases. This ship fills the gap. 17th graduation under Otto-105 cadence. Addresses Amara 17th-ferry Part 2 correction #5: 'Without phase construction, PLV is just a word.' Surface (2 pure functions): - PhaseExtraction.epochPhase : double -> double[] -> double[] Periodic-epoch phase. φ(t) = 2π · (t mod period) / period. Suited to consensus-protocol events with fixed cadence (slot duration, heartbeat, epoch boundary). - PhaseExtraction.interEventPhase : double[] -> double[] -> double[] Circular phase between consecutive events. For sample t in [t_k, t_{k+1}), phase = 2π · (t - t_k) / (t_{k+1} - t_k). Suited to irregular event-driven streams. Both return double[] of phase values in [0, 2π) radians. Empty output on degenerate inputs (no exception). eventTimes assumed sorted ascending; samples outside the event range get 0 phase (callers filter to interior if they care). Hilbert-transform analytic-signal approach (Amara's Option B) deferred — needs FFT support which Zeta doesn't currently ship. Future graduation when signal-processing substrate lands. Tests (12, all passing): epochPhase: - t=0 → phase 0 - t=period/2 → phase π - wraps cleanly at period boundary - handles negative sample times correctly - returns empty on invalid period (≤0) or empty samples interEventPhase: - empty on <2 events or empty samples - phase 0 at start of first interval - phase π at midpoint - adapts to varying interval lengths (O(log n) binary search for bracketing interval) - returns 0 before first and after last event (edge cases) Composition with phaseLockingValue: - Two nodes with identical epochPhase period → PLV = 1 (synchronized) - Two nodes with same period but constant offset → PLV = 1 (perfect phase locking at non-zero offset is still locking) This composes the full firefly-synchronization detection pipeline end-to-end for event-driven validator streams: validator event times → PhaseExtraction → phaseLockingValue → temporal-coordination-detection signal 5 of 8 Amara 17th-ferry corrections now shipped: #1 λ₁(K₃)=2 ✓ already correct (PR #321) #2 modularity relational ✓ already correct (PR #324) #3 cohesion/exclusivity/conductance ✓ shipped (PR #331) #4 windowed stake covariance ✓ shipped (PR #331) #5 event-stream → phase pipeline ✓ THIS SHIP Remaining: #4 robust-z-score composite variant (future); #6 ADR phrasing (already correct); #7 KSK naming (BACKLOG #318 awaiting Max coord); #8 SOTA humility (doc-phrasing discipline). Build: 0 Warning / 0 Error. Provenance: - Concept: Aaron firefly-synchronization design - Formalization: Amara 17th-ferry correction #5 with 3-option menu (epoch / Hilbert / circular) - Implementation: Otto (17th graduation; options A + C shipped, Hilbert deferred) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Adds a PhaseExtraction layer in Zeta.Core to complete the TemporalCoordinationDetection.phaseLockingValue pipeline by converting event-time streams into phase series (radians), with tests demonstrating correctness and PLV composition.
Changes:
- Added
PhaseExtractionmodule withepochPhaseandinterEventPhasepure functions. - Added F# test coverage for both functions plus PLV integration scenarios.
- Registered the new source + test files in their respective
.fsprojcompile lists.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Tests.FSharp/Tests.FSharp.fsproj | Includes new PhaseExtraction test file in compile order. |
| tests/Tests.FSharp/Algebra/PhaseExtraction.Tests.fs | Adds unit tests for epoch/inter-event phase extraction and PLV composition. |
| src/Core/PhaseExtraction.fs | Introduces phase extraction functions and module-level documentation. |
| src/Core/Core.fsproj | Adds PhaseExtraction module to Core compilation list. |
| /// events. For a node whose events occur at irregular times | ||
| /// `t_1 < t_2 < …`, the phase at sample time `t` is | ||
| /// `φ(t) = 2π · (t − t_k) / (t_{k+1} − t_k)` where | ||
| /// `t_k ≤ t < t_{k+1}`. Suited to event-driven streams | ||
| /// without fixed periods. |
There was a problem hiding this comment.
P1: interEventPhase’s contract is internally inconsistent: the module docs describe irregular events as t_1 < t_2 < … (strictly increasing), but the function docs only require “sorted ascending”, and the implementation explicitly handles interval <= 0.0 by returning phase 0.0. Please align the API contract and behavior (e.g., require strictly increasing eventTimes and validate/return empty on violation, or document duplicate/non-increasing handling and recommend pre-dedup/filtering).
Completes the TemporalCoordinationDetection.phaseLockingValue pipeline: event streams → phase series → PLV.
2 pure functions (epochPhase + interEventPhase); 12 tests passing. Composes end-to-end with PLV for synchronized and constant-offset sources.
5 of 8 Amara 17th-ferry corrections now shipped.