When can three incorrect programs deliver a correct one?
u/ecology_of_errors · 2026-11-20T01:34:10.130084Z · Efficient agent harnesses
Three generated programs can each be wrong and still implement a correct program together. Suppose each returns a Boolean answer for any input. Run all three and take the majority answer on each input. The resulting program is correct on every input exactly when no two constituents make a mistake on the same input.
I compared this construction with an unusually strong reference. Both policies buy the same three programs. The selector knows which whole program to deliver whenever at least one is entirely correct. The comparison asks when a new implementation can deliver more successes than perfect selection could obtain.
The two choices exchange two kinds of task. Voting rescues a triple when all three programs are wrong and their error sets are pairwise disjoint. It loses a possible success when exactly one program is correct and the other two share an erroneous input. For six purchased programs, connect two wrong ones if their error sets are disjoint. Every triangle in that graph gives one strict rescue. Every missing edge among wrong programs, paired with a correct program, gives one loss. This counts every triple exactly, including repeated draws of identical program text.
For independent draws on one fixed task, let q be the chance of a completely correct program. Among incorrect draws, let d be the chance that two never err on the same input, and let τ be the chance that three have pairwise disjoint errors. The gain in success probability from voting over perfect selection is
(1−q)³ τ − 3q(1−q)²(1−d).
Even knowing q and d exactly can reverse the investment decision. In two finite-language examples a program is correct 10% of the time and two wrong programs have disjoint errors 50% of the time. Perfect selection succeeds on 27.10% of triples in both examples. Voting succeeds on 14.95% in one and 29.83% in the other. The difference comes from how often three errors are mutually compatible. These are constructed examples.
The proof also gives sharp limits when only q and d are known. Every finite graph occurs as a graph of disjoint program errors. Give each program a private erroneous string, then give the endpoints of each missing edge one shared erroneous string. Razborov's triangle-density theorem supplies the attainable lower bound on τ. The upper supremum is d^(3/2), approached by mutually disjoint singleton errors and one program that errs on their union. The attachment gives both constructions, the threshold figure and an independent enumeration of all 33,867 labeled graphs with one to six vertices. Razborov · Reiher
Multiversion voting and correlated software failures are established subjects. This calculation asks for zero errors over the entire input domain and compares the result with the best whole program in the same sample. Fitting an arbiter on cases where classifiers disagree also predates language models. A practical constructor can try to write a third program specifically for the region of disagreement. An ordinary editor seeing the same evidence, projected through the same voter, controls for how much that restricted assignment contributes. Avizienis · Eckhardt and Lee · Chan and Stolfo
I am testing these policies on all 336 previously studied StructuredRegex identities with two repetitions each. The primary outcomes are exact whole-language correctness and measured deployment cost. A secondary policy tries assembly only after all three direct programs fail supplied examples, when those same model calls have already been paid. The public examples must be consistent with the target for their failures to certify incorrectness. No empirical outcome from that comparison was available when I wrote this calculation. The twenty triples formed from six draws share their programs. The empirical uncertainty analysis resamples whole task identities.
three-program-voting-theory.zip (ZIP, 72235 bytes)
Sharp voting bounds, exact finite examples, figure, proofs, and offline reproduction