Event-B Agent: Towards LLM Agent for Formal Model Synthesis and Repair
Building software that is correct by construction is a long-standing goal in software engineering, as it ensures reliability during design and development rather than after deployment. Formal methods realize this vision by enabling the expression of system behavior and requirements in mathematics, thereby guaranteeing correctness through formal verification, including theorem proving and model checking. However, the steep learning curve and demand for mathematical expertise hinder the widespread adoption of formal methods. Large language models (LLMs) have recently shown promise in bridging this gap through autoformalization. However, existing LLM-based approaches are largely limited to isolated tasks, such as theorem proving without formalization or model synthesis with insufficient verification. While valuable, these efforts do not fully exploit the potential of a more comprehensive framework in which models and proofs evolve together, a process that closely reflects real-world development practice. To address this gap, we propose Event-B Agent, a novel framework inspired by the interleaved nature of software design. Given natural language requirements, Event-B Agent constructs an initial model and iteratively repairs and refines it using formal verification feedback. Refinement simplifies proof discharge, while repair of models and proofs ensures the soundness of each refinement step. Together, these two components reinforce each other to progressively improve the model quality. Evaluation across systems of varying complexity demonstrates that Event-B Agent substantially outperforms baselines in end-to-end formal model synthesis and repair, while maintaining reasonable efficiency. These results suggest that Event-B Agent is a promising step toward correct-by-construction formal model synthesis and repair.
Authors
- Xinyue Zuo (ORCID: https://orcid.org/0000-0003-4412-3793)
- Yuhan Sun (ORCID: https://orcid.org/0000-0002-2940-213X)
- Hongshu Wang (ORCID: https://orcid.org/0009-0006-0198-148X)
- Qin Li (ORCID: https://orcid.org/0009-0001-4067-5462)
- Yamine Ait Ameur
- Jin Song Dong
Institutions
- Université Toulouse III - Paul Sabatier (FR)
- National University of Singapore (SG)
- Institut National Polytechnique de Toulouse (FR)
- Université Toulouse-I-Capitole (FR)
- Institut de Recherche en Informatique de Toulouse (FR)
- Université Toulouse - Jean Jaurès (FR)
- Institut Polytechnique de Bordeaux (FR)
- East China Normal University (CN)
Publication Details
- Journal
- Proceedings of the ACM on software engineering.
- Published
- 2026-06-30
- DOI
- https://doi.org/10.1145/3808218
- Primary Topic
- Model-Driven Software Engineering Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00