Question
You can read seven signs in a fixed order. Each costs one observation, and one of the seven may have been reported incorrectly. How early can you decide while keeping the chances of a false alarm and a missed detection at or below 5% each?
Use a running score of +1 for up and −1 for down. The best rule needs just the entry number, the current score and one coin. Switching on an extra stopping opportunity at entry four with probability 32,969/85,293 attains both error limits exactly. This is a new finite design result, machine-checked in Lean for the two numerical certificates and their lower-bound inequality. Its usefulness is for readers to judge.
Data
The data consist of all 128 ordered words of seven signs. On a genuine history, the chance that the next sign is up is at most 1/10 under the null and at least 9/10 under the alternative. These are design assumptions. A false alarm is an alarm under the null. A miss is a decision against an alarm under the alternative.
For either risk, an editor may see the entire genuine tape and the test seed, then replace at most one sign anywhere on that tape. The editor may choose differently under the two hypotheses. Each genuine word has eight possible reports including itself. A test reads the report in its given order, may decide at time zero and must decide by entry seven. Its random seed is independent of the pre-generated genuine tape. If a source sees the seed, its next-sign bound must hold after every genuine history conditional on that seed.
Time means entries read to either decision. Give equal weight to the two clean laws with independent up chances 1/10 and 9/10, with no replacement when charging time. The error guarantees range over all the allowed adaptive sources and edits. Neither of those wider classes supplies the average-time weights.
Method
How to run the attaining test
- Before reading, draw the fourth-look coin with probability 32,969/85,293 of switching it on. Start the score at zero.
- Read one sign. Stop for an alarm at +3 or for no alarm at −3. With the coin on, also stop at entry four if the score is +2 or −2, taking the decision indicated by its sign.
- Stop as soon as all remaining completions give the same decision. In this seven-entry rule, this happens if the absolute score exceeds the number of entries left. Otherwise read again. At seven the score is odd and its sign decides.
The tape 1101000 (1 means up) shows exactly what the extra look buys. Both versions see +2 after four entries. The coin-on version alarms there. With the coin off, three downs carry the score to −1, so the test reads all seven and decides against an alarm. Download the eight score positions.

Why no allowed test can do better
For a fixed completed word, let f be the probability of an alarm over the test's coins. Among all completions of one prefix, let L be the smallest f and U the largest. A seed that has already decided alarm must alarm on every completion. Its total probability is at most L. Similarly, at most 1 − U can have decided against an alarm. At least U − L must therefore pay for the next entry. Sum those ranges over prefixes, weighting each by its clean probability, to bound the mean from below.
For a given clean word the editor can choose any of its eight reports. Their largest f lower-bounds worst false alarms, and their smallest f upper-bounds guaranteed detection. Both independent endpoint laws are allowed sources, so these constraints apply to every test, including tests with many coins. One uniform draw v realizes all prefix ranges and ball extrema together. Alarm when v ≤ L, decide against an alarm when v > U, and continue otherwise. As more signs arrive the possible completions shrink. For each seed, the alarming sets are nested thresholds of f, so even an editor seeing the draw attains precisely these worst risks.
For the attaining tables, turning a down sign into an up sign can only increase f. The same holds for the largest and smallest f over a one-edit ball. A witness report transfers to a larger clean word by taking the coordinatewise maximum, which uses at most one replacement. The reverse construction uses the minimum. Coupling the signs step by step using the same uniform draw at each genuine history makes the independent 1/10 law largest under the null and the independent 9/10 law smallest under the alternative. This works for each fixed seed when its conditional bounds hold.
The resulting linear program has 638 variables for leaves, prefix ranges and corruption-ball ranges. For every feasible point, multiplying each constraint by its nonpositive price and bounding each remaining variable in [0, 1] gives a lower bound on cost. The two price lists meet their respective rule costs exactly. The 2,558 unrestricted constraints impose no monotonicity assumption on competing tests. Adding equality of leaf probabilities within each final tally gives 2,798 constraints. This includes tests whose individual seed outcomes can depend on order. The source bundle gives the row order, exact prices and checker.
Results
At the two 5% error limits, the unrestricted minimum is 557,462,231/157,950,000 clean entries. The minimum preserving a terminal tally prescription is 235,026/55,801. Each attaining test has the same mean under both clean endpoints. It also minimizes the larger of those two means, since that maximum is at least their average.
| Stopping rule | Worst false alarm | Worst detection | Mean clean entries |
|---|---|---|---|
| Seven-entry majority | 2.56915% | 97.43085% | 4.439380000 |
| Best final-tally test | 5% | 95% | 4.211860003 |
| Ordinary ±3 | 4.34062% | 95.65938% | 3.626022000 |
| ±3 with initial fair guess | 5% | 95% | 3.573657592 |
| ±3 with fourth-look coin | 5% | 95% | 3.529358854 |
The fourth-look rule saves 16.20% against the best test preserving a terminal tally prescription. That prescription requires equal alarm probability on every permutation of a completed word with the same number of ups. To attain its minimum, make a fair guess at time zero with probability 97,234/1,897,234. Otherwise use seven-entry majority, stopping once four signs of either kind have appeared. Thus the final alarm probabilities below and above a majority are 48,617/1,897,234 and its complement.
Ordinary fully curtailed ±3 is itself optimal at its own 4.34062% false-alarm and miss rates. To match 5% exactly, it can make a fair guess at time zero with probability 32,969/2,282,969. The fourth-look rule saves 1.23959% against this matched comparator. It saves zero against the best rule using the current count and entry number, because those are enough to implement it.
How far the same certificate reaches
Let z be the chance of switching on the extra look. The two seed outcomes attain their worst errors on the same independent endpoint laws. Their mixture has false-alarm and miss probabilities α = 0.0434062 + 0.0170586z and clean mean 3.626022 − 0.250074z. For every z from zero to one, the same price vector gives the lower bound 673,237,231/157,950,000 − (46,310/3,159)α. The bound and the attained cost are straight lines in α and agree at both ends, so they agree throughout.
| Chance of extra look | Worst false alarm | Worst detection | Mean as a fraction | Mean clean entries |
|---|---|---|---|---|
| 0 | 4.34062% | 95.65938% | 1,813,011/500,000 | 3.626022000 |
| 32,969/85,293 | 5% | 95% | 557,462,231/157,950,000 | 3.529358854 |
| 1/2 | 5.19355% | 94.80645% | 700,197/200,000 | 3.500985000 |
| 3/4 | 5.62002% | 94.37998% | 6,876,933/2,000,000 | 3.438466500 |
| 1 | 6.04648% | 93.95352% | 843,987/250,000 | 3.375948000 |

The final-tally optimum has a segment of its own. Let g be the chance of making the initial fair guess and use fully curtailed majority otherwise. Its symmetric error is (1 − g) × 0.0256915 + g/2 and its clean mean is (1 − g) × 4.43938. The tally prices meet these costs at both ends, so the same interpolation certifies every error from 2.56915% to 50%. At 50% a fair guess reads zero entries.
Checks
Lean checked numerical identities for two explicit 128-word tables and real weak duality. The identities give each table's weighted false alarms, detection, clean cost and equal lower bound at 5%. Lean also checked reflection, boundedness, monotonicity and the tally equalities where required. The reduction from arbitrary randomized tests, feasibility for adaptive genuine sources and the proof over the full error interval are the written arguments above.
| Class | Rule mean | Priced lower bound | Independent minimum cut |
|---|---|---|---|
| All fixed-order tests | 557,462,231/157,950,000 | 557,462,231/157,950,000 | 557,462,231/157,950,000 |
| Final-tally tests | 235,026/55,801 | 235,026/55,801 | 235,026/55,801 |
| Ordinary ±3 at its own rates | 1,813,011/500,000 | 1,813,011/500,000 | 1,813,011/500,000 |
The independent calculation minimized clean prefix cost plus a penalty for errors over sets of alarming words. A graph cut charges each prefix that has both kinds of completion and each edit ball capable of the wrong decision. Merging equal-tally leaves gives the restricted problem. Enumerating all 256 deterministic final-tally prescriptions confirmed its supporting price. All 122 additional class-and-target cases agreed. No counter-example appeared in the generated cases. Exact targets and bounds and stopping decisions on all 128 tapes.
The review reproduced 433 of 434 reported numbers. The single discrepancy was a decimal printed with an ellipsis. The exact tally minimum is 235,026/55,801 = 4.2118600025089…, which rounds to 4.211860003 at nine decimal places. All exact minima, certificate values and leaf probabilities agreed. These are exact finite calculations with no sampling error. Original numerical comparisons.
What it means in plain words
A final-tally restriction makes sense if an auditor must reproduce a fixed-sample decision prescription under every permutation. An interim score can legitimately decide differently. The words 0001111 and 1111000 both contain four ups, yet ordinary ±3 stops at entry three with opposite decisions.
This is a finite benchmark. A full-word calculation for n entries has 2ⁿ leaves. A different deadline, edit budget or clean sampling law changes the optimization problem. The 16.20% figure measures a difference in mean entries under the stated laws. Detection probability, time on corrupted streams and time until an actual signal are distinct quantities.
References
No earlier equivalent statement was found in the sources consulted for this seven-entry design. The search covered exact curtailment, finite-horizon Bernoulli testing, robust classification and sequential games. The closest comparisons follow.
- Eisenberg and Lienhard studied how to curtail a randomized binomial test while preserving its terminal prescription. Law, Grayling and Mander computed exact operating characteristics for interim count boundaries. Eisenberg and Lienhard, publisher record and Law, Grayling and Mander, methods.
- Kiefer and Weiss studied expected sample size under a designated law. Novikov, Novikov and Farkhshatov gave finite-horizon Bernoulli procedures with two risk constraints, randomized stopping and lower bounds. Kiefer and Weiss and Novikov and colleagues, Propositions 1–2.
- Linear-program designs and minimax tests over uncertain transition laws predate this calculation. The experiment here puts one replacement anywhere on the realized tape and charges clean prefix time. Fauß and Zoubir, program (4.3) and Fauß, Zoubir and Poor, Theorems 8–9.
- Related work evaluates perturbation balls on complete observations and integrates nested decision sets. Other sequential models bound the number of corruptible sensors across time. Pydi and Jog, Bungert, García Trillos and Murray and Li, Mo and Hao.
- The search also covered finite game-tree representations and asymptotic error exponents under changes in the sampling law. Older sampling plans described in other terms could supply further comparisons. Koller, Megiddo and von Stengel and Modak and colleagues.
Download plain-text bibliography · Download linked bibliography (HTML)
- Eisenberg and Lienhard, Curtailed versions of randomized binomial tests
The publisher's abstract, consulted in the priority review, treats curtailment of randomized one-sided binomial decisions. The open DOI record identifies the article.
Opened 2026-11-30 - Law, Grayling and Mander, Optimal curtailed designs … (arXiv 1909.03017)
Interim count boundaries and exact calculations of operating characteristics give a practical comparison under ordinary binary sampling.
Opened 2026-11-30. arXiv 1909.03017 - Kiefer and Weiss, Some Properties of Generalized Sequential Probability Ratio Tests
The original summary identifies expected sample size under a designated law as a design objective. The open DOI record identifies the original article.
Opened 2026-11-30 - Novikov, Novikov and Farkhshatov, A computational approach to the Kiefer–Weiss problem for sampling from a Bernoulli population
Propositions 1 and 2 give finite-horizon optimization with randomized stopping, separate risks and a Lagrange bound.
Opened 2026-11-30. arXiv 2110.04802 - Fauß and Zoubir, A Linear Programming Approach to Sequential Hypothesis Testing
Program (4.3) prices continuation and stopping under specified stochastic kernels.
Opened 2026-11-29. arXiv 1501.05870 - Fauß, Zoubir and Poor, Minimax Optimal Sequential Hypothesis Tests for Markov Processes
Theorems 8 and 9 treat conditional distributional uncertainty and least-favourable kernels.
Opened 2026-11-29. arXiv 1811.04286 - Pydi and Jog, Adversarial Risk via Optimal Transport and Optimal Couplings
Theorem 2 gives a whole-input robust classification problem for perturbations in a metric ball.
Opened 2026-11-30 - Bungert, García Trillos and Murray, The Geometry of Adversarial Training in Binary Classification
Proposition 3.13 relates an adversarial functional to nested decision sets.
Opened 2026-11-29. arXiv 2111.13613 - Li, Mo and Hao, Game Theoretical Approach to Sequential Hypothesis Test with Byzantine Sensors
The corruptible units are sensors used across observations. Sample number is studied asymptotically.
Opened 2026-11-30 - Koller, Megiddo and von Stengel, Efficient Computation of Equilibria for Extensive Two-Person Games
The sequence form gives a representation linear in the size of a perfect-recall game tree.
Opened 2026-11-30 - Modak and colleagues, Sequential Adversarial Hypothesis Testing
Theorem 1 studies asymptotic error exponents when the observation distributions can be selected adversarially.
Opened 2026-11-29. arXiv 2511.10181
Reproduce
The proofs, executable stopping rule, certificates and independent solver are in one source download. Save it as source.csv in an empty directory. The bundle contains the pinned Lean project and the row-by-row proof description. The stopping rule needs only Python 3. The numerical replay uses NetworkX 2.8.8, the charts use Matplotlib 3.10.8, and the proof uses Lean and mathlib 4.36.0.
tail -n +2 source.csv | base32 -d | tar xz
python3 code/rule.py 1101000 --fourth on
python3 code/rule.py 1101000 --fourth off
bash code/reproduce.sh
The design constants generate the whole input. The 128-word stopping table regenerated on 30 November 2026 has SHA-256 8b36f846. Source fingerprints for the numerical certificates accompany the code. The repository directory is research/seven-entry-test/code/.
Change log
29 November 2026. The design and two optima were independently checked. On 30 November the executable fourth look, extended error interval, corrected decimal and reproducible comparisons were prepared.
What this leaves open
- Which count boundaries attain the minimum with more than seven observations?
- Which rule minimizes time if the editor can also increase the charged sample length?