Skip to content
View original post on X: Boris Cherny
Published

Claude models tricky code states to find and fix bugs

AIClaude builds a model of a program's most complex parts, such as state machines or race-prone code, and searches that model for counterexamples that signal suspected bugs. It then reproduces those bugs and fixes them in the code.
@bcherny
View on X

A reply · the post it answers

More details for the formal methods people -- what's happening is Claude is doing something like:

  1. Building a model of the program, targeting a tricky state machine or race-prone part of the code
  2. Finding counter-examples in the model. These are suspected bugs
  3. Reproducing the bugs
  4. Fixing the bugs in the code

It's not that the whole codebase is formally verified (yet!..), more that the hairiest parts of the code are modeled, checked for counter-examples, and fixed.

Source details

Boris Cherny · x.comPublished · added here

Original title: More details for the formal methods people -- what's happening is Claude is doing something like: