Abstract
This work explores the utilization of a Large Language Model (LLM), specifically OpenAI’s ChatGPT, to develop a program as a sequence of refinements. Traditionally in formal methods literature such refinements are proven correct, which can be time consuming. In this work the refinements are tested using property-based testing. This approach addresses the problem of ensuring that the code generated by an LLM is correct, which is one of the main challenges of code generation with LLMs. Programs are developed in Scala and testing is performed with ScalaCheck. This approach is demonstrated through the development and testing of a classical bridge controller, originally presented in documentation for the refinement-based Event-B theorem prover.
Cite
CITATION STYLE
Aichernig, B. K., & Havelund, K. (2025). AI-Assisted Programming with Test-Based Refinement. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 14129 LNCS, pp. 385–411). Springer Science and Business Media Deutschland GmbH. https://doi.org/10.1007/978-3-031-73741-1_24
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.