Open-source Deterministic Edge Signal Processing Engine

Exact streams.
Deterministic by theorem.

RetractorDB merges and resamples regular time series with zero approximation error. Its core operators are proved correct over rational arithmetic — grounded in Beatty sequences and Fraenkel’s partition theorem. Replay a recording, get the same bits. Every time.

arXiv:2607.07730  ·  MIT license

Δa = 2 Δb = 3 # Δc = 6/5
The idea

A merge you can always undo

Most stream systems stamp every event with a timestamp and reconcile things in fuzzy time windows. RetractorDB starts from something simpler: a regular stream is just a clock — a starting point and a fixed interval between ticks. Two clocks running at different rates can be woven into one combined stream, in order, with nothing lost.

The part that matters: that combined stream can always be pulled back apart into the exact two clocks it came from — no approximation, no drift, no guessing which tick came from which stream. Merge and split are exact opposites, for any pair of regular rates. Replay the same recording twice and get the identical result down to the bit, because the operation was never approximate to begin with.

It's also where the marks come from — the scissors mark is literally this split operation, drawn.

stream A stream B

The formal proof — grounded in number theory — is in the paper, for the curious.

Where it fits

Any machine that streams, any signal that matters

RetractorDB is domain-neutral. It sits at the edge, next to the sensors, and turns raw multi-rate telemetry into exact, reduced, replay-stable streams before they reach a historian, a TSDB, or the cloud. Wherever signals with different sampling rates must be merged, resampled, and audited, the algebra applies unchanged — only the coefficients differ.

The same pattern recurs wherever regular telemetry meets an audit trail: rail and maritime data recorders, seismic networks, structural health monitoring of bridges and buildings, environmental sensor grids.

The engine

Three binaries, one deterministic pipeline

Declare source streams and continuous transformations in RQL, a declarative query language realizing the algebra. The compiler resolves every stream to a rational interval and builds a dependency DAG; the runtime schedules slots on a rational timeline. Identical input traces produce byte-identical artifacts — a property exercised continuously in CI.

xretractor

Parser, compiler, and runtime for RQL plans. Compile-only and plan-dump modes for inspection.

xqry

Queries running streams live over IPC — raw or formatted, ready to pipe into gnuplot.

xtrdb

Inspects and edits binary artifacts: schema, null/gap metadata, deterministic test data.

RQL in practice

One worked example, the same algebra everywhere

Every domain above reduces to the same operator chain. As the paper’s worked example we chose a demanding, well-specified pipeline from the engine’s original domain: the Pan–Tompkins QRS detector over MIT-BIH ECG data — bandpass, derivative, squaring, integration, adaptive threshold, end-to-end in the algebra. Swap the coefficients and the same chain computes a vibration envelope or a bus-signal feature. No user-defined functions, no procedural escape hatches.

DECLARE MLII INTEGER, V1 INTEGER STREAM ecg, 1/360 FILE 'rec205'

# 1. bandpass 5–15 Hz — 25-tap FIR convolution
SELECT * STREAM mlii_win FROM mlii@(1,25)
SELECT mlii_win[_]*bpf[_] STREAM bp_acc FROM mlii_win+bpf

# 2. derivative   3. squaring   4. moving-window integration
SELECT d_out[0]*d_out[0]/1000 STREAM sq_out FROM d_out

# 5. adaptive threshold — 0.5 s moving average
SELECT mlii[0]-900, mwi[0]*5, (mwi[0]-mwi_thr[0]*2)*5
  STREAM qrs_out FROM mlii+mwi+mwi_thr
Lineage

A century of mathematics, one engine

1926

Beatty shows two sequences ⌊np⌋, ⌊nq⌋ partition ℕ for irrational rates.

1969

Fraenkel generalizes the partition criterion to rational parameters — the computable case.

2006

The covering-systems ↔ stream-alignment bridge is established in peer-reviewed form.

2026

Full formal semantics, proofs, and the engine report: arXiv:2607.07730.