Solving Regex Crosswords with Z3 - Made of Bugs
For a while now, I’ve been fascinated by Z3 and by SMT solving more broadly. While on pat leave recently, I was reminded of the existence of regular-expression crossword puzzles, and allowed myself to get nerdsniped by writing a Z3-backed solver. I expected to spend perhaps an afternoon cranking out a quick solver; I ended up getting sucked into understanding and debugging Z3 performance, and learning far more about Z3 and about SMT than I expected. In this post, I’ll describe my approach and my initial solver, and then dive into some of the improvements and variations I explored. All of my code is available on github, if you want to follow along or check out my final results. To briefly recap: A regular-expression crossword consists of a grid of (unknown) characters, which are to-be-determined. These characters are constrained by a set of given regular expressions, which must match a given row or column, once filled in. I chose to solve the regexle variant, specifically, which uses a
For a while now, I've been fascinated by Z3 and by SMT solving more broadly. While on pat leave recently, I was reminded of the existence of regular-expression crossword puzzles , and allowed myself to get nerdsniped by writing a Z3-backed solver. I expected to spend perhaps an afternoon cranking out a quick solver; I ended up getting sucked into understanding and debugging Z3 performance, and learning far more about Z3 and about SMT than I expected. In this post, I'll describe my approach and my initial solver, and then dive into some of the improvements and variations I explored. All of my c
saved by
related reading
- A Dumb Introduction to z3ar-ms.me
- Z3 Internals (Draft)z3prover.github.io
- Computers can be understood - Made of Bugsblog.nelhage.com
- Fast regex search: indexing text for agent tools · Cursorcursor.com
- mildbyte.xyz • Solving Wordle with uv's dependency resolvermildbyte.xyz
- Jane Street Blog - Can you reverse engineer our neural network?blog.janestreet.com
- The Regular Expression Denial of Service (ReDoS) cheat-sheet | by James Davis | Level Up Codinglevelup.gitconnected.com
- Regular Expression Matching with a Trigram Indexswtch.com
- Beating the fastest lexer generator in Rustalic.dev
- Astra for Coding: Why Are We Doing This Again?lucumr.pocoo.org
- Zenbleedlock.cmpxchg8b.com
- Squeezing a sokoban game into 10 lines of codecole-k.com