kth.sePublications KTH
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
VeCoGen: Automating Generation of Formally Verified C Code With Large Language Models
KTH, School of Industrial Engineering and Management (ITM), Engineering Design, Mechatronics and Embedded Control Systems. TRATON.ORCID iD: 0009-0002-1114-4395
KTH, School of Electrical Engineering and Computer Science (EECS), Computer Science, Theoretical Computer Science, TCS.ORCID iD: 0000-0003-2183-9633
2025 (English)In: FormaliSE 2025: ACM/IEEE International Conference on Formal Methods in Software Engineering, Ottawa, Canada, April 27-28, 2025. / [ed] Gwen Salaün and Anastasia Mavridou, Ottawa, Ontario, Canada: IEEE Computer Society Digital Library, 2025Conference paper, Published paper (Refereed)
Abstract [en]

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.

Place, publisher, year, edition, pages
Ottawa, Ontario, Canada: IEEE Computer Society Digital Library, 2025.
Keywords [en]
Codes, Program processors, Limiting, Large language models, Natural languages, Programming, Specification languages, Formal specifications, Formal verification, Software development management
National Category
Computer Sciences
Research subject
Computer Science
Identifiers
URN: urn:nbn:se:kth:diva-364661DOI: 10.1109/FormaliSE66629.2025.00017ISI: 001554519900011Scopus ID: 2-s2.0-105009063103OAI: oai:DiVA.org:kth-364661DiVA, id: diva2:1969954
Conference
FormaliSE 2025
Note

Part of ISBN 979-8-3315-3794-4

QC 20250617

Available from: 2025-06-16 Created: 2025-06-16 Last updated: 2025-12-20Bibliographically approved

Open Access in DiVA

No full text in DiVA

Other links

Publisher's full textScopusPublisher

Authority records

Sevenhuijsen, MerlijnEtemadi, KhashayarNyberg, Mattias

Search in DiVA

By author/editor
Sevenhuijsen, MerlijnEtemadi, KhashayarNyberg, Mattias
By organisation
Mechatronics and Embedded Control SystemsTheoretical Computer Science, TCS
Computer Sciences

Search outside of DiVA

GoogleGoogle Scholar

doi
urn-nbn

Altmetric score

doi
urn-nbn
Total: 96 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf