The Power of Constraint Solvers A developer with a career in constraint solving and constrained optimization surveys classical AI techniques — SAT, SMT, constraint programming, and derivative-free/surrogate-based optimization — and demonstrates them by building a minimal-depth 1-bit full-adder circuit from NAND gates. The writeup walks through real-world applications including verifying distributed program specifications for race conditions and deadlocks, generating mechatronic system architectures, and tuning bicycle aerodynamics and boiler modulation ratios. With my kids 1 footnote-1 having derailed every single one of my side projects including this blog , I thought to revisit a topic very dear to me: constraint solving and constrained optimization . I already wrote an article about “ Machine Reasoning https://btmc.substack.com/p/machine-reasoning-the-forgotten-side ” 2 footnote-2 , which is a made up umbrella term for all sorts of classical AI techniques in contrast to modern Machine Learning https://en.wikipedia.org/wiki/Machine learning -based approaches , but it was a very high level overview focused on listing different types of constraint solvers that didn’t really provide any particularly useful piece of information. Not very interesting, so here’s a better one. My entire professional career and academic research has involved constraint solving or constrained optimization in some capacity. Here are some use cases the tools I worked on have been applied to: - Verifying that distributed program specifications were free of race conditions and deadlocks, and then generating correct-by-construction program skeletons containing just the network communication from those specifications. - Generating mechatronic system architectures, including electrical power systems in aircraft and gearboxes in cars. - Parameter optimization, including improving bicycle aerodynamics and greatly improving the modulation ratio https://homesteadenergy.co.uk/what-is-boiler-modulation-and-how-does-it-save-money/ of a domestic water boiler. Each of the three bullet points used a different type of solver. The first used a chain of verification tools that ultimately invoked a Satisfiability Modulo Theories https://en.wikipedia.org/wiki/Satisfiability modulo theories SMT solver. The second used a combination of a Boolean Satisfiability https://en.wikipedia.org/wiki/Boolean satisfiability problem SAT solver and a Constraint Programming https://en.wikipedia.org/wiki/Constraint programming CP solver. The last one used a custom solver implementing a large portfolio of Derivative Free https://en.wikipedia.org/wiki/Derivative-free optimization and Surrogate-based https://en.wikipedia.org/wiki/Surrogate model optimization algorithms. Most programmers are completely unfamiliar with these sorts of tools and the wide variety of very hard problems they can tackle. If you are into game dev you might be familiar with Wave Function Collapse https://github.com/mxgmn/WaveFunctionCollapse , which is basically a Constraint Programming technique https://en.wikipedia.org/wiki/AC-3 algorithm applied to the procedural generation of textures and tile-maps. All those LLM math proofs coming out are using Lean https://lean-lang.org a proof assistant and are probably making very liberal use of the ‘ Grind https://lean-lang.org/doc/reference/latest/The--grind--tactic/ ’ 3 footnote-3 tactic for automated proof search, which uses SMT solver techniques under the hood. But this is all a little too abstract, so let’s solve a cool problem together. The Problem: An Adder Circuit Here’s what we want to accomplish: Using nothing but NAND-gates https://en.wikipedia.org/wiki/NAND gate , a “functionally complete” logic gate that can be used to implement any boolean formula, implement a 1-bit Full-Adder