# RRLS Studio v0.6

**Relational Rotation / Lift / Collapse Solver — desktop sequence laboratory**

RRLS Studio is an experimental finite-pattern discovery engine. It takes a numeric sequence, searches low-dimensional relationships first, validates candidate laws on held-out coordinates, and only escalates to more expensive relation families when cheaper structures fail.

## Quick start on Windows

### Option A — run from Python
1. Install Python 3.11+ from python.org. On the installer, enable **Add Python to PATH**.
2. Unzip this folder.
3. Double-click `launch_windows.bat`.

The application itself has **no third-party runtime dependency**. It uses Python's standard library and Tkinter.

### Option B — compile a standalone EXE
1. Install Python 3.11+.
2. Double-click `build_windows.bat`.
3. The script installs PyInstaller and creates:

`dist\RRLS_Studio_v06.exe`

You can then copy that EXE elsewhere and run it without starting Python manually.

## Input

Paste or load a finite sequence containing:
- integers: `1, 2, 3`
- decimals: `0.1 0.2 0.3`
- scientific notation: `1e3, 2e3`
- exact fractions: `1/3, 2/3, 1`

Whitespace, commas, semicolons, pipes and newlines are accepted separators. CSV/TXT/TSV files are flattened in reading order.

## Current relation vocabulary

RRLS v0.6 can discover and extrapolate:
- constants
- arithmetic progressions
- geometric progressions
- periodic sequences
- exact finite-difference polynomials
- affine recurrences
- exact rational linear recurrences
- whole-integer XOR / GF(2) recurrences
- modular affine / LCG sequences
- interleaved lower-dimensional subsequences

The design is intentionally extensible: new relation operators can be added to `rrls_sequence_core.py` and ranked by the same validation/cost loop.

## Validation philosophy

When enough points are available, RRLS fits using a prefix and hides the suffix from the detector. A law is labeled **validated** only if it predicts that held-out suffix exactly.

If RRLS cannot find a compact validated law, it reports:

`unresolved in current model vocabulary`

That does **not** mean the sequence is fundamentally random. It means the current set of coordinate transforms/operators did not expose a compact law.

## Self-optimizing search order

Adaptive mode stores operator telemetry in:

`%USERPROFILE%\.rrls_studio\operator_stats.json`

The engine learns which expensive relation families have historically produced validated compact laws per unit of compute and schedules those searches earlier. Mathematical validation does not change; only search order does.

RRLS also uses a lower-bound stopping rule: once a validated low-dimensional model is already cheaper than every remaining operator can theoretically be, higher-dimensional search stops immediately.

## CLI

Example:

```bat
py rrls_cli.py --sequence "1,1,2,3,5,8,13,21,34,55,89,144" --mode deep --forecast 8
```

File mode:

```bat
py rrls_cli.py --file my_numbers.csv --mode adaptive --forecast 20 --json-out result.json
```

## Measured v0.6 benchmark

Synthetic held-out benchmark, 160 structured cases total:
- arithmetic: 20/20 future predictions exact
- geometric: 20/20
- polynomial: 20/20
- periodic: 20/20
- exact linear recurrence: 20/20
- interleaved: 20/20
- XOR recurrence: 20/20
- modular affine/LCG: 20/20

Overall future accuracy on that suite: **160/160 (100%)**.

Opaque-control suite: 50 finite sequences of independently generated 24-bit values. False `validated structure found` calls: **0/50**.

These are engineering benchmarks for the implemented model families, not evidence of a universal law-discovery theorem.

### Scaling optimization

On this development container, adaptive analysis of a 500,000-value arithmetic sequence dropped from roughly **5.06 s to 1.22 s** after adding the low-dimensional lower-bound stop, with the exact same validated equation.


### Adaptive vs deep meta-benchmark

On a separate 60-case held-out suite, both modes predicted **60/60** futures exactly. Adaptive mode completed the suite **1.72× faster** than deep mode by stopping after sufficiently cheap validated relations and using learned operator ordering.

## Important limits

A finite sequence generally admits infinitely many formulas that agree on the observed coordinates. RRLS therefore cannot prove that a returned equation is the unique metaphysical cause of the data. It ranks compact laws inside its current operator vocabulary and uses held-out prediction to distinguish useful structure from interpolation.

No computable system can guarantee recovery of the globally shortest generating program for every possible finite dataset. RRLS treats that as a search problem: expand the vocabulary, rotate/lift when current coordinates remain expensive, collapse exact relations as soon as they are found, and measure whether each new operator pays for itself.

## Files

- `rrls_studio.py` — desktop GUI
- `rrls_sequence_core.py` — sequence solver
- `rrls_cli.py` — command-line interface
- `benchmark_v06.py` — reproducible synthetic benchmark
- `benchmark_v06.json` — measured benchmark report
- `build_windows.bat` — one-click standalone EXE build
- `launch_windows.bat` — run GUI from Python
- `run_cli_example.bat` — CLI example

