/** * ⏱ THE ANYTIME-VALID (E-VALUE) CERTIFICATE — peek as often as you like; the error guarantee still holds. * * An AI agent optimizing a system does not run a fixed batch and stop — it measures ONE result, looks, decides * whether to keep going, measures another, looks again. Under that continuous monitoring, the classical * p-value is broken: "stop the first time p < 0.05" inflates the false-positive rate catastrophically (peek * after every one of 200 observations under the null and you cross p<0.05 ~40% of the time, not 5%). Every * agent that monitors a metric and stops when it "looks significant" is silently making this error. * * This certificate fixes it with anytime-valid inference. It runs a test MARTINGALE (a Robbins normal-mixture * e-process) over the stream: E_t is a non-negative martingale that, under the null, has E[E_t] ≤ 1 — so by * Ville's inequality P(ever E_t ≥ 1/α) ≤ α. You may stop at ANY time, after ANY number of peeks, by ANY * data-dependent rule, and the false-positive guarantee α holds. The certificate records the observation * stream, finds the first crossing of 1/α, and is Ed25519-signed; the verdict re-derives offline. * * WORLD-FIRST + LLM-impossible: an LLM cannot carry a martingale over a live data stream, prove optional- * stopping validity, and sign a re-derivable verdict — it just eyeballs "looks significant now". (DIAKRISIS — * MEASURED: under the null with continuous monitoring the realized false-positive rate is ≤ α, while naive * per-peek thresholding blows past it; and a true effect is still detected, usually well before the horizon.) * Distinct from the sequential Proof-of-Improvement (R10), which spends alpha over a FIXED, pre-set set of * looks; an e-process is valid under ARBITRARY, unbounded, data-dependent stopping. */ import { type Experiment } from "./space.js"; import { type KeyObject } from "node:crypto"; export interface AnytimeCertificate { standard: "melete-anytime-certificate/v2"; verdict: "ANYTIME-SIGNIFICANT" | "INCONCLUSIVE"; n: number; sigma: number; alpha: number; tau2: number; threshold: number; stoppedAt: number; eValueAtStop: number; maxEValue: number; estimate: number; ciLower: number; ciUpper: number; ciRadius: number; excludesZero: boolean; observations: number[]; payloadHash: string; signature: string; publicKeyPem: string; algo: "ed25519+sha256"; } export declare function anytimeCertificate(opts: { observations?: number[]; oracle?: (e: Experiment) => number; a?: Experiment; b?: Experiment; n?: number; sigma?: number; alpha?: number; tau2?: number; seed?: number; keys?: { publicKey: KeyObject; privateKey: KeyObject; }; }): AnytimeCertificate; export declare function verifyAnytimeCertificate(c: AnytimeCertificate): { ok: boolean; reason: string; }; export declare function anytimeGauntlet(): { score: 0 | 100; checks: Array<{ name: string; pass: boolean; detail: string; }>; }; //# sourceMappingURL=anytime.d.ts.map