/** * uniq — make row-tuples unique across a dataset, plus a data-free * feasibility predictor. * * The math is proven and validated in `docs/vision/20-uniq-research.md`; the * DSL integration is specified in * `docs/superpowers/specs/2026-07-14-uniq-design.md`. This module is the pure * engine core — no DSL, no I/O — so it is tested directly against a * brute-force oracle. * * Invariant: every function that rearranges only PERMUTES each column; a * column's value-multiset is never changed. So percentages/quotas set by the * generators are preserved exactly — uniqueness and exact distribution * coexist by construction. * * Three public pieces: * - `uniqUpperBound` — a proven UPPER bound (Σ min propagation). If the * requested count exceeds it, uniqueness is impossible → safe reject. * - `uniqCapacity` — a data-free simulation of the builder → a safe LOWER * bound (the builder achieves at least this, more after repair). Runs on * quota numbers only, so it certifies huge configs in milliseconds * without assembling any data. * - `arrangeUnique` — the constructive builder (proportional fill + swap * repair) that actually produces the rearranged columns. */ /** Counts of each distinct value in a column, in first-seen order. */ export declare function valueCounts(column: readonly string[]): number[]; /** * Proven UPPER bound on the number of distinct tuples achievable from columns * with these value-counts. Never undercounts (see doc 20 for the induction * proof). `count > uniqUpperBound(...)` ⇒ definitely infeasible. */ export declare function uniqUpperBound(columnCounts: readonly (readonly number[])[]): number; /** * Data-free simulation of the builder over quota numbers → a safe LOWER bound * on achievable distinct tuples (build+repair only ever does better). Stops * early once `need` is reached, since the distinct count only grows per * column. Milliseconds even at 1e9 rows — the feasibility check never touches * data. */ export declare function uniqCapacity(columnCounts: readonly (readonly number[])[], need?: number): number; export interface ArrangeResult { /** Rearranged columns, in the SAME field order as the input. */ readonly columns: string[][]; /** Number of distinct row-tuples actually achieved. */ readonly distinct: number; /** * Distinct tuples the BUILDER reached on its own, before any repair. * * Equal to `distinct` whenever the deal needed no help, which is the case * worth watching: the repair is quadratic in the duplicates it is handed, so * a deal that stops handing it any is the difference between a run of * minutes and a run of hours. `distinct` alone cannot show that — a repaired * table and a table that never needed repairing look identical from outside. */ readonly builtDistinct: number; } /** * Rearrange `columns` (each returned as a permutation of its input multiset) * so the row-tuples are maximally distinct. Deterministic. */ export declare function arrangeUnique(columns: readonly (readonly string[])[]): ArrangeResult; /** The message a group refusal carries: what was asked for, and what the data allows. */ export declare function uniqGroupMessage(name: string, requested: number, achievable: number): string; //# sourceMappingURL=uniq.d.ts.map