Random Search and Guaranteed Correctness with CryptOpt A researcher behind the Fiat Cryptography project described CryptOpt, a system that generates formally verified straightline cryptographic code by combining random search with benchmarking against real processors. The approach targets performance gaps left by Fiat Cryptography, whose generated C code was roughly the fastest known in C but still slower than hand-written assembly from top experts. CryptOpt aims to close that gap while preserving correctness guarantees. Let me continue this sequence of posts making the case for deriving programs step-by-step from specifications, in a way that guarantees correctness https://stng.substack.com/p/correct-by-construction-code-via , as contrasted with how LLM-powered coding assistants are being used widely today. I have already given two examples, one each in software https://stng.substack.com/p/high-level-algebra-for-low-level and hardware https://stng.substack.com/p/deriving-efficient-hardware-in-the . What those examples have in common is use of proven rewrite rules to transform program representations. That is, a rule is stated and proved mathematically in full generality, and then it can be applied to individual programs at low cost. It is not always feasible to think up the perfect library of rewrite rules in advance. Even if we wake up one day knowing the perfect rules, proving them in general can be harder than proving their specific uses for concrete programs. Luckily, correct-by-construction derivation can also sometimes work with a more-flexible approach. I covered one example a few months back in a presentation of formal verification from an evolutionary perspective https://stng.substack.com/p/formal-verification-the-ultimate . Now I’d like to go into more detail on how it works. Straightline Code Deserves Formal Verification, Too We previously reviewed https://stng.substack.com/p/codesign-for-ai-and-programming classic computer-science results around formally undecidable https://en.wikipedia.org/wiki/Undecidable problem problems in automatic program understanding. The trouble comes down to programming features like loops