Brought to You By: • Antithesis - verify your system’s correctness without human review or traditional integration tests - and avoid bugs or outages. • turbopuffer - a vector and full-text search engine built on object storage. It’s fast, cheap, and extremely scalable. • WorkOS - everything you need to make your app enterprise ready. - There’s a popular theory that AI will finally make formal verification mainstream because mathematical proof of correctness will be needed when machines write most or all of the code. But will this happen? Today, I’m talking with one of the best people to tackle the prediction. Hillel Wayne is a formal methods consultant, educator, and author, who’s deeply interested in software history. In this episode of Pragmatic Engineer podcast, I sit down with Hillel to compare software engineering with traditional engineering, discuss where formal methods fit into modern software development, and we explore why they are essential for some of the world's most complex systems. We cover the formal specification language, TLA+, walk through several formal verification tools, examine why distributed systems are so difficult to reason about, and look into whether AI will make formal methods accessible to more engineering teams. - Timestamps 00:00 Intro 03:21 The Crossover Project 10:26 What software engineering does better 14:19 What traditional engineering does better 17:06 Formal methods 28:21 TLA+: what it is and demo 35:47 TLA+ at Amazon 36:59 Ways distributed systems break 39:52 Formal methods and systems thinking 45:09 The value of learning math 49:12 What TLA+ is good for and isn’t 51:39 Alloy: a declarative language for software modeling 57:42 Other formal methods tools 1:00:13 Property-based testing 1:04:20 AI and the need for formal verification 1:11:18 Logic for programmers 1:13:24 Hillel’s 2025 prediction on AI’s impact 1:20:19 Book recommendation - The Pragmatic Engineer deepdives relevant for this episode: • How to debug large, distributed systems: Antithesis • How AWS S3 is built • Paying down tech debt • How Big Tech does quality assurance (QA) • Bug management that works • Resiliency in distributed systems - Production and marketing by https://penname.co/. For inquiries about sponsoring the podcast, email podcast@pragmaticengineer.com. Get full access to The Pragmatic Engineer at newsletter.pragmaticengineer.com/subscribe
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
SPEAKER_00There's a popular theory going around that AI will finally make formal verification go mainstream because when machines write the code, humans will need mathematical proof that is correct. Today, I'm talking with one of the best people to respond to this, Hillel Wayne, a formal methods consultant. He's taught TLA+, a popular formal specification language across the industry, wrote the book Logic for Programmers, and will soon be joining Antisys. In today's conversation, we discuss The Crossover Project, Hilo's research interviewing 15-plus traditional engineers to answer the question. If you want to understand more about formal verification and get a sense of
SPEAKER_00whether this approach could go mainstream with AI, this episode is for you. In today's episode, we'll get to the question, does it make sense to use formal methods to verify AI written code? As a spoiler, the answer will be proper formal methods are an overkill for this,
SPEAKER_00but lightweight formal methods can actually be helpful. This is where I need to mention our presenting sponsor, Antizizis. Antisysys verifies your system of correctness by running your whole system in hostile simulation and finding bugs. It does this by using an approach called deterministic simulation testing, or DST, which ADW's distinguished engineer Mark Brooker and Ankur Desai have described as lightweight formal methods. Setting aside Entisysys for a minute. If you as an engineer want to get more serious in verifying that your system works as intended, your best bet would be to use lightweight formal methods.
SPEAKER_00Now back to Entisysys. Entisysys turbocharges testing by running your whole system under aggressive Imagine Antithesis as hundreds or thousands of versions of the Mario game running, each instance aggressively trying to break the game with increasingly weird input combinations. With Antithesis, you can specify properties at the whole system level, and Antithesis will actively try to disprove them, so you can be confident that if your system holds up in Antithesis, it will hold up in production. There's good reason teams like Janestreet, Fly.io, and the etcd community rely on Antithesis.
SPEAKER_00Head to antithesis.com slash pragmatic to learn more. So hello, welcome to the podcast. Thank you so much. I'm really excited to be here. It's so nice to have you here. I was curious, you're very well known for formal methods, for programming, for logic, for all of these topics, but how did you get into tech?
SPEAKER_01So to start, I never really saw myself as a technical person. I liked computers growing up and I did a tiny bit of programming. My father was a programmer. He taught me Visual Basic. But I always wanted to do physics and math. That was like my dream. I put in my college application, I want to listen to the heartbeat of the universe. Don't ever take advice from like a high schooler for writing, just saying. But after about three years of doing this in college, I realized that I kind of liked the idea of physics, but I didn't enjoy doing it. And I couldn't see myself doing it for 50 years. What part I did enjoy, though, was the programming in the labs.
SPEAKER_01That was the most fun part to me. So I thought, well, if this is what I enjoy, want to try to do it full time. So after college, I left for San Francisco and became a developer, a Ruby on Rails developer in education technology. After some time, I moved back to Chicago. And then in the course of the next job I was working in, also in education technology, I fell into my current niche, which is formal verification and formal methods.
SPEAKER_00The first time I came across your writing because you write a blog, a pretty regular one, and I really enjoy your writing. The first time was with the crossover project.
SPEAKER_01This was a project where you attempted to answer,
SPEAKER_00are we as software engineers actually engineers?
SPEAKER_01Yes.
SPEAKER_00Can we talk about this project?
SPEAKER_01Absolutely. So I guess I should probably start with the motivation, which was,
SPEAKER_00I've read a lot of books on software and I've read a lot of online articles about software.
SPEAKER_01And one of the favorite things that software developers do is argue about whether it should be engineering or not, right? And there's the cap of people that say, well... We don't deserve to call ourselves engineers. We should not. They are so far above us. We shouldn't even like consider ourselves in the same space. And then there are the people who are like, what we do is so special and so unique. Engineering doesn't have anything on us. They can't hold a candle to what we do. You see books like Software Craftsmanship, which talk about how like, oh, engineering is this really boring, slow field and software is this incredibly creative, special, wonderful thing.
SPEAKER_01I was very firmly in camp one.
SPEAKER_00I thought we were not engineers. We didn't deserve to call ourselves engineering, anything like that.
SPEAKER_01What I do for work is really carefully analyzing software systems. And I thought, ah, this is real engineering and everything else is not engineering. Then I found this talk by Glenn Vanderberg, where what he did was he read a bunch of engineering books and compared them to what we do in software. And he said, actually, this looks really similar to what we do in software. And I thought, that can't be right. I need something more rigorous. I'm going to have to talk to people who did both engineering and software development and see what they say. And they all agreed with him. So I was wrong. We're engineers. Can we go a little bit into it?
SPEAKER_00So as I started talking to the first people, I realized that this was a much deeper project than I ever expected.
SPEAKER_01And I decided I needed to have as comprehensive a look at traditional engineering as I could possibly get.
SPEAKER_00There are many kinds of engineering.
SPEAKER_01There's not just building bridges, but there's designing circuits. There's figuring out chemical processes. There's industrial engineering, which is figuring out the layouts of factories and how we organize kinds of labor. There's just so many different kinds. And I wanted to see every single kind's view into what engineering looked like. To compare them all to software, which when you think about it, when we say like, oh, software isn't like building a bridge, maybe it isn't. But is it like designing a circuit? Is it like figuring out a chemical flow? Maybe those are much more closer to the kinds of engineering we do. I needed to know.
SPEAKER_01I think in the end, I talked to about 15 or 20 people in total across about six or seven different fields.
SPEAKER_00And what were the similarities that you found that software engineering has with either specific types of engineering or across the board?
SPEAKER_01If I had to summarize what I found in general, I'd put it like this.
SPEAKER_02Everybody hates waterfall.
SPEAKER_01No way. The core tension of engineering is between how expensive it is to make a mistake and how quickly you can iterate. The faster you can iterate, the less planning you need to do before you iterate. And the more expensive it is, the more planning you need to do. That's why, for example, when you're building a building where you can't build it multiple times and see what happens, you have to do a lot of planning up front. But even then, you are looking for ways to iterate on the plan. You do things like build scale models, you use software to simulate the building, you do CAD models, etc.
SPEAKER_01And in other fields, like in, for example, electrical engineering, you have the ability to come up with a design, test it, and then throw it to the fab and get something back. So they will iterate a lot more than civil engineering does.
SPEAKER_00Ah, interesting enough. I heard the term smoke test originated from electrical
SPEAKER_01engineering, actually. I did not look into that, but I could believe it.
SPEAKER_00Yeah, apparently it's when you have a test circuit and you just hook it up. And if it does, if it smokes, it's already bad. That is very interesting. So even within engineering, when we say traditional engineering, there's just layers of engineering or differences, right?
SPEAKER_01Layers of iteration, I'd say. One of the first people I talked to was actually a mining engineer. He designed mines and Okay, so I guess we all hate waterfalls.
SPEAKER_00Or the idea of waterfall.
SPEAKER_01Yeah.
SPEAKER_00What are some of the interesting differences that you came across? Either where engineering is ahead of us or traditional engineering does have things on us, which you were hoping to find, or places where actually software engineering is ahead in some ways.
SPEAKER_01There's both differences in how we practice it, but also differences in the shape of our material. Because every engineering concerns a different material, they have different constraints.
SPEAKER_00While it's true that everybody tries to iterate as fast as they can,
SPEAKER_01often turning to software to do that, software is the best at it. The best comparison is chemical engineering, where I talk to people saying that they would set up their experiment, run it overnight, and get the results the next day. And that was fast. With us, we can basically press F11 and get the result, right? And that allows us to basically iterate much faster than even those fields can. I think we all kind of know this. One thing that we might not realize as software engineers is that our work is a lot more consistent than other fields. The example I always do sometimes because I've given a talk about this is I would pull out like a CPU chip or like a stick of RAM
SPEAKER_01and I'd say like, hey, here's the spec sheet. And if I look at the spec sheet, it says this resistor has a resistance that is within 20% of 100 ohms as long as you keep it between 20 and 50 degrees centigrade. So they're basically saying that if they make a thousand of these, there's going to be a variance of 20% across all 1000. And the only way to know is to test them. And then if you run it for too long or you heat it up too much, it's going to change again. With software, assuming no like CPU bugs or anything like that, the same program, if it runs on this computer or on your computer, exact same.
SPEAKER_01Sort this list the exact same with the sorting algorithm.
SPEAKER_00Does this also mean that we might not account for variability as much as other engineering disciplines do?
SPEAKER_01I'd say so. The variation we have to deal with is kind of And how did you see the similarities or differences of
SPEAKER_00Software engineers, for example, often interact with customers, with end users who use the software. In other engineering fields, is this also a thing where as an engineer, you will talk or know your customer or just... Not knowing them at all.
SPEAKER_01I think it depends because different engines I talked to had different experiences. Some said that they felt that with software, they felt much closer to the customer. With other ones, they said they felt much further. So I think it's hard to really tell there.
SPEAKER_00One thing I remember vividly is a difference that you pointed out, which was very different and almost makes software engineering a bit higher status or better place is open source. The concept of open source.
SPEAKER_01Yes. So... That is one thing that seems very special about software versus any other field. Like the reason I'm here in Hungary right now with you is because I'm going to be speaking at craft conference, right? Most other fields of engineering, or in fact, any other field of like human labor has two kinds of conferences, academic conferences where they talk about research and trade shows where they try to sell, where vendors try to sell to like companies. Software is kind of unique in having the third kind of the practitioner conference
SPEAKER_01where we are just meeting to get better at what we do. We also are really the only kind to really focus heavily on like open source and making our knowledge freely available. For any language, you can probably find out how to learn language online, right? You don't have to buy a book. You don't have to like talk to the vendor to learn it. That's something really special about software.
SPEAKER_00I wonder why this might be both the fact that we do share a lot of the information or the craft or how we build things. Even some of the largest companies, I think, are like an Uber or Airbnb. These are $100 billion companies. They will not particularly hide how they built that piece of software Uber publishes and does talks about their app that is used by all these people, how exactly they built it or approximately. I wonder why this... I'm going to switch to
SPEAKER_01speculation for a second. This isn't something that I could really speak on with full authority, but my guess is that part of it is cultural. But another part of it is that the material we work with is the same as our product, right? We are using software to write software versus using tools and lathes to build things or using software to design circuits. And I personally think that that similarity, basically, that we are using the same materials on both ends is what makes it so much easier for us to talk about things like open source.
SPEAKER_00Interesting how I like this thinking of materials used in each engineering and how our material is software. Of course, the hardware engineering, and we know that's a bit different, of course. But already there's a divide between hardware engineering and software engineers on how much they share, how much we know about them, and so on.
SPEAKER_01I kind of wonder, I've got some friends who do like 3D printing, and it seems like, and I haven't looked into this, but it seems like they also have like a very open space of like sharing things freely. And I wonder if that's the same because it is so easy to share and because like the unit of value is the schematic there, if that kind of leads to the same thing.
SPEAKER_00I also wonder if hacker culture might play a thing in places where it's easy enough to afford to get started on a thing, for example, ham radios, which is not entering, but there's a thriving community where they share the setup, the things, they talk with each other. Small electronics might be, but ultimately software started in the 70s when it was affordable and anyone could buy a computer, maybe the internet. I'm also just speculating.
SPEAKER_01Yeah, definitely something worth doing a follow-up project on, right?
SPEAKER_00Well, you've already spent a bunch of time on it.
SPEAKER_01Don't give me so many rabbit holes. There's already too many rabbit holes in my life.
SPEAKER_00One more thing that you brought up is version control and the fact that in software, we just take it for granted. We have version control everywhere. And you said that this is super unique across most of engineering.
SPEAKER_01Yeah, I interviewed like 20 people on this. I think all 20 mentioned version control as the thing they wish they had in their old field. Wow. Yeah. Now, to be clear, they do have things like change management in like other fields. But I think version control as we have it, is so much more sophisticated than anything they have. It's like comparing like a modern car to a Model T.
SPEAKER_00What do you think there are things that now having talked with so many people and learned about the different engineering cultures, like actual traditional engineering cultures, what could we learn from them? What are some kind of inspiration that might be useful here or there?
SPEAKER_01Yeah, this is a harder question because while everybody I talked to mentioned those two things of openness and version control, I got a much more scattering set of answers when
SPEAKER_00talking to people about what we could learn from their old fields.
SPEAKER_01The two things I kind of gleaned out is that one, while we are a lot better at iterating than other fields, we're worse at the planning part. Like we still need to do some kind of planning before we iterate. And we just aren't as good as those other fields, in part because we can get away with not doing it as much. But we could get some sort of fusion of the two and get even better than we currently are, which, hey, plug for what I do. The other thing that I think is more interesting in terms of being a bit more shocking to me is that while we're better at being open about all of our materials,
SPEAKER_01We seem to be worse at compiling information about the specifics of our job. And that's a bit loosey-goosey, but the example I keep coming back to is that one of the engineers that I talked to had two favorite books, The Design of Everyday Things, which he recommends every engineer read, and the Snapfit Handbook. Are you familiar with Snapfits? No. Looking around here to see if there's like one, if I can just show it. But like, you know, like how remotes, they have that little clicky thing in the back that you use that hold the battery in?
SPEAKER_02Yeah.
SPEAKER_01That's a Snapfit. It is a physical device that basically clicks into another device to keep them fused. And this was a 500-page book all about Snapfits, their engineering, appropriate shapes, materials, etc. And that kind of compiling of information about the materials is something other fields do that we don't do. An analogy that I would think of in software would be something like a 500-page book on how to version an API.
SPEAKER_00We could all use that. Yes, we could. And we don't have it. We can learn it from engineering. We should have that. You started this project asking, are we really engineers? And your personal inclination, which you didn't say at the time, was that we're probably not. In the closing of this series, you said you're still a bit unsure of how to answer it. This was five years ago. This many years later, what is your inclination? Are we actually engineers?
SPEAKER_01I think so. I think this project and writing about it and thinking about it has firmly moved from the camp of we are definitely not to we probably are. I do want to caveat that I wrote this before LLMs were a thing, and this has probably changed our field as we know it, and it's probably also changed those other branches, and I don't know how. So that could have changed the calculus between two spaces. But as of now, I think excluding LLMs and how they're changing things, what we do now is very similar to what those people in those other fields did, according to my interviews.
SPEAKER_00It's such a cool project and it's still a very good read. I'll also link it in the show notes below. I do recommend going into it. So let's talk about formal methods. How did you get exposed to them? And for those of us who are not deep into it, What are they?
SPEAKER_01I'm going to give you a function in max, right? Which should, given a list, return the largest number. What would be a test you'd write for that?
SPEAKER_00I'd write a test that I do a list of like two items. It returns the largest one that I know. I give a very long list. I try to stress test it. I give a list where I give like similar numbers. I try to come up with some edge cases. I'll probably write like five tests. Try to think about integer overflows, potentially try some tricky one. Maybe I'll take it to maybe eight if I'm feeling super ambitious and then I'm done.
SPEAKER_01Okay. So we take one of those tests. How do you know what the right answer is supposed to be?
SPEAKER_00I just know because I have a, I learned math. So in school, I know which number is bigger. Honestly, I look at it. I have this, I guess, ingrained knowledge and it feels very basic knowledge that I don't even have to explain.
SPEAKER_01Right. You have some ingrained knowledge that you don't have to explain, such that you can look at, say, the max of two and three and know it's three, right? That's interesting. There's some sort of implicit mechanism in your brain that can see that and know what the function is supposed to do. Step one of what I do with formal methods is asking, can we take that implicit knowledge and make it explicit? Can we figure out what a function is supposed to actually be doing and write that down in a way that can be shown to anybody? So I would basically, in this process, say like the max of a list is an element that is in the list such
SPEAKER_01that every other element is smaller than that element. That is a way that we can formally say what the maximum of a list is. So that's part one, just learning how to look at functions and say, okay, I know what this is doing. How would I explain what this is doing in a way that is clear and unambiguous? Then step two is asking, every single test you've written is basically some Facet of it is an element the list and it is the number of that list such that every other number the list is smaller than it. Now that we have that, what's the best way to show that our function actually satisfies that specification?
SPEAKER_01Tests are one way. Those are basically taking individual values and showing how those comport in specification. Types are another way. We could basically say, OK, in every single case, we are putting in a list of elements and we're getting out a single element. So we have to make sure that every time we call it, that's what's true. So basically, coming up with the properties of the thing, like what it actually is, is the specification of it. And then showing the function matches that specification is the verification. And what phone methods ask is, can we use mathematics to show that it works not just for the cases that you asked for, but every single possible list you pass in?
SPEAKER_01And that is done through proof. Coming up with some sort of mathematical argument that this code matches this spec.
SPEAKER_00And then in proof... Again, from university, I still remember the maths proofs where we would proof an equation, you do rigid Transformations, you know what you're allowed to do. Sometimes you can bring in tricks, but those tricks are also inside of your rigid list. And every time, you know, you typically start from a complicated equation and you keep changing it. And in the end, you shape it in a way that it's now trivial or you transform. Those are one of the tools we do. Is this what formal methods also does to some extent?
SPEAKER_01Yes, but you know how to basically add two tangent numbers by hand, right? Do you do that by hand or do you just use a calculator?
SPEAKER_00I now use a calculator. If it's easy enough, I use my brain as a calculator. Otherwise, I just punch it into the calculator.
SPEAKER_01Yeah. So similarly, a lot of problem methods, that math of transformation, while you can do it by hand with like what's called a theorem prover, often in industry that is being done for the most part with tools that basically automate huge parts of this process. So you don't have to do every single transformation yourself. You can, for example, say, OK, we have these things are true at the beginning. I want this to be true at the end. And can you figure this out? And it'll be like, either yes, I can prove these things match, or no, I need a little bit more help. And then you say like, okay, at this point, I'm going to also let you know that this is true.
SPEAKER_00And it's like, okay, I can verify that's true.
SPEAKER_01And it helps me get to the end. And you just keep doing that until you actually have enough that the computer
SPEAKER_00can do the proof for you. Yeah. So with form and methods, this, I mean, this sounds all logical. I think it's easy to follow. In practice, what techniques, technologies, tools do What does the industry use, the tech industry use to actually prove that, you know, some stuff works?
SPEAKER_01To get to that, we need to ask another question. Why isn't this being done for everything?
SPEAKER_00Okay, let me ask that question. That's a good question. Yeah, this all sounds sensible. It will be nice to not have to write out those five or eight tests. And I know that those tests might not cover all edge cases. Been there, done that, where you miss. And I didn't think that I didn't do a formal proof. I thought like, well, I missed a test case. That's on me. Sorry. Let me put in that test case. I now have nine tests. And now I go and think I did a great job. Why are we not doing formal testing for everything?
SPEAKER_01Instead of finding the largest number in a list, why don't we try to find the file in a directory that has the most lines in it?
SPEAKER_00Well, now I'm thinking of writing a program that in kind of an imperative style, it goes to a four list each file. I list how long the lines are. I count the lines. I cannot tell it easily.
SPEAKER_01Okay, are we talking about ASCII lines or UTF at new lines? What happens when the files, you don't have the file permissions to read it. Should you basically ignore it or should you say, hey, my function might be wrong? What if one of the files is a shortcut to another file? What if it's actually a directory?
SPEAKER_00What if it's
SPEAKER_01a binary? You're now simulating real world. Yes, and that's the problem we have, is that when you start talking about most interesting domain problems, you have to pull in so much context that basically even writing what the function is supposed to do becomes a nightmare. The imperative program you write that will get it correct 99% of the time is probably good enough to use in almost all cases. And if you want something that works 100% of the cases, you've got to figure out, okay, which file system are we using? You have to figure out everything. Yeah. And that's why it's not done.
SPEAKER_00And it would just not be practical. It would be for 99% of people, why are you wasting your... It's like premature optimization, right? Yeah.
SPEAKER_01Especially when, as you say, writing 10 tests might get you most of what you need.
SPEAKER_00What are practical technologies that you have seen used in some part of the industry that even though they will, I'm assuming, will be somewhat heavyweight because it sounds like pretty heavyweight, It might be the return, the return of investment of using this heavyweight stuff is worth it that teams in industry are using it today.
SPEAKER_01Right. And here we can basically start to break this down into different parts of the landscape. So one part is to look at the stuff that actually does need to be verified to that degree. And the usual term here is nukes in NASA, like nuclear power plants and like NASA. But I can tell you for the first hand experience, nuclear power plants do not care about this stuff.
SPEAKER_00They're actually just fine with thorough testing. Okay.
SPEAKER_01Okay. So then category two is like really focused cores of programs where they need like one specific part of the program to be like really verified and the rest of it, they can use informal methods. And this is usually things that are like small parts of databases or like cryptographic primitives. I believe that the HTTPS stack in Firefox is verified as part of something called Project Everest, but I might be getting some details of those wrong.
SPEAKER_00Would an operating system kernel fall into this or maybe just a very key specific part of a kernel like memory allocation or something like that?
SPEAKER_01Yeah. Parts of an operating system kernel are good uses for this. A couple of examples I can think of is I believe Microsoft used some proliferation of parts of their Bista kernel for the driver loading. Famously, there is an operating system called SCL4 that has been end-to-end verified in a language called Isabel. It's a microkernel. It's very small. It's mostly used for automotive and military applications, but it is a fully verified operating system with a caveat meaning that it's matching the specification. So it might do the wrong thing, but of the things that you specify that it has to do right,
SPEAKER_01it will do those specific things right in the right circumstances. The last category is the kind I work in, which is asking, OK, what if instead of verifying the entire real world system, which is a nightmare, as we just discussed, we create a simplified version of the system and verify that? Then the actual system might still have bugs, but we can iron out the issues in the abstraction such that we don't actually build them in the real system.
SPEAKER_00And so that's a topic where you are planning a system and you want to stress test it to iron out.
SPEAKER_01Yeah, stress test the plan.
SPEAKER_00What kinds of plans would these be roughly? Is it planning like a database or some sort of distributed system?
SPEAKER_01In my work, it's mostly been databases and distributed systems for technology companies. But I've had some other interesting gigs. I've had one gig that was involving formally verifying firmware of a device kernel. And honestly, one of the coolest products I ever worked on was verifying the transponders of a train system. To make sure that they wouldn't cause problems to trains going over those transponders. That was a lot of fun. We found a really old bug in that one too. That was kind of exciting.
SPEAKER_00This whole episode is about a question that only gets more important as AI writes more of your code. How do you know if it's correct? And for some parts of a code base, you really don't want an AI model to be taking guesses at. Auth is on top of that list. And this is where I need to mention our season sponsor, WorkOS. If you're building any SaaS, especially an AI product, you'll need Auth for apps and agents. This is the layer where close enough is just not good enough. So don't let this layer get improvised by AI. WorkerWise gives you the proven implementation, SSO, skim,
SPEAKER_00and fine-grade authorization built for how agents operate and in a way that's easy for them to integrate with an implementation that you can trust. Check it out at WorkerWise.com. I also want to talk about our season sponsor, TurboPuffer. But this time, I don't want to talk about how they are fast, cheap, and extremely scalable search engine built on object storage. Instead, I'd like to talk about their team. I interviewed Simon, the co-founder and CEO on stage at AI Engineers World Fair, and also hung out with their team for a few days in person. Here's a few of the interesting things I learned about them. The company is full remote, yet feels pretty connected.
SPEAKER_00They have a Slack-first culture. For example, all of their customers have a dedicated Slack channel, and engineers are in these channels, seeing feedback from these customers, often fixing their bugs. The team gets together for annual summits at least twice a year and campfires form several times a month anytime several remote employees gather in the same city. Simon describes their engineering culture as hardcore and whimsical. They focus on solving difficult problems but also try to have fun. A good example is The Pragmatic Engineer landing page that they built. We agreed to have a custom landing page and then their team decided to build
SPEAKER_00a cool logo that animates on mouse movement. Another interesting thing is their team composition. Pretty much everyone currently working at the company has 10-15 years of experience. For a startup, they are an unusually seasoned team. Finally, I really appreciate how pragmatic their engineering philosophy is. Simon and the team strongly believe in how simplicity scales, and this is a reason that object storage is TurboPuffer's only dependency. The team do seemingly silly things like build their job queue in a single file on object storage because they understand the core primitives and they know how they scale.
SPEAKER_00To check out the whimsical animation, or if you're building AI products, head to turbopuffer.com slash pragmatic. And with this, let's get back to how TLA Plus works with a demo from Hillel.
SPEAKER_01Can we see a demo? Okay, sure. So I've got a couple languages with me, the kinds that I've worked in. So the most popular technology right now for that kind of planning is this language called TLA Plus. It was invented by Leslie Lamport, the same guy who made LaTeX, the typesetting language, actually. Oh, yeah.
SPEAKER_00All the PDFs behind the scenes are LaTeX.
SPEAKER_01Yeah, PDFs behind the scenes are LaTeX. He wanted a language that could be used to model distributed systems. So he basically created this thing called TLA Plus, Temporal Logic of Actions Plus. Everybody always asks about the name. You don't need to know the name. You just know it as TLA Plus. And what it does is it basically represents the state machine of a system. Every possible state it can be in and every possible state it can transition to. Then... We can use a brute force model checking where we basically find every initial state and every state that can evolve from those and check if they have properties.
SPEAKER_01TLA plus is unique in some ways because it has certain properties like checking liveness and refinement that we won't get into. But let's actually see a demo right now. So this is one of the demos I like to use to showcase this. And in this demo, we have a simple model of a trading platform. Each person on the platform has a set of items. And they want to trade these to other people. The way that we're going to show the simplified system is that each item is assigned to a person.
SPEAKER_01There's also a set of outstanding offers. We're only going to model sending items to people, not swapping items. If you propose an item, you have to own that item. And it's basically added to the set of offers. And then you can accept an offer. If that offer is available, you remove it from the set of offers. And the owner transfers. If you reject the offer, it's just removed from the set. Then we define what can happen next.
SPEAKER_01A next state, as in one of the ways this system can evolve, is we pick some two people that are different, that's what this from dash equals two means, and some random item, and either you propose that item, accept a proposal for that item, which must already exist, or reject an existing proposal. Below we have a property that a valid change is one where if the owner changes, it is because the new person accepted an offer from the old person.
SPEAKER_01So if the item goes from you to me, it's because you offered it to me and I accepted that offer. And then finally we have a change invariant, some property of the system saying every change is a valid change. Now what's the bug in this?
SPEAKER_00Well, first of all, this has a learning curve.
SPEAKER_01Yes, it has a learning curve. And that's why this is fairly niche. And I should probably point out right now that when Leslie Dunbar made this in 1990, like before he was thinking of it mostly, he was a mathematician, right? So he was using his mathematical like So you have things like quint and p.
SPEAKER_01Which are languages that look more like programming languages and are easier for people to grok. The reason a lot of us use TLA plus was because like the first really high profile demonstration of this kind of work in practice was an Amazon paper. The use of formal methods in Amazon Web Services in 2014. And they use TLA plus for this. So that's what a lot of us just have originally started on.
SPEAKER_00So going back to this, there is a bug in this one with all the associations. And how can we figure out what the bug is? Will the system help tell us or we now need to think through what case we missed?
SPEAKER_01Well, if we had to think through it ourselves, we wouldn't be using this nasty syntax, would we?
SPEAKER_00Nope.
SPEAKER_01So what I've done is I've also written a quick configuration file saying, take a specification, take these three people, Alice, Bob, Carl, and have them trade around a stick. And then I tell it, make sure this property that the change in variant always holds. Always holds, yep. Now I just have to run this. I'm also having it output the state space for you so you can see what that looks like. And it just puts out the error for us. It says the property has been violated. It took 53 states to find it.
SPEAKER_01And the way it works is it's on a small screen, so it's being word wrapped. But if I see it kind of looks like this. Essentially, the error is as follows. And let's actually see if the error, I can show it to you with the .file.
SPEAKER_02.viz, .viz, not .viz, what am I saying? So this is just a preview of the state space it's generating.
SPEAKER_01So you can see it's basically generating every possible state it can find. This isn't the whole state space. Usually because the state spaces end up being like 100 million states in the state space, usually these aren't that useful. It's mostly a thing that we sometimes use for demos. So the error is as follows. Alice, Bob, and Carol are on the system, and Alice owns the stick. Alice makes an offer to Bob. Bob is away. Alice gets tired of waiting for Bob to come back to make the offer because she wants to get rid of her stick. She makes the offer to Carol.
SPEAKER_01Carol immediately accepts. So the stick transfers from Alice to Carol. Now, Bob comes back, sees the offer from Alice to Bob, and goes, oh yeah, I want that stick, clicks the button, and now the stick becomes Bob's. But it did not transfer from Alice to Bob, it transferred from Carol to Bob. So the change in variant that if the stick went from Carol to Bob, it must be because Carol made an offer that Bob accepted was violated. And therefore, the system raises an error.
SPEAKER_00And then how did the system simulate this? It had to simulate a state where Bob was waiting or didn't respond for a while and responded later.
SPEAKER_01We basically, assuming we start a state of basically Alice owns the stick, there's two possible things that
SPEAKER_02can happen here, right? We have offer Bob. Yep. And we have offer Bob.
SPEAKER_01Carol, right? So those both happen, and those are both distinct states. So the model checker says, okay, I'm going to create two new states. Then from this top one of offer Bob, there's three things that can happen.
SPEAKER_02We can have Bob accept, Bob reject, or, and this is where the concurrency comes in, we can do offer
SPEAKER_01Carol, right? Yep.
SPEAKER_00I see. Yeah. I see where this is coming. And then when you continue, we will hit the bug.
SPEAKER_01Yeah.
SPEAKER_00The changing variant will be invalid at whatever step that is run at.
SPEAKER_01Right. And that's actually where a lot of this, like, Yeah, so this is what TLA plus is then.
SPEAKER_00Yeah, basically. And one story I've heard, and I think you might have been involved, is AWS using TLA+. Can you talk about how they onboard it, how they're using it, what they're using it for, as far as you're aware? Yeah.
SPEAKER_01So the seminal paper on this was in 2014. The Use of Problem Methods at Amazon Web Services. And they talked about how a couple of people in the company were interested in and learned TLA+, in another language called Pluscow, which is something that compiles TLA+. And applied it to aspects of the DynamoDB and S3 storage systems. In doing so, they're able to find fairly complicated bugs that could potentially lose data. And I think it was in the replication system.
SPEAKER_00In the paper, it said that the shortest error trace exhibiting the bug contained 35 high-level steps. Which, if I understand that correctly, it was at a depth that it would have been very hard for a human to persevere or you would have needed to be really determined and precise.
SPEAKER_01I did not work on that project, of course, so I don't know what the details are. I can speculate that the reason it found a 35-step bug was because the state space was probably 100 million states wide. So there were like plenty of, say, like 70 or 80 step chains that were totally safe. And just having this one 35-step chain was invalid.
SPEAKER_00Through working with a lot of customers and teams that have used formal verifications with distributed systems, what are some... Problems you've come across with distributed systems that might be a bit of a repeat pattern of, you know, how they break down or why they break down.
SPEAKER_01And I can think of, like, one thing that, like, besides, like, just general race conditions and locks, this is the one that, like, is always when you pull your hands off. It's like, yes, it's another time to allow, time to check the time to use bug. And time to check the time to abuse is a situation where... You are checking to see if something is like valid, can be done validly. And then you see that it's correct. And then a little bit later, you do it. Sometimes that little bit later is like a day later. Sometimes it's a microsecond later. But is any case where it is possible for something to go from being valid to being invalid in between the time you check and the time you use it?
SPEAKER_01A good example here is imagine you're withdrawing like money from a bank account and putting it to another bank account. And this is not how banks work. I know they use a different kind of ledger. But just as a demonstrative example, Yeah, and it's very interesting because when...
SPEAKER_00We were building Uber's payment system. I realized or I learned that the problem of having a message delivered in a distributed system exactly once is a very difficult one because typically that's what you need when you want to do one charge. You want to charge a customer's card exactly once because if you send multiple messages just in case one of them gets lost, you now have double charges. It turns out it's a complicated problem. It's a lot easier to do at least one's delivery than exactly one's delivery.
SPEAKER_00But of course, you need exactly at least one's delivery to build on to create exactly one's delivery.
SPEAKER_01Yeah. I wonder if this is like a lot of like businesses, they just charge you extra than refund you some amount. That seems like easier to do from an engineering perspective.
SPEAKER_00As well, it's also from a risk perspective, you eliminate a lot of edge cases by authorizing upfront on the credit card, you have a credit limit. And if you would authorize exactly how much you think you need right now, but you need a bit more, you might get into that edge case where later you have trouble authorizing it. This is why often hotels don't want to deal with this. So they just authorize a larger chunk. And they know because it's a larger amount for hotels. Otherwise, they might have run into the thing where you run out of your credit and now they have to do a separate flow. But you're right.
SPEAKER_00So some enduring decisions might happen because it's easier to do some stuff.
SPEAKER_01Yeah, it makes sense. I honestly thought hotels did that because they were trying to convince you not to break stuff. Because like, hey, if you know that you're definitely going to lose $800 if you break something, you're not going to break stuff.
SPEAKER_00Through working with engineering teams who are building distributed systems and you're coming in and helping them learn TLA plus learn how to survive things, what have you learned about how they usually think of verifying distributed systems before they learn about formal methods and what changes after?
SPEAKER_01So I think the most interesting thing about formal methods and how it affects how you build systems isn't the theory of the method or how it makes you think about systems. It's the practice. Why is concurrency hard? Why is it hard for us to reason about concurrent systems? Why do you think it's hard?
SPEAKER_00I think it's hard to keep several things in your mind of like where they could be. That's one. Or maybe we just don't really have a mental model of how to draw them out. I guess whiteboarding would be a way to do it, but I don't remember whiteboarding on concurrent system. I remember whiteboarding just boxes and imperative. This flowcharts are good for whiteboarding.
SPEAKER_01So this is something that I've wondered a lot, right? Like why it's hard for us to deal with these systems. And I'm not sure it's because it's hard for us to think about them. I mean, like when you cross the street, aren't you working with a concurrent system? You're just, there's cars everywhere. They're going to hit you. You're going to die if you don't model the concurrent system in your head. And there's actually this really cool paper I found called Common Sense Computing. Where some people were trying to figure out like how people thought about concurrent systems. When talking with like sort of like high school and college students, they changed the concurrency problem from like, hey,
SPEAKER_01we've got these threads doing some operation to like, hey, we've got these like Clerks at a ticket office, assigning seats at a concert, people saw the bug much faster. So I do think we can actually get quite good at seeing concurrency issues. I think a large part of the problem of why it's hard for us is because we don't get a lot of practice. Usually when you have a race condition in a system, you find out months later and then you try a fix and you find out weeks later after that if the fix actually worked. Whereas with the TLA+,
SPEAKER_01like I write my model of the system and then I click a button and it tells me, hey, race condition. And then you fix it and it says like, hey, timeout bug. And then you fix it again and it says, hey, TOCTOU bug. And that feedback loop ends up being so much faster than you get in practice. And I think that more than anything else helps people find race conditions more easily and think about problems in distributed systems more easily. I've found personally that when I work with new clients, I wonder if it's a little bit like...
SPEAKER_00Refactoring and also migrations. So refactoring a code base when you are starting out as a developer and you need to do a refactoring by hand, you know, let's say just changing a function name and then you need to go and change all the references of function. And the first time you do it, you change it at a few places and then you forget about the rest. And either it's a compilation issue or if it's a dynamic language, it's another problem. But then you get good at it once you practice. With migrations, most engineers that I've seen are terrible at migrations because you need to make a plan, you need to check, you keep in shadowing, reverse shadowing, all that funk.
SPEAKER_00And then there are a few engineers who have done three or four or five, and then they close their eyes and they can just do it. I'm just thinking that when it comes to race conditions, most of us, I was exposed to race conditions by, oh, we did a double charge. And then we found the race condition, but I never did a second one. So I will not be good at finding race conditions. I'm not even good at thinking about them.
SPEAKER_01I think that's right on the money.
SPEAKER_00It sounds like you coming into teams or to these clients, it You have to please give them some practice, the very least, of how to think about this category of errors, even assuming that taking out even the tooling itself.
SPEAKER_01I think there's also like more subtle things that you start to pick up from these tools. But I think that's like the most visceral one, the visceral like hatred of a race condition that gets a like physical presence in the algorithm.
SPEAKER_00You've been doing this for a very long year for you. Writing TLA plus is like for most of us writing TypeScript or the language that we're familiar with. How has your thinking changed? And is there any similarities between when you program an imperative language and then you learn a different one, like a declarative language, which requires a very different thinking?
SPEAKER_01And that also depends on the declarative language. Like I've, I've, I've done a lot of stuff in like logic programming languages and like I've done some stuff in like array languages, but like you show me CSS, I'm just like, what is this dark magic? Declarative? What are you talking about? I think so. It's going to be hard to sort of pin down exactly what though. Like my usual hacking language is Python these days, just because that's like one of the first things I use and I just know very well. And I think like at the very least, like the formal methods makes me much more willing to reach for mathematical solutions or like math heavy solutions than like simple,
SPEAKER_00reliable solutions. Math is also an interesting topic. You've recently had a bit of back and forth on whether... Developers, programmers, software engineers should learn math. There was a bit of a discussion back and forth. Can we talk about the core of the argument?
SPEAKER_01How math is useful in programming is a very interesting question, right? So first of all, there's math that we all find so useful we forget that it's actually math. Like counting. Counting is math. Knowing whether one thing is bigger than another number is math, right? It's just math that we have been taught from a very young age because it is so important that no matter what you're doing in life, you need that math. Then there's a lot of math that is useful for very specific specialist jobs. Like I've talked to some SREs who need calculus, but I think most programmers do not need calculus. There are some branches of math that are useful in a wide range of programming.
SPEAKER_01I think things like understanding graphs and directed graphs, knowing matrices, knowing formal logic can be very useful for a lot of different people. But I think it is more useful for most developers to have an exposure to like what math has in the various fields versus just going on every single field when they see them, right? You've got to know what's available to know what's most useful for you. And most math will not be useful for you.
SPEAKER_00It's also very interesting because for a long time, I thought at university, we have pretty heavy math education for computer science from algebra to computational theories, even formal methods. At university, I learned a bunch of advanced math. At first, when I came into the industry, it wasn't particularly useful or I didn't use it day to day. But then there are some tests. It's kind of useful. For example, matrix transformation. I learned 3D graphics and how you compute all the points based on 3D matrix transformations. And then it helped me understand when GPUs were becoming so powerful with AI,
SPEAKER_00why this is because they're also very good at And I think going back to our discussion with the crossover project, I wonder if it helps you connect closer with other engineering disciplines in terms of you can understand more things there. For example,
SPEAKER_00For electrical engineering, you do have math involved that is there to describe. And if you will want to have the vocabulary to understand that part.
SPEAKER_01One of the interesting things, at least about the mathematical differences, is that in almost every traditional engineering field, the math they need is continuous math analysis, things like differential equations and calculus. And that in the United States is what's taught like at an advanced level in high school, if you get that far, is this kind of continuous math. In software engineering and computer science, the math that we most often use is discrete math. Things like combinatorics, basically which is the math of counting things, graph theory, formal logic, set theory,
SPEAKER_01things that work with discrete entities, which isn't usually taught, at least in the American high school very much, or even early in university mathematics classes. And I wonder sometimes if that is the reason people don't recognize the use of math in software engineering is because the math they do need is not the math they've been exposed to.
SPEAKER_00Interesting. Yeah, because the math that I did use more was Common Networks. And of course, like maybe these days those injuries are going out of style, but there's the here's a problem, build an algorithm that solves it. And then you ask like, OK, how efficient is this algorithm? And then there's a big old notation. We have the language to describe how efficient in space and time is, and you can do trade-offs, and once two people know the same thing, you can have discussions about these things. And on one end, it's very abstract,
SPEAKER_00but on the other end, if you're close to the machine, it can be very useful.
SPEAKER_01I've also found that my understanding of big O notation got a lot better once I understood the mathematics behind it, because I think it's usually explained in terms of like, oh, This function scales at this certain rate, but like it is more formally a way of describing a set of functions. And then there's the math of like how we do asymptotics and stuff, but like, et cetera. I think even like the technical aspects of math does help a lot in understanding those.
SPEAKER_00Yeah. And with the TLA plus specifically, what cases have you seen in the industry TLA plus being a good fit for certain problems? And in what cases would you never consider it?
SPEAKER_01I think the case of TLA plus and... Most, not all, but most role methods, they shine the most in highly computational domains where most the problems are highly technical and not like business embedded. And what I mean by that is that like how do you replicate nodes between these two data sets is like very technical, right? Something like I'm trying to think about like a good example here, like how do we make sure our sprints don't go over time?
SPEAKER_01It's very business, right? It deals with like very human behaviors. I've had to help model client model that. And we got some use out of it, but it was very hard. So that's why a lot of my clients end up being things like database vendors or like cloud computing people who are or like hardware people who are working in a space that's like very important for business, but several steps removed from like the front lines of that business. The other thing I would say is that Different tools are good at different things. TLA Plus in particular tends to be good at discrete distributed systems where the main challenges are messing with concurrency and possibilities
SPEAKER_01of interleaving-like behaviors. It doesn't do floating point. It doesn't do decimals. It Doesn't do as well when you're trying to figure out probabilistic things. Oh, that's another thing I guess I should be saying is that like where the kinds of errors you care about are ones where like if it is possible to happen, that is a big deal. It's not good if like you're like, OK, this error is bad, but as long as it happens less than one out of 100 times, it's OK. It can't do that kind of probabilistic reasoning for you. There are tools that can, but they lack things like functions or arrays or variables.
SPEAKER_01Numbers also depends on how much time you need to spend planning. Like if you don't need to spend that much time planning, this is going to waste your time. I do want to add that, that this like, if you can iterate your way through a solution and the bugs aren't going to be that costly, then you might not need this tool. I think it's really important as like a person who talks about a really exotic tool to like constantly emphasize and like, no, I'm not trying to convince you to like use something that's not a good choice for you. I think a lot of the reason people are skeptical of these because they've been burned by things like Case and UML and all these other miracle solutions that were forced on them by people
SPEAKER_01who wanted them to use it no matter what. And I think it's really important to always say, like, if this is the right tool for you, I am not going to recommend it.
SPEAKER_00And then can we talk about other tools? Or can you show us a few other ones?
SPEAKER_01Yeah. So the other tool I have installed on this computer is called Alloy, and it was made by an MIT professor. Different from what is lineage. Just like there's many different kinds of programming languages, there's many lineages of formal specification verification tools. So this example is a simple access control system. So we have a set of resources and users who can read those resources. So each resource has some people who it's reasonable by. And resources may or may not have a parent resource.
SPEAKER_01L1 meaning less than or equal to one resource. There are no cycles. So no resource can have itself as a parent or its parent's parent as a parent. You can read, access a resource if the resource indicates you can read that resource or if its parent indicates you can read that resource. And we have a property that if you can read a resource, you can read its children. This system has a bug. What is it?
SPEAKER_00I mean, I'm glancing at this and this all made sense to me. I thought this is it because we're saying all of the parents can access it. I'm assuming the bug, if there is one, it might have to do with something that we talked earlier of like accessing in certain areas. No idea. Can we run it?
SPEAKER_01Yes, we can. So this was actually made in an earlier version of Alloy just for context. Alloy did not have any sort of temporal reasoning over state up until about Now, if I execute this,
SPEAKER_01Here's the counter example. And this is one of the things about Ally specifically is that it can generate visualizations. So basically, here's the problem. We have a user who can read a parent resource. The parent has a child. Because of how we defined can access, we can read his parent so we can read the child. The child has a grandchild. We cannot read the grandchild.
SPEAKER_01So, because we are not in, we are not assigned to the readable by for the child, only the parent. In other words, readable by is not transitive. So we can read the child, but not the child's children. And that is the bug.
SPEAKER_00And to visualize this for us.
SPEAKER_01Yes, which is quite nice. And one of the reasons why people really like Alloy.
SPEAKER_00Nice.
SPEAKER_01It's a bit worse for modeling, like, distributed systems, though, which is why most of my work is in TLA+.
SPEAKER_00And then to do the fix, what would it involve? We would need to give access to the children's children?
SPEAKER_01Yeah, there's a few different ways that we could fix it. And often, like, problem methods, they don't really tell you, here's how you fix it. It lets you choose how you want to fix it. Like, one thing I could do is I could say, okay, I'm going to say that this is a transitive lookup too, that we transitively close over all parents. And if I execute that, no more counterexample. That said, that might not be something physically implementable. I might try to tell like, hey, people like, hey, in our SQL database, you have to have a transitive query and our database administrator is like, no, that's going to crash the database. You can't do that.
SPEAKER_01Then we have to find a different fix.
SPEAKER_00So this is the beauty of formal methods. Yes, it gives you opportunities of how you will implement fixes, changes, and then you can rerun it again and see what difference it made.
SPEAKER_01Exactly. Now, one quick fun fact. I love just fun facts about stuff. You see how this says solver sat4j? So have you heard of sat, S-A-T problems?
SPEAKER_00No.
SPEAKER_01Okay. Is there some variable that makes the statement P true? If I can make P true or false, is there a way I can make that true? Let's say P is a Boolean and I have a statement P. Can you assign some value of true or false to P to make that true?
SPEAKER_00Typically, you can assign true and it will be correct. Well, true.
SPEAKER_01That's even unsatisfiable by setting P to true. What about P and not Q?
SPEAKER_00Also satisfiable by giving true to P and false to Q.
SPEAKER_01Right. Now what about P and Q and not P?
SPEAKER_00That's unsatisfiable because no matter what ruling you do, true and false will always be true.
SPEAKER_01Lovely. What you've just done is a Boolean satisfiability problem. Taken some sort of statement of a ton of Boolean variables, in this case too, and either found some assignment that makes it true or said that it cannot be made true. Now, Boolean satisfiability is what we call NP-complete. And what that means in theory is that there's no such thing as a perfectly efficient algorithm that solves all problems. In practice, that means that we can solve them really fast. So often what makes Alloy interesting is that unlike TLA+, which must be brute-forced, Alloy can be converted into a satisfiability problem.
SPEAKER_01I'll open this up. And it is able to turn that model into a Boolean probability saying not x21 and x96 and 0. So X15 or not X72, etc. And because of that, most alloy models can be checked in like a few milliseconds or a second at most. Whereas often for like a large TLA plus model, you have to basically churn it overnight to go through all 100 million states.
SPEAKER_00Can we talk about some other tools on the table of someone looking into formal verification?
SPEAKER_01Happily. So I don't have any more demos on my PC right now, but I can talk about a few of them. So a couple of the ones that have been successful to TLA Plus is the P language, which was invented by, I think, a person at Microsoft Research who was then poached by Amazon as a way of making a language that was more accessible than TLA Plus, among other things. So it basically looks like a set of state machines, interacting state machines that send messages to each other, almost like the actor model in like Erlang or something like that. Yep. So there's that.
SPEAKER_01There's also another one in the same space as Quint, which was basically people who were making a different kind of model check for TLA Plus and then
SPEAKER_00realized they can make an
SPEAKER_01entire language that was easier for people to pick up. They've gotten a lot of interest in the banking and I believe cryptocurrency space, smart contracts. So another one that I've used, which is a lot more niche, but quite interesting, is called Prism. And Prism is a probabilistic mile checker. So like KLA Plus can tell you like this bug will never happen or it could happen. Prism can tell you this bug can happen 10% of the time or it is a 25% chance of happening if you shut down. It's really cool, but it's also much more like academic in that there's a lot more work required
SPEAKER_01to actually translate languages into Prism. If you're interested in it, I've basically been doing this like, have you heard of the Jewish game Dreidel?
SPEAKER_00No.
SPEAKER_01Okay, it's a game that you play on Klanica where you spin a little top and you get money. And I do not like the game. And I have written a two-part series using Prism to show how this game is not fun by analyzing it as a mathematical thing. Love it.
SPEAKER_00Those are, I think, some of the ones that are, like, really popular.
SPEAKER_01But there's also, I mean, I could just keep listening. There's, like, Event B, which has, like, been used, I believe, famously in part of the Paris metro system. There's like MCRL-2, which I think comes from a Dutch university. Himera-X, which is mostly used for like robotic control systems, but I think that's mostly academic. There's like NewSMV, which I think NASA is used for a bunch of stuff. I can keep going. Then, of course, there's all the, of course, this is only for specifying like abstract models of systems.
SPEAKER_01If you want to talk about verifying code, then you've got things like Daphne, which is basically something that compiles to like .NET and lets you basically write provable code. You've got JML for like model checking Java code. You've got like PrimaC for like checking C. You've got Adaspark. You've got like, and you've got Ethereum Provers like Rock and Lean and Isabel, and I can keep going.
SPEAKER_00I wanted to ask how this property-based testing works. Relate to formal verification. And before, let's just like lay out what property-based testing is.
SPEAKER_01So let's go back to the entire thing with max, right? Maximum list. We can define like the specification of max as it is in the list and for all elements of the list, it is the largest element of that list, right? I actually have a demo on my computer of doing that. So let's actually go into this. So over here in this file that I wrote for my book, plug,
SPEAKER_02I have
SPEAKER_01I have basically three variants of max, a good version which just returns the max of the list, one that returns the max of the first three, and the one that returns the max of the absolute value. This below here is a property test. What it does is it says, given a list of integers where each list has at least one integer in it, the maximum value of that function should be in the list and all other values should be less than or equal to it. Yep, clear. So this basically looks a lot like our formal verification spec, our formal specification spec.
SPEAKER_01The difference between the formal methods that we do and property testing is that the formal methods are saying like, okay, can we prove this for every possible list? And property testing is, well, that's very, very hard. And as we talked about, very difficult to do in practice. Can we instead generate a thousand random lists and try all those? I have it set that way. It basically has the invalid max, max of first three.
SPEAKER_00We should be getting errors or it should cast
SPEAKER_02some errors.
SPEAKER_01Let's run it. Let me just run it from the command line. That's faster.
SPEAKER_02PyTest, test, max.py. This is an old machine I mostly bring around for conferences because it's like easy to just throw on something on here.
SPEAKER_01So we see over here that it says that this test failed on this line, that for the list 0001, it is not true that all the values are greater than zero. This is because, as I said, our bad max only looks at the first three values. So it found the max was zero, but here the actual max of the list was one. I broke this down to two subspecs for part of the book where we have testing that max is the largest element and also that it's in the list.
SPEAKER_00So that's why one of the tests passes. I should note, though, that if I believe I run this with a verbose,
SPEAKER_01what I'm trying to do for this demo is show that it actually does not start with the... Largest list, it actually starts with a much smaller,
SPEAKER_02with, here we go, if I print max, if I print, then I do it like this, I think. It tries a lot of edge cases first.
SPEAKER_01So it's basically trying huge lists, it's trying tiny lists, it's trying empty lists, etc. And once it has one that fails, for example, this value, it starts to shrink it, finding the minimally interesting example. And that's why this lets us find a bug. Not just find a bug, but also find a bug presented in a way that is comprehensive for the average human. Because I think that it found the original bug with this list, and I do not think that looking at this, I'm going to know what the problem is. That's basically property-based testing in a nutshell. And as you can see,
SPEAKER_01it is less thorough than formal verification, but it's a lot easier to apply.
SPEAKER_00So it sounds like it can be a nice middle ground in terms of getting started with it.
SPEAKER_01And probably just stopping with it, because I think that I love formal methods, but I think it's a fairly niche tool for most people. And I think like property based testing is in general going to be useful for more people.
SPEAKER_00So speaking of verification in general, today we have AI generating way more code. We have data to prove this as well, but also day to day. I see it on myself. I have AI generate a lot more of my code. We're getting more code. Code reviews are, people are, it's hard to pay more attention to this. So there's a growing number of people saying, well, maybe we should somehow validate things more. And there's an idea that keeps coming up on maybe formal verification or Operator-based testing or some of these things could be more useful.
SPEAKER_00Do you think this will happen? Because I see a lot of people talking about this. I don't really see anyone doing much about it.
SPEAKER_01I'm definitely seeing more business from people. My client is people trying to generate specs with AI and then getting to help work with the spec or find issues with that. And I'm definitely seeing more people like using property based testing. I know, for example, I think Kiro, like the Amazon spectrum development platform specifically advertises generating property tests as like one of the key values of it. And I've been seeing a lot of like papers about generating specs using AI.
SPEAKER_01I will say this is kind of really exciting because as you saw, like a lot of the challenge of writing a spec, not all of it, but like a lot of it is like rocking your head around like very, very technical syntax and like semantics. That said, I've been doing a lot of experience with this myself, and I think the one thing AI is extremely bad at, as of March, I know that Claw just released a new Claw 4.8, so maybe this is all out the window. It changes every month. It is very bad at coming up with properties.
SPEAKER_00It is very bad at that. What does coming up with properties mean? Is it writing the actual form of verification part?
SPEAKER_01Yeah, so like if you give it properties and like a spec, it can tell you like, hey, we're going to fix the spec, make these properties pass. That's fine. But if you basically tell it, here's the spec, also come up with the properties of the spec, it'll be like, okay, so one of the properties I'm going to specify is that either P is true or not P is true. And then you're like, that's just always true. And it's like, wow, I verified it. Amazing. I'm so good at this. Especially when you deal with what's called liveness properties, properties about how like a system can evolve over a long period of time. It just... It's hard to put down. It's just not good at that yet.
SPEAKER_01And often I find my clients, I have to tell them like, it's doing a good job at generating the actual design, but actually expressing what the design is supposed to do. It cannot do that yet. You have to do that part yourself.
SPEAKER_00It's interesting because there's a blog post that I'll also link in the show notes from a year ago in March, 2025, titled The Coming Revolution in Distributed Systems. And this was an engineer working on GitHub's co-pilot team. And this person wrote how AI autonomously produced precise TLA plus specifications from Azure Storage's production source code and it uncovered a subtle race condition that had evaded traditional code reviews. And then this person was very enthusiastic and saying, well, this could be a revolution. AI could just generate TLA plus from specification like it did with Azure.
SPEAKER_00This was a year ago and I haven't heard much on any of this, even though the models were not as great. What have you seen in this area?
SPEAKER_01So actually the same person, Chang Huang, did come up with a tool called Lamport Agent where they demonstrated using this to specify parts of crack, I think it's called, part of DC's crack. I'm going to link both those in the thing. Here's my response. I was writing about this and then the thing that they did. He seemed to be a lot more successful than I was generating properties. But one, at least the example that he showcased in his later piece, one, he's an expert specifier who already knows how to do this stuff on his own without
SPEAKER_01the LLM. He's the main expert. Yeah, he knows how to get the results out of it. As a general thing we've seen, like, To get good results, you have to already know how to get good results without it. It just helps you get good results faster. And also, one of the systems that he was able to create the complicated properties for in TLA Plus already had a sophisticated spec written in P. So I don't know how much that's relevant here. Maybe it read that and it cheated. Maybe that was like fine. I don't know.
SPEAKER_00But we do see this a lot where when you're an expert in a domain, it may that be software engineering or like backend or mobile, AI works better for you.
SPEAKER_01Then there's also this one interesting person, Claudia Colley did write a write-up because she just did about a multi-year project and using formal methamphetamine, the big Chinese cloud provider, where she talks about how in between her working on this paper and the time she got published, She got really sophisticated data on how long it took people to write formal methods at this one company. And then LLMs basically just compressed the scale by the time she actually had the paper out. So I think people are seeing like more use from like formal methods, but it seems people with the most success right now are specifiers who are using it
SPEAKER_01to amplify their ability to specify. And we haven't yet really seen, I mean, people post acronyms all the time, like people who they had a AI write the whole spec for them, but those tend to not be very good specs.
SPEAKER_00And what's your take on, again, I've heard some voices say that AI might make formal verification go mainstream based on this. But outside of the, do you see any movement outside of this niche of people who already know how to do formal verification?
SPEAKER_01I think it is making it more popular. I don't know if it'll make it go mainstream, but it's definitely making it a lot more popular. It's bringing it from maybe like 0.1% to 0.3%.
SPEAKER_00Which is huge. There's also this thinking that I've read. Actually, in June 2025, in your newsletter, you said that AI is a specification force multiplier. And now, of course, we see that LMS are bad at vibing specifications. What changed between that time where you saw that they were like a year ago, they were pretty decent at doing it or they had science and now we have So what I wrote
SPEAKER_01that it was really good at was fixing syntax errors, which is really big because that's often trips people up. It's good at understanding error traces, which is huge because being able to take like a 35 step error trace and turn that into like two paragraphs of English text, major improvement. Good at boilerplate, like mass changes to like a bunch of small things like updating like boilerplate and It's okay at writing properties from a very precise description. It's bad at fixing specs and it's real bad at providing properties for specs. Ha, I'm still consistent.
SPEAKER_01So I think I called it early back then that it like is really bad. It's good at translating properties from like English, precise English into a spec, but it's bad at coming up with properties on its own. Everything I got back was trivial, uninteresting or too coupled with the implementation details. So I think ultimately what I'm going to say is that like, I think it has a lot of potential to improve things. But even back then in 2025, I was noticing that I was really bad at this one thing, that it continues to be bad as of March of this year.
SPEAKER_00So then how much do you think you really need to know formal methods to be able to use LLMs to help you at all? You need to get the basics in place, likely.
SPEAKER_01I think getting the basics in place is really valuable here, right? Because for one, I mean, even discounting, like being able to write the properties and all that, you need to be able to tell when the AI is doing something wrong, right? And if you don't know the basics, you can't really do that very well.
SPEAKER_00In your book, Logic for Programmers, you argue that formal logic is probably one of the most useful parts for day-to-day engineering. Why is this?
SPEAKER_01First of all, I'm honored that you've read my book, or at least the early drafts. I mean, the official answer is because logic teaches us to work with like booleans and statements. What we learn in elementary school, how to work with numbers, right? Essentially, there's not a whole lot of difference between knowing that One plus one is two, and true and true is true. It's still the manipulation of values. And it happens that Booleans are so important to software engineering that having some formal grounding in that is very handy, especially when we are not taught that in school for the most part.
SPEAKER_01The other answer is that I've just... I'm learning logic and getting better logic and teaching logic a lot as part of teaching TLA+. I'm just finding more and more applications where I'm like, oh, because of logic, I can do this one thing. And I find that people who don't have that background struggle through that one thing. I guess I'm saying that empirically, logic keeps coming up as a useful form of math.
SPEAKER_00And if I'm a software engineer and I work on complicated systems, distributed systems, what techniques would you recommend that I look into to harden these systems? We can assume that I'm already doing... I'm going to just completely go 90 degrees here and recommend this book by Nancy Levison called Engineering a Safer World.
SPEAKER_01She was an aeronautics engineer who investigated things like Etheric-25 radiation case and like the Columbia disaster. And she was really fascinated in how like systems have been accidents and systems happen, like why accidents could happen in complicated systems. And I found her writing on this to be incredibly insightful and incredibly valuable in understanding how these systems can break. So that's the thing at first I'd recommend is checking out that book.
SPEAKER_00Looking ahead for the industry a year ago, you wrote a post where you shared some of the uncertainties and anxieties. It was a longer post. It started with how Vitecoding will be never good as software engineering, experienced software engineers, and you wrote six different things. Can we read through them and just reflect on how you feel about them, what you think might have changed, and maybe talk about what potential new anxieties we have because there's so much change going on, that's for sure.
SPEAKER_01The way I sort of think about it is that the next five years keep being rewritten every few months.
SPEAKER_00Right?
SPEAKER_01Yeah. So I wrote, the following can all be true. One, vibe coders will never be good at software engineering as an experienced software engineer. Probably true. I mean, if you don't have the basics, you can't really.
SPEAKER_00It feels true. I even see it on myself when I try to build a software in a domain I'm not an expert in, like a game, and it's an absolute just vibe coded mess.
SPEAKER_01Yeah. Elements can significantly augment a professional software engineer's ability to quickly
SPEAKER_00write high quality software. I think also true.
SPEAKER_01I mean, even if you don't have it writing a single line of code, just being able to be like, okay, what's this bug? Where's the bug? Or like, hey, what library should I look into to solve this problem?
SPEAKER_00And I think we're starting to see or starting to recognize that engineers who have really deep knowledge are so much more efficient. And the ones who embrace these tools and figure out how to control them and not them to control, you know, like their anxiety or whatnot, they get a lot done. Absolutely.
SPEAKER_01Elements will cause many software developers to lose their jobs. I don't know. That's a hard one to pin down because like, I mean, one, the software engineering, at least in the US, is starting to recover. Like we're starting to see more jobs open up for software development. So it's hard to tell how much of like the loss of the past few years was AI versus
SPEAKER_00the end of like zero interest rate policy and like the post-COVID crash.
SPEAKER_01And I think it's more the latter. But like, again, LMs are still getting better. Maybe they're going to cause job losses in the future.
SPEAKER_00Yeah, this is a notable question. The data that we had in The Pragmatic Engineer, it did show that We are seeing overall more software engineering openings in the US, in Germany and France. They're declining a little bit at the same time. And there seems to be a big shift on who is being hired and the skill set. So now AI engineering is increasingly spreading to more software engineering fields, not all of them. And we're seeing a decrease in, for example, front-end engineering hiring, mobile engineering hiring. So I think the shape is changing, but it's always changed in the past. If you think about 20 years ago, The most in-demand engineer was a Java engineer,
SPEAKER_00like Java specifically, like don't care. 10 years of Java experience required and that's changed. Okay, then we'll put up new jobs for many possibly far more money software developers.
SPEAKER_01I think that's also true. I think when you basically need one developer to make your product as opposed to five, you're more likely to hire one developer, right?
SPEAKER_00That's been true, yeah.
SPEAKER_01The software jobs that LLMs open up will be lower paid and lower procedures in the heights of the 2008 to 22 tech era. And that's the thing that scares me the most is that As mentioned, I decided to leave a field and just become a techie. And I was able to do that. And I was able to get a well-paying job that led to me to now full-time mathematically prove systems correct. That's crazy. What other field can somebody just go like, what other engineering field can somebody go like, I want to be an engineer and just walk straight into it? What other field is going to send people to Budapest from the US to give a talk for 45 minutes?
SPEAKER_01Like, it is really precious and magical what we have here. And I'm afraid of losing that. I'm afraid of a place where it just becomes like any other white-collar job where you get two weeks paid vacation every year and two days off sick. And I don't want to lose that.
SPEAKER_00Are we saying we're afraid that software engineering might become just like every other engineering job? Yeah. Because that is the reality of a lot of engineering jobs. We do have a privilege. I don't think we talked about it when we compared the rest of engineering. We have massive privilege.
SPEAKER_01Yes, we have a huge privilege and I don't want to lose that. And I mean, it would be nice if everybody else got the same things we are, but I don't want to like equalize us by losing what makes software engineering so magical and precious.
SPEAKER_00Yeah. So this is a worry.
SPEAKER_01Yeah, that's my that's my fear.
SPEAKER_00And then number six.
SPEAKER_01There will still be high-paid professional software engineering jobs, but they will be rare, more competitive, and less developer-friendly.
SPEAKER_00I'm afraid we're seeing some of this already. I wonder if this is inevitable. I also see it in some other industries, for example, with investment banking. The traders used to be, many of them, very highly paid, highly respected. There are now fewer of them, still highly paid, highly respected. It's hard to get into them.
SPEAKER_01Yeah. I mean, I think most jobs do ossify over time. As like the centers are set and more people enter them, software engineer, I think for a longer period of time was able to like get away from that.
SPEAKER_00And then you close your prediction with these lines a year ago.
SPEAKER_01I predict that in the next 10 years, software development will survive, but it will become like any other white collar professional work. No more $200,000 salaries, a little vacation or incredible employee bargaining power. I feel sad that we'll lose something so magical, but I guess it couldn't have lasted forever. Automation comes for all of us, even us automators. Here's a good way of ending this. If we start with automation comes for all of us, even us automators. On one hand, I feel like I'm losing something really special.
SPEAKER_00On the other hand, a doctor friend of
SPEAKER_01mine came to me a few months back and was like, hey, we managed to Create a new shift scheduling platform for our hospital to trade shifts that really saved us a lot of time and made all of us nurses and doctors so much happier. And I was able to just vibe it out. I don't know any kind of code, but AI let me do this. And I'm like, wow, it really is helping you and your hospital make your life better. And it feels so weird to balance my needs as a professional software developer with his needs as a doctor. Who matters more, my cushy job or his job?
SPEAKER_01I don't know. And we're going to all find this out in the next 10 years, I guess.
SPEAKER_00Grady Bush told me that this time reminds him of the time in the late 1960s and early 1970s where people could purchase computers and start to hack with them. And he said it was a magical time because teachers and people who had nothing to do with software... Saved up and started to just hack around and it democratized it. And I feel this is the first time I'm also feeling like this other person the gym told me that they're vibing something together. It feels it's opening up the field. And if anything, a lot more people are realizing, oh, software is cool.
SPEAKER_00I can do it. And now they're trying to learn the hard parts of software engineering eventually.
SPEAKER_01Did you ever read up Clay Shirky's essay, Situated Software? No. Basically what it is, is that this person was talking about how they think like The most important, the vast majority of software should be made for like three people or like a family or community or like one school. And up until now, that like could only really happen if one of those people in that family, that community or that school was like really, really into computers. But now it's possible for everybody to have situated software and computers.
SPEAKER_01That, again, is going to change the world in some strange and some terrifying and some exciting ways.
SPEAKER_00It's exciting. As closing, what are books, a few books that you could recommend that you have enjoyed or made an impact on you?
SPEAKER_01Oh boy, let's just leave this just for this into just software books, okay? Because otherwise we're going to be here for like a month. So there's three books that I really love in software that I think of as like the books that have influenced me so much. The first one I think I mentioned in the interview was Nancy Levison's Engineering a Safer World. I believe that's actually free online. The second book is called Data and Reality by Bill Kent. And this one is actually hard to find because it was republished in 2000, I think, 11. But the republisher changed the book. So the last good edition is the second edition,
SPEAKER_01which can be found like in dark corners of the internet online is actually kind of hard. But like it is basically by this like famous database designer who like worked on like IBM databases who was just asking like, What is data? What does it mean for something to have an identity? What does it mean for something to have oneness? If we talk about a book, is that the book, the physical copy? Is that the series? Is that an edition? And it's just an entire book about these questions about what data is and how we need to represent it. He ends it by saying that data isn't reality. It is our view of reality for our useful purpose.
SPEAKER_01Incredible book. It totally changed how I think about things. The last book is called Debugging, The Nine Simple Rules by David Agans. And it's literally just like a book of war stories about debugging and like basic principles. But this is the book I give to every junior engineer because I think like nobody ever really talks about debugging as like a discipline outside of like basic heuristics. And this is like just at least something that's trying to do that. And having something is better than nothing in this category. So really good book.
SPEAKER_01And I think it's like $10 for a used copy. So like anybody can just get one. It's great. Those, I think, are the three most useful books for software engineers. If you want to talk about other books, I can keep going.
SPEAKER_00This is great. Well, hello. This was very educational, and I found it fascinating. Thank you.
SPEAKER_01Thank you.
SPEAKER_00I really enjoyed this conversation, especially the demos where Hillel showed tools like TLA+, Alloy, or Hypothesis, and how they can catch bugs. By the end of the conversation, I'm starting to understand more why it's not likely that formal verification will go mainstream, even with AI. I mean, these tools feel very rigid for the real world. For specific parts of a system that you can model mathematically, like state spaces, sure, they can work, but for everyday programs, it just feels like it will be a bit pointless to create TLA-plus specifications.
SPEAKER_00One thing that I was also thinking about is how Hill talked about why he thinks we're not good at catching concurrency bugs. And it's because we don't have much practice with them. As a developer, you're lucky to debug a concurrency bug once every few years. So of course, you won't be able to build expertise this way. This is also similar to how most engineers are bad at migrations because most devs only ever do one or two migrations over several years. But if you're an engineer who does a bunch of migrations, you're going to be really good at them. Same thing if you're working on systems with concurrency issues and you become
SPEAKER_00an expert in this. I also found it fascinating how other engineering fields have similarities with software engineering, like how mining engineers had their own agile revolution in the 1960s, and how all engineers hate the concept of waterfall. Plus, it was amusing to hear how source control is kind of an envy from other engineering fields that we, software engineers have, but not many others do. Check out the show notes for our related deep dives on distributed systems and tech depth that go into more detail into the topics that we talked about today. And if you've enjoyed this podcast, please do subscribe on your favorite podcast platform and on YouTube.
SPEAKER_00A special thank you if you also leave a rating on the show. Thanks, and see you in the next one.
Brought to You By: • turbopuffer - a vector and full-text search engine built on object storage. It’s fast, cheap, and extremely scalable. • Entire - The Git forge for agent-human collaboration. Built for the scale and...
Brought to You By: • turbopuffer - a vector and full-text search engine built on object storage. It’s fast, cheap, and extremely scalable. • Linear - the product development system for teams and agents. • WorkOS -...
Brought to You By: • Antithesis - verify your system’s correctness without human review or traditional integration tests - and avoid bugs or outages. • turbopuffer - a vector and full-text search engine built on object...
Brought to You By: • turbopuffer - a vector and full-text search engine built on object storage. It’s fast, cheap, and extremely scalable • Linear - the product development system for teams and agents • WorkOS -...
Brought to You By: • turbopuffer - a vector and full-text search engine built on object storage. It’s fast, cheap, and extremely scalable. • Entire - Git hosting, rebuilt for the agentic era. Every agent session, prompt...