Tracking Borrows with Regular Expressions
Todd Nowacki, Sam Blackshear, John Mitchell, Shaz Qadeer, Ilya Sergey
Key points
From the paper's conclusion- We present a novel type system for Move's borrow checker in which access paths are tracked by regular expressions.
Abstract
Safe systems languages such as Rust enforce an ownership discipline through types: every value has a unique owner, and the type system tracks borrows—references that provide temporary access to values without transferring their ownership. Borrow checking is a static analysis ensuring that no borrow outlives its owner and that no two mutable borrows are aliases, preventing dangling references and data races at compile time. Move, a smart contract language deployed on Sui and Aptos blockchains, adopts this model but restricts references to structured access paths rooted in local variables, eliminating the need for complex lifetime tracking mechanisms such as lifetime annotations. We present a novel type system for Move's borrow checker in which access paths are tracked by regular expressions. In this model, Brzozowski derivatives make it possible to express the reachability consequences of borrowing operations, Kleene star summarises borrow chains from function calls and loops, and the aliasing check reduces to the decidable regex emptiness. The design of the type system with regular expression-based borrow tracking extends naturally to vectors and enumeration types. The proposed design of a borrow checker has been implemented in the Move bytecode verifier for Sui blockchain, where it superseded the original borrow analyser while maintaining full backwards compatibility. We mechanised the type system in Lean with a machine-checked soundness proof and an executable algorithmic type checker tested against the production Move compiler. Notably, this 39,000-line metatheory was developed with an AI proof assistant in roughly one month, and we report on our experience of conducting this proof effort, which is among the largest AI-assisted PL metatheory mechanisations to date.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Verified Implementation of the Next-gen Borrow Checking Algorithm for Rust via Abstract InterpretationarXiv · 2026
- Belobog: Move Language Fuzzing Framework for Real-World Smart ContractsProceedings of the ACM on Software Engineering · 2026
- A Calculus for BorrowabilityarXiv · 2026
- Partial Borrows in RustarXiv · 2026
- Escape with Your Self: Sound and Expressive Bidirectional Typing with Avoidance for Reachability TypesProceedings of the ACM on Programming Languages · 2026
- Petri Nets-based Methods on Automatically Detecting for Concurrency Bugs in Rust ProgramsACM Transactions on Autonomous and Adaptive Systems · 2026