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
Example
test/IntegrationTest/simple/query.rql
STORAGE 'temp'
DECLARE a INTEGER STREAM core0, 0.1 FILE 'datafile2.dat'
DECLARE b INTEGER STREAM core1, 0.2 FILE 'datafile3.dat'
SELECT str1[0]*10,str1[1]*10,str1[1]*str1[0]+20 STREAM str1 FROM core0+core1
The idea

A merge you can always undo

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.

Exact

Core operators are proved correct over rational arithmetic. No floating-point drift, no approximation — for any pair of regular rates.

Reversible

The combined stream always splits back into the exact two clocks it came from. Merge and split are exact opposites; the scissors mark is that split, drawn.

Replay-stable

Replay the same recording twice and get the identical result down to the bit — a property exercised continuously in CI.

The formal proof is in the paper. Try the rules yourself with the interlace and sum operators.

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.

01 / 08

Aerospace

Flight-test and avionics telemetry: hundreds of sensors at mismatched rates merged deterministically, with byte-identical replay for post-flight and incident analysis.

Rates are declared once, in the query, as exact fractions; a 400 Hz inertial unit and a 1 Hz GPS fix meet on a common timeline with no resampling guesswork. The same recording replayed a year later yields the same bytes, so a finding from a flight review can be re-derived and audited.

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.

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

The paper’s worked example is a longer chain of the same operators: the Pan–Tompkins QRS detector over MIT-BIH ECG data, 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.

  1. 01Bandpass 5–15 Hz
  2. 02Derivative
  3. 03Squaring
  4. 04Moving-window integration
  5. 05Adaptive threshold
Pan–Tompkins QRS detector · MIT-BIH record 205
DEFAULT VOLATILE
DECLARE MLII INTEGER, V1 INTEGER STREAM ecg, 1/360 FILE 'rec205'
DECLARE bp_coef INTEGER[25] STREAM bpf, 1 FILE 'bp_coef.txt'
DECLARE d_coef INTEGER[5] STREAM df, 1 FILE 'd_coef.txt'
SELECT ecg.MLII STREAM mlii FROM ecg
# 1. bandpass 5–15 Hz — 25-tap FIR convolution
SELECT mlii[_]*bpf[_] STREAM bp_acc FROM mlii@(1,25)+bpf
SELECT int(bp_acc[0]/1000) STREAM bp_out FROM SUMC(bp_acc)
# 2. derivative — 5-tap FIR
SELECT bp_out[_]*df[_] STREAM d_acc FROM bp_out@(1,5)+df
SELECT int(d_acc[0]) STREAM d_out FROM SUMC(d_acc)
# 3. squaring
SELECT d_out[0]^2/1000 STREAM sq_out FROM d_out
# 4. moving-window integration — 30 samples
SELECT int(sq_out[0]) STREAM mwi FROM AVG(sq_out@(1,30))
# 5. adaptive threshold — 180-sample moving average (0.5 s)
SELECT int(mwi[0]) STREAM mwi_thr FROM AVG(mwi@(1,180))
# output: centred ECG, envelope ×5, detection ×5
SELECT mlii[0]-900, mwi[0]*5, (mwi[0]-mwi_thr[0]*2)*5 STREAM qrs_out FROM mlii+mwi+mwi_thr PERSISTENT
Lineage

A century of mathematics, one engine

  1. 1926

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

  2. 1969

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

  3. 2003

    The operator algebra and declarative query language are defined in a fetal-monitoring context [JMIT vol. 5–6].

  4. 2006

    The covering-systems ↔ stream-alignment bridge is established in peer-reviewed form [Annales UMCS Informatica vol. 4] — now on arXiv:2607.10444.

  5. 2026

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