Another generation’s notion of “Artificial Intelligence” was rooted in cold, correct, and emotionless reasoning from precise programs. It failed when it lacked humanity, when it did what it was told too literally, or when it made a calculated choice toward an outcome we didn’t like. Ah, but today’s AI can be tricked or persuaded, it can get carried away, be forgetful, and we’re suspicious that it too often feeds us what we seem to like. I don’t think it is that AI has changed all that much, just which parts of it we spend our time talking about. This post brings the focus back to kinds of AI that we’ve ignored for a while (at least until the last month or so) and how they work within the BayLeaf project.
Late 2026 has been an exciting time for the (always already ongoing) collision of mathematics and artificial intelligence. I’m fascinated by the Omega=9/4 and ETH False results, but I don’t want to discuss them, or even discuss the use of LLMs in uncovering these results. Folks, we made some great progress with formal logic recently!
Applied in a software engineering project, like the construction and operation of BayLeaf, formal logic most conspicuously arises in the use of formal verification (FV) to gain assurance that the system we’re building matches our intent without waiting for feedback from users. I hadn’t used much FV in BayLeaf until this holiday weekend but, boy, did that change quickly. Most of it happened in the gaps between chores, with me poking at my phone.
At the level of source code, BayLeaf is mostly just glue holding together pre-existing, open-source building blocks maintained by others. But it does have some algorithmic bits we can check more precisely. Here’s a quick tour of what I found between leftovers.
The Campus Pass feature of BayLeaf, which lets visitors access some BayLeaf services without signing in by virtue of joining from the physical campus network, has a rate-limiting scheme based on hash buckets that is a tiny bit mathy. Even just the process of writing down what I might want to prove about the rate-limiting scheme got me to spot that there were some edge cases around handling of IPv6 addresses that needed fixing. When I’m crafting automated tests, I’m often thinking about making sure that my code behaves on the cases I expect to happen (or the few edge cases I can think up myself). With FV, the focus shifted to thinking about the bounds of the space of cases that are even expressible in the system. Here, that shift in perspective helped me see and write down more relevant edge cases. We did try out LemmaScript, a way of lacing FV assertions into existing TypeScript code (I remember reading on my phone as the agent installed Dafny in its sandbox), but I never committed those annotations to the main repo because I was too excited to pull on other FV threads.
Our Sealed Inference service is where BayLeaf touches cryptographic security properties directly, so it deserved scrutiny from a few different angles. The first attempt happened on my phone while I was doing the dishes, in a setup equivalent to the one available to everyone in BayLeaf Chat with the Code Sandbox toolkit enabled. Running on the medium-sized model behind Chat’s Basic agent (GLM 5.3 Flash), the agent modeled the system in Lean. That model didn’t lead to any important observations about BayLeaf, but it did show that GLM was quite capable with proof assistants, even while I was only half-following along between plates. The session also left me with several suggestions for what to try next, one of which was CryptoVerif.
Back at my laptop, where I run BayLeaf-supported OpenChamber with access to a wider range of models from many different providers, I had a stronger agent check the earlier analysis and then follow up on the mobile session’s suggestions in separate subagent sessions. The CryptoVerif thread led to some important documentation changes for Sealed. While it is indeed true that the BayLeaf operator (me) can’t read what you send through Sealed, I can replay your messages or send additional messages under your key (effectively impersonating you). Perhaps I could have anticipated this at the time of the system’s initial design and documentation, but it simply didn’t become apparent to me until the tools showed me how the number of replies your client decrypts could be greater than the number of queries you originally encrypted. That was a surprise to my agents, too. The surprising evidence was constructed by a boring old classical logic theorem prover.
We have this service called BayLeaf Rooms that, well, I don’t want to describe what it does. It is infrastructure related to conflict-free replicated data types (CRDTs), something you’d need if you were making Google Docs-style multiplayer collaborative editing interfaces. The code for it is fiddly, and the service has barely any real-world testing so far. So, I wasn’t surprised when a formal model of the system in Alloy was able to uncover a bug I hadn’t considered. I had used Alloy before for other projects, so I remember what it was like to spend hours and days refining the formalization of a system. However, in this flurry of FV activity, I wasn’t closely monitoring what my agents were doing with Alloy in Rooms. By the time I understood it, the model was constructed, refined, a bug was found, reproduced in the real BayLeaf codebase, and a production fix was already up in a public pull request, being reviewed by other coding agents (which also seemed to be far more FV-literate than I expected).
BayLeaf has an Inboxes service that is used to capture incoming email and webhook posts. Seemed like TLA+ might have been the right FV tool for the job, but my agents suggested Quint as an alternative better aligned to my existing TypeScript codebase. Honestly, I don’t quite follow what happened next. My laptop’s CPU fans blew for half an hour while a combinatorial solver ran, and some bugs were found and fixed. System get better. My personal contribution boils down to little more than “What if we used FV here?”
All of that activity got me thinking that there might be areas in the BayLeaf codebase where I’ve written way too many explicit unit tests for known edge cases when a more compact and elegant testing approach would have used FV. An agentic scan of the codebase didn’t turn up areas for major improvement, but it did get me to one other example where focusing on the general property I wanted to check was cleaner than trying to enumerate all of the specific cases I could imagine. We have a script used in enforcing our data retention policy (er, our data deletion policy) that is high risk because of the destructive powers it wields. My agent suggested applying property-based testing (PBT) with Hypothesis because the data cleanup job runs in Python. The rewrite of the test suite using PBT didn’t lead to a major reduction in the overall size of the codebase, but it did improve test coverage and reveal some cases I hadn’t considered. It felt like a worthwhile adoption. Hypothesis doesn’t run any fancy external solver or reasoning engine; it just nudges the programmer to write a test case generator rather than having them mentally generate and write out all of the cases of interest. Some call this lightweight FV.
In every case here, there was a win (however modest) from neither trusting my own thinking nor trusting the LLM-based agent’s thinking (or even the combination). I have a better understanding of how my system works, even though I’m the one who built it, because I took the extra step of doing some of the reasoning symbolically. The “I” there is me and my agents, and neither of us was doing the symbolic part: they reason mostly via goopy neural analogies, and I was mostly loading the dishwasher. Calculemus! Sometimes you just need to turn that cold, correct, emotionless crank a bit to see if the result agrees with the one you expected.
My background is in Symbolic AI, so I must have a terribly biased perspective here. But, it is sorta fun to see old-timey logical inference engines reveal details that were missed by multiple passes of scrutiny by an experienced human researcher/engineer and his state-of-the-art LLM-based neural buddy agent.
Assorted receipts:

