Exploring techniques for code refactoring with formal verification.
Refactoring is changing the structure of a program without changing the behavior. Traditional refactoring tools help us achieve this using syntax transformations. By using Formal Methods to reason about the semantics of the code, we can open up more posibilities!
This collection is inspired by Provable Refactorings by Arlo Belshee, with the addition of mechanically verified proof rather than informal arguments to ensure behavior is unchanged.
- Formal Specification driven
- Dafny - Gilded Rose, Video
- Dafny - Proving the correctness of AWS authorization
- Symbolic Execution
- C + Klee - Gilded Rose, Video
- Functional implementation as spec
- Dafny - Linked Lists Video 1, Video 2
- Coq + Gallina
- Proving program equivalence of an embedded language
- Coq + Imp - Programming Language Foundations
- Proving equivelance of a program transformation
- Relational Verification
- Differential Analysis
- Program Equivalence
- Program Synthesis
- Symbolic Execution
- Simple formally verified compiler in Lean - 2021 - Leo Okawa Ericson
- Kayak: Safe Semantic Refactoring to Java Streams - 2017 - David, Kesseli, Kroening]
- Abstract Execution: Automatically Proving Infinitely Many Programs - 2020 Steinhoefel PhD thesis. Slides on Refinity
- Equivalence by Canonicalization for Synthesis-Backed Refactoring - 2024 - Examples in Elm and Python/NumPy, cobbler repo
- Proof Repair - 2021 Talia Ringer PhD Thesis