VeCoGen: Automating Generation of Formally Verified C Code with Large Language Models

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Sevenhuijsen, Merlijn, Etemadi, Khashayar, Nyberg, Mattias
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866913779559694336
author Sevenhuijsen, Merlijn
Etemadi, Khashayar
Nyberg, Mattias
author_facet Sevenhuijsen, Merlijn
Etemadi, Khashayar
Nyberg, Mattias
contents Large language models have demonstrated impressive capabilities in generating code, yet they often produce programs with flaws or deviations from intended behavior, limiting their suitability for safety-critical applications. To address this limitation, this paper introduces VECOGEN, a novel tool that combines large language models with formal verification to automate the generation of formally verified C programs. VECOGEN takes a formal specification in ANSI/ISO C Specification Language, a natural language specification, and a set of test cases to attempt to generate a verified program. This program-generation process consists of two steps. First, VECOGEN generates an initial set of candidate programs. Secondly, the tool iteratively improves on previously generated candidates. If a candidate program meets the formal specification, then we are sure the program is correct. We evaluate VECOGEN on 15 problems presented in Codeforces competitions. On these problems, VECOGEN solves 13 problems. This work shows the potential of combining large language models with formal verification to automate program generation.
format Preprint
id arxiv_https___arxiv_org_abs_2411_19275
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle VeCoGen: Automating Generation of Formally Verified C Code with Large Language Models
Sevenhuijsen, Merlijn
Etemadi, Khashayar
Nyberg, Mattias
Software Engineering
Large language models have demonstrated impressive capabilities in generating code, yet they often produce programs with flaws or deviations from intended behavior, limiting their suitability for safety-critical applications. To address this limitation, this paper introduces VECOGEN, a novel tool that combines large language models with formal verification to automate the generation of formally verified C programs. VECOGEN takes a formal specification in ANSI/ISO C Specification Language, a natural language specification, and a set of test cases to attempt to generate a verified program. This program-generation process consists of two steps. First, VECOGEN generates an initial set of candidate programs. Secondly, the tool iteratively improves on previously generated candidates. If a candidate program meets the formal specification, then we are sure the program is correct. We evaluate VECOGEN on 15 problems presented in Codeforces competitions. On these problems, VECOGEN solves 13 problems. This work shows the potential of combining large language models with formal verification to automate program generation.
title VeCoGen: Automating Generation of Formally Verified C Code with Large Language Models
topic Software Engineering
url https://arxiv.org/abs/2411.19275