May 11, 2026

2 + 2 + comment-section chaos

Abstract Machines for Logic Programs

Math rules become tiny computers, and the comments are absolutely nerding out

TLDR: The post shows how simple logic rules for arithmetic can be turned into tiny machines that compute answers in different ways. In the comments, theory fans loved the big-picture connection to classic programming-language ideas, turning a dry math topic into a mini celebration of deep computer-science history.

A deceptively calm blog post about how to turn math-like rules into little step-by-step machines somehow sparked the kind of comment-section energy usually reserved for framework wars. The post walks readers through a simple idea: if you write addition as a set of logical rules, you can also imagine a machine "running" those rules to find answers. Then comes the twist that got people buzzing: depending on which part of the equation you treat as the input, the same rule can act like addition, subtraction, or even a machine that hunts down every number pair that makes a total. To non-specialists, it’s basically, “What if one recipe could become several different calculators depending on how you ask the question?”

And the community reaction? Equal parts awed, nostalgic, and gloriously deep in the weeds. The standout comment came from Twisol, who immediately zoomed out and connected the post to Olivier Danvy’s famous work on rebuilding old-school language machines from theory. That set the tone: this wasn’t just “nice post,” it was people excitedly recognizing a grand tradition of turning lofty ideas into something mechanical and runnable. The hot take lurking under the surface is that some readers see this as elegant and illuminating, while others will absolutely read it as “computer science making 2 + 2 dramatically complicated.” Even with only one visible comment here, the vibe is unmistakable: the theory fans are feasting, the curious readers are peeking in, and everyone else is one step away from joking that addition has officially been given a cinematic universe.

Key Points

  • The article defines addition using inference rules for the relation `plus N M P` and treats execution as searching for values that satisfy the relation.
  • It presents a stack-machine model for running `plus` in mode `i/i/o`, where the first two arguments are inputs and the last is the output.
  • The machine uses evaluation states `k >> q`, answer-return states `k << a`, and stack frames such as `s _` to represent pending computation.
  • Changing the mode assignment of `plus` produces different machines, including a subtraction-oriented machine for mode `i/o/i` that can get stuck because subtraction on natural numbers is partial.
  • For mode `o/o/i`, the article shows a nondeterministic machine that enumerates pairs of numbers whose sum equals a given result.

Hottest takes

"the abstract machines implied by this process for other kinds of programs" — Twisol
"Rational Reconstruction of the SECD Machine" — Twisol
"interesting" — Twisol
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.