{"record":{"id":"N-BABBAGE-NOTE-G","slug":"two-readings-of-ada-lovelaces-note-g-both-make-babbages-engine-a-general-machine","kind":"notebook","title":"Two readings of Ada Lovelace’s Note G both make Babbage’s engine a general machine.","dek":"In Note G a result of the engine chooses between two courses. Read as repeating a cycle, or as a step forward past a backing card Babbage described in 1837, it makes his machine general. Her program runs both ways, and as printed.","abstract":"A note about the control of Babbage’s Analytical Engine as Menabrea’s account of 1842 and Lovelace’s Notes of 1843 describe it, and about her program for the Bernoulli numbers in Note G, run on a reconstruction of the engine’s control. Note G is explicit that a result, zero or greater than zero, chooses between two courses. That the test ends the repetition of Operations 13 to 23 is a reading (A); that the repetition is counted and the test only chooses a step forward is another (B). Proved in Lean: under Reading A, one card, a backing made effective by a result, is enough for every counter machine to run, halting by passing its last card exactly when the machine halts; under Reading B, a forward course is enough together with the unconditional backing card of Babbage’s Sketch Book of December 1837. With Minsky’s theorem, cited, the machine is general under either reading. Lovelace’s table, transcribed from a camera image of the plate, gives −95/126 as printed where B₇ is −1/30; with three changes of three different kinds it gives −1/30, and 1/42 and 5/66 for the neighbouring Numbers. Under Reading B the test variable V₁₀ ends at zero for every n tried, which Reading A does not manage for the two smallest. That the engine is general from a conditional backing is Rojas’s; what is added here is the tie to Note G, both readings, the proofs, and the program run.","created":"2026-11-27","version":"1.0","status":"OPEN","publication":"published","authors":["Chris Hay"],"lineage":"NOTE G → THE PLATE → TWO READINGS → MACHINE → LEAN → REVIEW","concepts":["source-authority","verification","programming-languages"],"related":["N-BABBAGE-CONTROL","N-BABBAGE","N-TURING-ACE"],"media":[],"body":[{"kind":"observation","label":"01 / THE ONE PLACE A RESULT CHOOSES","text":"In the pages of Babbage’s Sketch Books and drawings read here, up to April 1842, no result of the engine’s mill chooses which cards act next: a loop runs a number of times fixed before it starts. The published accounts change that. In Menabrea’s account of 1842, if a remainder is nothing “the mill will order other cards”, stated as a principle. In Note G of 1843 Lovelace works a case: Operation 7 “must either bring out a result equal to zero … or a result greater than zero … and the engine follows the one or the other of the two courses just explained, contingently on the one or the other result of Operation 7”, and “V₁₀ always decides which of two courses the succeeding processes are to follow, by feeling for the value of n through means of a subtraction.” How the engine would do it is not described until Babbage’s autobiography of 1864.","references":[{"label":"Menabrea and Lovelace, the control passages read","url":"https://github.com/chrishayuk/analytical-engine/blob/a9a0b50/sources/notes/menabrea-lovelace-1843-control.md"},{"label":"Sketch of the Analytical Engine, with Lovelace’s Notes (Fourmilab)","url":"https://www.fourmilab.ch/babbage/sketch.html"}]},{"kind":"observation","label":"02 / TWO READINGS OF ONE SENTENCE","text":"What is explicit is a test that chooses between two courses. What the courses are is a reading. Under Reading A, the repetition of Operations 13 to 23 goes on until V₁₀ comes to zero: a cycle a result ends, a backing that a result makes effective. Under Reading B, the repetition is counted, as Lovelace’s own notation Σ(+1)ⁿ⁻² suggests, and the test only chooses a step forward, the course that finishes a Number. The text supports both; the archive reading judges Reading A the closer fit, since Note G describes no counter and the test is repeated at every pass. Each is built here as its own arrangement of the engine’s cards, beside the dated arrangements of the Sketch Books, which are left as they were."},{"kind":"observation","label":"03 / LOVELACE’S TABLE, AS PRINTED","text":"Note G comes with a table of 25 operations that computes B₇, a Bernoulli number in her numbering (−1/30). I transcribed it from the original camera image of the plate in the Natural History Museum’s copy, 4,368 pixels across with the plate about 2,200 of them, twice the width of the plate in the processed scans, and found the Wikisource transcription wrong in several cells. Run as printed, with the repetition of Operations 13 to 23 done under Reading A, it gives −95/126. Two cells of the six left-hand columns could not be read with certainty, the working columns were read only where cited, and only one printed copy of the plate has been read."},{"kind":"observation","label":"04 / THREE CHANGES OF THREE KINDS","text":"Three changes give −1/30, and they are not three errors by Lovelace. Operation 4 is printed V₅ ÷ V₄, where the plate’s own statement of results gives (2n − 1)/(2n + 1), that is V₄ ÷ V₅: an error in the printed table, already reported (Wikipedia, a secondary source). Operation 21 must take B₅ from V₂₃ the second time round, as the text says; the plate shows only the first pass, and this machine cannot advance a variable card, so six cards not in the table do it, which works up to n = 5: an adaptation to the machine. Operation 24 adds where B₇ is minus the sum; Lovelace says the table leaves the signs aside: a convention. With the three changes the program gives 1/42, −1/30 and 5/66 for n = 3, 4 and 5, repeating the cycle n − 2 times, as her Σ(+1)ⁿ⁻² says."},{"kind":"observation","label":"05 / READING B FITS THE SMALLEST CASES","text":"Both readings give the right Number for n = 1 to 5. They differ inside. Under Reading B, the tests at Operations 7 and 12 are the forward courses the text describes for n = 1 and n = 2, the repetition is counted, here from the n − 2 that Operation 12 has just put on V₁₀ (where the count comes from is not in the text; it is a choice of the encoding), and V₁₀ ends at zero every time. Under Reading A there is no way to step forward, so for n = 1 and n = 2 the deck runs operations the engine would skip, and V₁₀ ends at −2 and −1; those runs stop only because a negative number lets the cards go on. That makes Reading B the more faithful for the two smallest cases. It does not settle which reading is right, and the archive reading judges Reading A the closer fit overall: Note G describes no counter, and the test is repeated at every pass (Card 23 “has the office of” Cards 7 and 12)."},{"kind":"observation","label":"06 / READING A: ONE CARD IS ENOUGH","text":"Under Reading A, add one card to the arrangement of 30 May 1838: a backing made effective while a column holds a number greater than zero. Then every counter machine translates into a deck that halts, by passing its last card, exactly when the machine halts, and gives off its counters. The deck uses nothing else: no counted loop, no combinatorial card, no repeated operation, no count set inside its own loop, no stop at 1 ÷ 0. Every deck of the older arrangements runs as before. Two counters compute every partial computable function, with inputs and outputs coded as powers of primes (Minsky, 1967; cited, not formalised), so this machine is general with only the test Note G describes."},{"kind":"observation","label":"07 / READING B: WITH THE BACKING OF 1837","text":"Under Reading B the test steps forward. A step forward changes no number and only moves on, so with every backing counted the bounds of the counted arrangements still hold; that is argued, not proved. But Babbage’s Sketch Book of December 1837 has a backing card that “always orders the backing”. A step forward past that card is a loop a result ends, and with it every counter machine runs again, halting exactly when the machine halts; in Lean, even the arrangement of December 1837, with the forward course added, accepts the deck. So the conclusion holds under either reading, and what differs is the older card it needs: none under Reading A, the unconditional backing of 1837 under Reading B. Once that card is admitted the result is close to immediate."},{"kind":"observation","label":"08 / WHAT ROJAS ALREADY SHOWED","text":"That the Analytical Engine is general given a conditional backing is not new. Rojas argued it in 2024, assuming, after Bromley (2000), a test for zero that backs both strings of cards by amounts punched on cards, and building indirect addressing and a Turing machine with a finite tape on it, in prose. That result is his. What this note adds is narrower: the primitive taken from one passage of Note G and read two ways, a backward test only under one reading and a forward one with the 1837 backing under the other, no counted mechanism or indirect addressing, both translations proved in Lean, and Lovelace’s program run on the same machine. Bromley’s paper could not be read."},{"kind":"observation","label":"09 / HOW IT WAS CHECKED","text":"Each theorem is in Lean 4, with only its core library, checked on every change and using only the standard axioms. An operation that writes several columns, as Lovelace’s first does, is proved equal to one that writes the first and copies it. The Lean model and the Rust machine are run on the same decks and compared: random decks with each of the new cards, one counter machine (add), on two inputs, under each reading, and Lovelace’s program as printed, corrected and under Reading B, on exact fractions: 3,720 runs, all agreeing. The random decks found a real bug, an overflow in the Rust fractions, now fixed. Two independent reviews (commits 15d045d and 5cba933) found no error in the mathematics or in the numbers; they found a reading stated as fact and other places where the prose said more than the work, all corrected."},{"kind":"connection","text":"Every deck in this note runs in the browser under every arrangement. Choose a reading and a Number and run Lovelace’s program yourself.","links":[{"href":"https://github.com/chrishayuk/analytical-engine/blob/a9a0b50/docs/published-control-1843.md","label":"The 1842–1843 configuration, both readings, and what follows"},{"href":"https://github.com/chrishayuk/analytical-engine/blob/a9a0b50/sources/notes/note-g-table.md","label":"The Note G table, transcribed row by row"},{"href":"https://github.com/chrishayuk/analytical-engine/blob/a9a0b50/formal/Babbage/Note43.lean","label":"The Lean proofs for both readings"},{"href":"https://commons.wikimedia.org/wiki/File:Diagram_for_the_computation_of_Bernoulli_numbers.jpg","label":"The plate of Note G (Wikimedia Commons)"},{"href":"/notebook/where-babbages-1836-count-comes-from-decides-what-his-engine-could-compute","label":"The earlier note: what the Sketch Books’ control could compute"}]},{"kind":"refusal","title":"WHAT THIS DOES NOT SHOW","lines":["Which reading of Note G is right. Both are worked out; the text supports both, Reading B fits the two smallest cases better, and the archive reading judges Reading A the closer fit overall.","That the engine was built, or designed in 1843, to do this. The texts state the conditional course as a principle with one worked case; the mechanism is first described in Babbage’s Passages from the Life of a Philosopher (1864).","That Lovelace’s program is correct for every n. It is run for n = 1 to 5, and the adaptation of Operation 21 works only up to n = 5; nothing is proved about the program itself.","That the Lean model and the Rust machine agree on every deck. They agree on the 3,720 runs compared, Lovelace’s program among them; that is a test, not a proof. The general theorems are over whole numbers.","The plate was read from one printed copy; two cells are uncertain. The general result is Rojas’s, and his source, Bromley (2000), could not be read. Nothing here is claimed as first."],"principle":"When a sentence can be read two ways, build both, and say what each needs."},{"kind":"question","text":"If a program survives only as a printed table and a few sentences, how much of the machine it ran on can be recovered from the program?","status":"OPEN","detail":"Open here: a proof that Lovelace’s program, corrected, computes every Bernoulli number it is given; advancing variable cards without the adaptation; a formal proof that a forward course without the unconditional backing leaves the machine bounded; and whether a person reading the plate and the text agrees with the readings this all rests on."}],"sources":[{"title":"L. F. Menabrea, “Sketch of the Analytical Engine invented by Charles Babbage”, trans. and with notes by A. A. Lovelace, Scientific Memoirs 3 (1843), pp. 666–731","url":"https://www.fourmilab.ch/babbage/sketch.html","note":"“the mill will order other cards” (p. 687); Note G, the two courses (p. 728) and V₁₀ (pp. 730–731). Read in sources/notes/menabrea-lovelace-1843-control.md."},{"title":"A. A. Lovelace, Note G, “Diagram for the computation by the Engine of the Numbers of Bernoulli”, folding plate after p. 722, Scientific Memoirs 3 (1843)","url":"https://commons.wikimedia.org/wiki/File:Diagram_for_the_computation_of_Bernoulli_numbers.jpg","note":"Transcribed from the Natural History Museum copy on archive.org (scientificmemoir03memo), leaf 0754; sources/notes/note-g-table.md. The image in this note is the public-domain scan on Wikimedia Commons, not the copy transcribed."},{"title":"C. Babbage, Scribbling Book Vol. III, p. 162 (December 1837), the Babbage Papers, Science Museum Group","note":"The card that “always orders the backing”, which Reading B needs. Transcribed in sources/notes/codesign-L023.md §1.2."},{"title":"R. Rojas, “Unconventional universal computation in Babbage’s Analytical Engine”, arXiv:2408.03334, 2024","url":"https://arxiv.org/abs/2408.03334","note":"Universality from a conditional backing, after Bromley (2000). The general result is his."},{"title":"A. G. Bromley, “Babbage’s Analytical Engine plans 28 and 28a: the programmer’s interface”, IEEE Annals of the History of Computing 22(4), 2000","note":"Not read (paywalled); known only through Rojas (2024) and Wikipedia."},{"title":"M. L. Minsky, Computation: Finite and Infinite Machines, Prentice-Hall, 1967","note":"Two counters suffice. Cited, not formalised."},{"title":"Note G, “Error”, Wikipedia","url":"https://en.wikipedia.org/wiki/Note_G","note":"Secondary: reports the swapped division of Operation 4. Its figure for the uncorrected program, −25621/630, was not reproduced."},{"title":"chrishayuk/analytical-engine, commit a9a0b50","url":"https://github.com/chrishayuk/analytical-engine/tree/a9a0b50","note":"src/sketch.rs (the machine, configurations 1843 and 1843-B), control/note-g-*.txt, tests/note_g.rs, formal/Babbage/Note43.lean and Multi.lean, scripts/lean-diff.sh, docs/published-control-1843.md."}],"published":"2026-11-27"},"hash":"963ef36cf332796203c78257a90cd63af365902481ae68b8af014c7dc34ca2e4","algorithm":"sha256","provenance":{"id":"N-BABBAGE-NOTE-G","version":"1.0","recordHash":"963ef36cf332796203c78257a90cd63af365902481ae68b8af014c7dc34ca2e4","revision":{"kind":"initial","summary":"First publication, after a fact-check against analytical-engine a9a0b50: the title names Note G and the engine, not the program; the archive's judgement that Reading A fits the text better is given; the Reading B count's source marked as an encoding choice; December 1837 accepts the deck only with the forward course added; the comparison's coverage and the plate's resolution stated exactly; corrections described by kind with their sources."},"sources":[{"title":"L. F. Menabrea, “Sketch of the Analytical Engine invented by Charles Babbage”, trans. and with notes by A. A. Lovelace, Scientific Memoirs 3 (1843), pp. 666–731","url":"https://www.fourmilab.ch/babbage/sketch.html","note":"“the mill will order other cards” (p. 687); Note G, the two courses (p. 728) and V₁₀ (pp. 730–731). Read in sources/notes/menabrea-lovelace-1843-control.md."},{"title":"A. A. Lovelace, Note G, “Diagram for the computation by the Engine of the Numbers of Bernoulli”, folding plate after p. 722, Scientific Memoirs 3 (1843)","url":"https://commons.wikimedia.org/wiki/File:Diagram_for_the_computation_of_Bernoulli_numbers.jpg","note":"Transcribed from the Natural History Museum copy on archive.org (scientificmemoir03memo), leaf 0754; sources/notes/note-g-table.md. The image in this note is the public-domain scan on Wikimedia Commons, not the copy transcribed."},{"title":"C. Babbage, Scribbling Book Vol. III, p. 162 (December 1837), the Babbage Papers, Science Museum Group","note":"The card that “always orders the backing”, which Reading B needs. Transcribed in sources/notes/codesign-L023.md §1.2."},{"title":"R. Rojas, “Unconventional universal computation in Babbage’s Analytical Engine”, arXiv:2408.03334, 2024","url":"https://arxiv.org/abs/2408.03334","note":"Universality from a conditional backing, after Bromley (2000). The general result is his."},{"title":"A. G. Bromley, “Babbage’s Analytical Engine plans 28 and 28a: the programmer’s interface”, IEEE Annals of the History of Computing 22(4), 2000","note":"Not read (paywalled); known only through Rojas (2024) and Wikipedia."},{"title":"M. L. Minsky, Computation: Finite and Infinite Machines, Prentice-Hall, 1967","note":"Two counters suffice. Cited, not formalised."},{"title":"Note G, “Error”, Wikipedia","url":"https://en.wikipedia.org/wiki/Note_G","note":"Secondary: reports the swapped division of Operation 4. Its figure for the uncorrected program, −25621/630, was not reproduced."},{"title":"chrishayuk/analytical-engine, commit a9a0b50","url":"https://github.com/chrishayuk/analytical-engine/tree/a9a0b50","note":"src/sketch.rs (the machine, configurations 1843 and 1843-B), control/note-g-*.txt, tests/note_g.rs, formal/Babbage/Note43.lean and Multi.lean, scripts/lean-diff.sh, docs/published-control-1843.md."}]}}