{"record":{"id":"N-Q-SYSTEMS","slug":"a-q-system-rule-never-replaced-anything","kind":"notebook","title":"A Q-system rule never replaced anything.","dek":"Colmerauer’s Q-systems, the Montréal translation project’s rule language, rebuilt from his report of 1970. Sixteen rules analyse a French sentence into its tree; run the other way, they write its eighteen paraphrases into one graph that matches his printout.","abstract":"A note about reconstructing the Q-systems, the rule language Alain Colmerauer designed at the Université de Montréal for the TAUM machine-translation project, in use from October 1969. No program text of it is known to survive. With a coding agent, the language was rebuilt from Colmerauer’s report of September 1970, read from its page scans. A Q-system rewrites a graph of strings, not a string: a rule adds a path beside every path it matches and replaces nothing, and the arrows it rewrote are removed only when no rule applies any more. So one graph holds every alternative, with the shared parts shared. Run on the report’s examples, the reconstruction gives every result the report prints, with two exceptions. Its French example runs both ways: the sixteen rules, inverted, analyse a sentence into its normalised tree, and as written they synthesise its eighteen paraphrases into one graph of nineteen vertices, which is the report’s printout line for line, vertex numbers and all; each of the eighteen analyses back to the one tree. The exceptions: the report’s rules for turning a tree into a string do not stop as printed, and the eighteen sentences of the last printout come out in exactly the reverse of the report’s order. And the rules for removing one string remove its neighbours too.","created":"2026-11-26","version":"1.0","status":"OPEN","publication":"published","authors":["Chris Hay"],"lineage":"COLMERAUER 1970 → AGENT → THE MACHINE THE REPORT DESCRIBES → ITS EXAMPLES RUN → ITS PRINTOUT COMPARED","concepts":["ai-agents","source-authority","verification","programming-languages"],"related":["N-ABSYS","N-IPLV","N-JOSS","N-ALGOL-60"],"media":[],"body":[{"kind":"observation","label":"01 / A GRAPH OF EVERY GROUPING","text":"In October 1969 a program written in ALGOL by Alain Colmerauer was running on the CDC 6400 of the Université de Montréal. It ran his Q-systems, the rule language of TAUM, the university’s project to translate English into French by computer. In the project’s chain, his report says, an English sentence went through no fewer than fifteen Q-systems before it came out in French. The Computer History Museum’s Prolog archive says that Colmerauer considered the Q-systems the ancestor of Prolog. The report opens on the problem they were made for. To analyse a sentence you must try every partial grouping of its words, and to hold that multitude economically Colmerauer used a directed graph, each arrow carrying a tree. A Q-system is a set of rules that turns one such graph into another. No program text of the Q-systems is known to us. The report, Les systèmes-Q ou un formalisme pour analyser et synthétiser des phrases sur ordinateur, of September 1970, gives the whole grammar, the meaning of every construct and the printed results of its examples. I asked a coding agent to rebuild the language from it, and to run every example it prints.","references":[{"label":"A. Colmerauer, Les systèmes-Q, publication interne no 43, Université de Montréal, September 1970, pp. 4–5","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf"},{"label":"Computer History Museum, History of Prolog: Université de Montréal","url":"https://softwarepreservation.computerhistory.org/prolog/"}]},{"kind":"observation","label":"02 / A RULE ADDS A PATH","text":"Every path from the entry of the graph to its exit is one string, and a rule a1 + … + ap == b1 + … + bq. is applied to a path, not a string. For every path whose trees match its left side, the first phase adds a new path, carrying the right side, between the same two vertices. Nothing is replaced: “on ajoute donc au graphe le tout nouveau chemin”, so the old path and the new one sit side by side, and later rules match paths through either. This goes on until no rule applies to a path it has not been applied to. Only then does the second phase remove every arrow some rule was applied to, and after it every arrow no longer on a way from entry to exit. The example of the report’s section 8 recognises AⁿBⁿCⁿ in two rules. On A + A + A + B + B + B + C + C + C, the first phase grows nine arrows into nineteen: two A(1), one A(1,1), the same for B and C, and one S(1,1,1), exactly the arrows of the figure on page 29. The second phase leaves S(1,1,1). The report says the result of a phase that converges does not depend on the order in which the rules were applied. The rules of the report’s largest example were put in 32 orders (its last two phases have one rule each, so the orders differ in the first two); every order printed the same graphs. The printout is sorted, so this compares what was made, not the order it was made in. It follows from the definition: every rule is applied to every path, whatever the order.","references":[{"label":"Colmerauer 1970, p. 22: the two phases; pp. 27–29: the example of section 8 and its figure","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf"}]},{"kind":"observation","label":"03 / ONE SYSTEM, BOTH WAYS","text":"Colmerauer called reversibility one of the originalities of the Q-systems: practically the same system can describe a transformation and its inverse, analysis and synthesis. His last section shows it. Sixteen rules take a normalised sentence, a tree of verbs and their subjects and objects, to French: active or passive, each embedded clause as a clause or as a noun. -INV- exchanges the two sides of every rule. The treatment runs the system inverted, then as written. Inverted, it analyses RICHARD CONSTATE QUE LA DESTRUCTION DE BEAUCEVILLE PAR BENOIT ETONNE GAETANE into the tree drawn on page 36; along the way it makes 38 arrows of partial groupings and keeps one. As written, it synthesises from that tree every paraphrase: eighteen sentences in one graph of nineteen vertices and 139 arrows, where written out one to a line they take 282. Pages 38 to 40 print that graph as 35 lines. The reconstruction prints the same 35 lines, with Colmerauer’s vertex numbers, and page 42 draws the same graph. Then each of the eighteen sentences was put back through the inverted system. Every one gives the one tree.","references":[{"label":"Colmerauer 1970, p. 4: reversibility; pp. 35–42: the paraphrase treatment and its results","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf"}]},{"kind":"observation","label":"04 / THE RULES OF PAGE 30 DO NOT STOP","text":"Page 30 gives two rules to take a tree apart into a “structured” string: A*(U*) == [(A*) + ](U*) / U* ≠ -NUL-. and ](I*,U*) == I* + ](U*). Applied to A(B,C(A,E(F))), the report says, they would produce [(A) + B + [(C) + A + [(E) + F + ] + ] + ]. Applied as the report’s own section 7 defines, they never stop. The [(A) they make is itself a tree of the form A*(U*), with [ for A* and A for U*, and nothing stops the first rule matching it again: it becomes [([) + ](A), then [([) + ]([), and so on. Every path is matched, including the new ones, so a rule that matches its own output goes on for ever. With one condition the report does not have, that A* is neither [ nor ], they produce exactly the printed string. The inverse pair, on the same page, works as printed, because its condition already keeps the brackets out. So as printed these rules run only one way.","references":[{"label":"Colmerauer 1970, p. 30","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf"}]},{"kind":"observation","label":"05 / A RULE REWRITES ARROWS, NOT STRINGS","text":"The same page gives three rules to delete from a graph “tout chemin portant une chaîne donnée”, every path carrying a given string, here LE + FAIT + QUE + LE + FAIT + QUE. The first rewrites it as /CUL + /DE + /SAC, and the other two add /CULDE and /DESAC beside the pairs they match. When the rewritten arrows are removed, /CULDE and /DESAC are left leading nowhere, and “à la fin de cette dernière phase il ne reste plus rien”, page 31 says. That is what happens. But the second phase removes arrows, and an arrow can belong to many strings. Given a graph that carries LE + FAIT + QUE + LE + FAIT + QUE and also LE + FAIT + QUE + BENOIT, sharing their first three arrows, the rules remove both: nothing is left of either. A shared prefix belongs to every string through it, and it cannot be taken from one and left to the others. The same holds for every rule, not only these: an arrow some rule used is gone from every string that ran through it. In analysis that is usually harmless, because every string through such an arrow was rewritten too.","references":[{"label":"Colmerauer 1970, pp. 30–31: the cul-de-sac","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf"}]},{"kind":"observation","label":"06 / AMBIGUITY COSTS NOTHING","text":"The French grammar of the last section is recursive, and allows infinitely many sentences. Every normalised sentence with at most one embedded clause was synthesised, with its three verbs and four names: 8,112 trees give 131,424 different sentences, and no sentence comes from two trees. Then every one of the 131,424 was put back through the inverted system, and each gives back its one tree. The report’s own example has two embedded clauses, so it is not among them; its eighteen paraphrases analyse back too. The many groupings of the introduction exist only during the first phase, as partial analyses that the second throws away. What a graph does with a sentence that is ambiguous needed a grammar of our own, not the report’s. In it AVEC LE TELESCOPE can go with the seeing or with the man. Analysed, JEAN VOIT L HOMME AVEC LE TELESCOPE gives one graph with both readings, as two arrows between the same two vertices. Nothing chooses between them; a later phase can work on both at once.","references":[{"label":"Colmerauer 1970, p. 35: the normalised sentences; p. 4: the combinatorial problem","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf"}]},{"kind":"observation","label":"07 / THE ORDER THAT DOES NOT MATCH","text":"Every computation the report gives a result for comes out as it says, with two exceptions: the rules of page 30, above, and this one. The last two phases of the paraphrase treatment pack each sentence into one tree and unpack it again, so that each of the eighteen is printed on a line of its own, from -01- to -02-. Pages 40 and 41 print them in one order. The reconstruction prints the same eighteen lines in exactly the reverse order. The report does not say how its program ordered the paths leaving a vertex. At all fourteen vertices of the synthesis graph with more than one path leaving them, the printed paths are in ascending order of their trees, and that order reproduces pages 38 to 40; the same order puts pages 40 and 41 backwards. No simple order of making or keeping arrows was found that fits both pages. The order was most likely a side effect of the lists of the lost program. The test for pages 40 and 41 checks the reversal, so that it stays a recorded difference and not a hidden one.","references":[{"label":"Colmerauer 1970, pp. 38–41","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf"}]},{"kind":"connection","text":"The Q-systems run in the browser, compiled from the same Rust source as the command-line version. Choose a treatment and step through a phase one rule application at a time: the path each rule matched, the path it added beside it, then what the second phase removes and what is left, drawn as the report draws its figure on page 29.","links":[{"href":"/demos/q-systems?example=abc","label":"AⁿBⁿCⁿ, the example of section 8, step by step — interactive study"},{"href":"/demos/q-systems?example=paraphrase","label":"The paraphrase treatment: analysis, then synthesis"},{"href":"https://github.com/chrishayuk/q-systems/blob/main/docs/decisions.md","label":"Every rule of the machine, and the page it rests on"},{"href":"https://github.com/chrishayuk/q-systems/blob/main/docs/research.md","label":"The experiments, with their numbers"},{"href":"https://github.com/chrishayuk/q-systems","label":"Source, examples, acceptance tests and the playground"}]},{"kind":"refusal","title":"WHAT THIS DOES NOT SHOW","lines":["No program text of the Q-systems is known to us. This is the formalism as Colmerauer’s report describes it, not the program he wrote; where the report is silent, the choice made is listed as a decision.","The scan of the report is missing printed page 23, which most likely held a first, simplified example. The system of section 8 is therefore called an example here, not the first. A 1972 TAUM printout was used only for the form of the output.","The order in which paths are printed is a decision fitted to pages 38 to 40, and it puts pages 40 and 41 in reverse. The form of the details printed for -DET- is our own.","The two-readings grammar is ours, not the report’s. The TAUM grammars, the earliest large Q-system programs, have not been seen, nor has METEO, written later in Q-systems, nor any later version of the formalism.","Everything was read and built by one coding agent, from scans, and has not been checked by a person. No literature search was made, so nothing here is claimed as new."],"principle":"A language that survives only as a description can be rebuilt as that description; its own printed results are the test, including the one that does not match."},{"kind":"question","text":"What did the TAUM grammars look like?","status":"OPEN","detail":"Colmerauer and Roussel name the TAUM grammars written in Q-systems: English morphology, the analysis of English, transfer, French synthesis and French morphology. TAUM 71, edited by Colmerauer in January 1971, is listed by the Computer History Museum as holding the English morphology, and may hold the others. They are the earliest large Q-system programs. Run here, they would test the decisions made from a 45-page report, and show what the graph of every grouping cost on real English."}],"sources":[{"title":"A. Colmerauer, Les systèmes-Q ou un formalisme pour analyser et synthétiser des phrases sur ordinateur, publication interne no 43, Département d’informatique, Université de Montréal, September 1970","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf","note":"Read in full from the page scans on Alain Colmerauer’s site, linked from the Computer History Museum’s Prolog archive. Every example and quotation was read from the images, not the OCR. The scan lacks printed page 23 and has page 16 twice. All the figures but the TAUM printout are cropped from it. Republished in Traitement Automatique des Langues 33 (1–2), 1992, pp. 105–148, according to Colmerauer’s bibliography (TPLP, 2004); that version was not seen."},{"title":"I. Findeisen-Bellert, interactive session with TAUM translating a sentence from English to French, c. 1972. Gift of Janusz Bień, Computer History Museum","url":"https://softwarepreservation.computerhistory.org/prolog/montreal/src/Findeisen-Bellert-TAUM-1972.pdf","note":"Line-printer output, folded at a fixed width. Used only for the form of a printed graph: PHASE n, then -01- … -02-."},{"title":"Computer History Museum, History of Prolog, section Université de Montréal","url":"https://softwarepreservation.computerhistory.org/prolog/","note":"The source of both documents, and of the history quoted from Colmerauer and Roussel’s “The birth of Prolog” (1996), which was not read in the original."},{"title":"chrishayuk/q-systems","url":"https://github.com/chrishayuk/q-systems","note":"The machine, every example of the report with its output, 21 acceptance tests that name their pages, every decision with its evidence, the experiments, and the playground."},{"title":"Coding-agent session, 26 November 2026","note":"The interpreter, the transcriptions and the comparisons were made with a coding agent. Every result in this note can be rerun on the interactive study or with cargo test in the repository."}],"published":"2026-11-26"},"hash":"9da8fb9bc2f9d8c32232aeb1ede2c0b84ebb54b892eb1ed1f08316495057ef44","algorithm":"sha256","provenance":{"id":"N-Q-SYSTEMS","version":"1.0","recordHash":"9da8fb9bc2f9d8c32232aeb1ede2c0b84ebb54b892eb1ed1f08316495057ef44","revision":{"kind":"initial","summary":"The note after an independent fact-check against the report's page images: two results of the report differ, not one (the p. 30 rules do not stop, and the last printout is reversed); fourteen branching vertices, not six; the grammar's unambiguity is stated for sentences with at most one embedded clause, and every one of them was analysed back to its tree; the p. 27 system is the example of section 8, not the first; TAUM 71 is given only as holding the English morphology; METEO is named; the 1992 republication is recorded as not seen."},"sources":[{"title":"A. Colmerauer, Les systèmes-Q ou un formalisme pour analyser et synthétiser des phrases sur ordinateur, publication interne no 43, Département d’informatique, Université de Montréal, September 1970","url":"http://alain.colmerauer.free.fr/alcol/ArchivesPublications/SystemesQ/SystemesQ.pdf","note":"Read in full from the page scans on Alain Colmerauer’s site, linked from the Computer History Museum’s Prolog archive. Every example and quotation was read from the images, not the OCR. The scan lacks printed page 23 and has page 16 twice. All the figures but the TAUM printout are cropped from it. Republished in Traitement Automatique des Langues 33 (1–2), 1992, pp. 105–148, according to Colmerauer’s bibliography (TPLP, 2004); that version was not seen."},{"title":"I. Findeisen-Bellert, interactive session with TAUM translating a sentence from English to French, c. 1972. Gift of Janusz Bień, Computer History Museum","url":"https://softwarepreservation.computerhistory.org/prolog/montreal/src/Findeisen-Bellert-TAUM-1972.pdf","note":"Line-printer output, folded at a fixed width. Used only for the form of a printed graph: PHASE n, then -01- … -02-."},{"title":"Computer History Museum, History of Prolog, section Université de Montréal","url":"https://softwarepreservation.computerhistory.org/prolog/","note":"The source of both documents, and of the history quoted from Colmerauer and Roussel’s “The birth of Prolog” (1996), which was not read in the original."},{"title":"chrishayuk/q-systems","url":"https://github.com/chrishayuk/q-systems","note":"The machine, every example of the report with its output, 21 acceptance tests that name their pages, every decision with its evidence, the experiments, and the playground."},{"title":"Coding-agent session, 26 November 2026","note":"The interpreter, the transcriptions and the comparisons were made with a coding agent. Every result in this note can be rerun on the interactive study or with cargo test in the repository."}]}}