EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

Spurious or Genuine? Evaluating Large Language Models in Validating Counterexamples for Loop Invariant Inference

Guangsheng Fan, Dengping Wei, Banghu Yin

Electronics · 10.03.2026 · 15 (6) · 1148

DOI: 10.3390/electronics15061148 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Electronics, online erschienen am 10.03.2026. Verfasst von Guangsheng Fan und 2 weiteren Autor:innen. Die Arbeit wurde bisher 1-mal zitiert (Crossref) und nennt 57 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0).

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Whether a counterexample is genuine or spurious fundamentally influences the effectiveness and completeness of loop invariant inference, which is a core component of automated program verification. However, reliably determining the validity of a counterexample remains a challenging task. In this paper, we present a systematic evaluation of large language models (LLMs) on this problem. We construct a benchmark of program states that serve as counterexamples, categorized into three representative types: (i) pre-states of inductive counterexamples derived from LLM-proposed invariants and (ii–iii) boundary states derived from correct inductive invariants, where the states themselves either violate (ii) or satisfy (iii) the program’s precondition. Ground-truth labels are established using a state-of-the-art program verifier. We evaluate multiple LLMs under diverse prompting strategies. Our results show that LLMs perform well on the first two types of counterexamples in the benchmark but poorly on the third. Moreover, LLMs are substantially more accurate in classifying spurious counterexamples than genuine ones. These findings offer valuable guidance for future research on LLM-assisted loop invariant inference.

Zitieren

APA

Fan, G., Wei, D., & Yin, B. (2026). Spurious or Genuine? Evaluating Large Language Models in Validating Counterexamples for Loop Invariant Inference. Electronics, 15(6), 1148. https://doi.org/10.3390/electronics15061148

Vancouver

Fan G, Wei D, Yin B. Spurious or Genuine? Evaluating Large Language Models in Validating Counterexamples for Loop Invariant Inference. Electronics. 2026;15(6):1148. doi:10.3390/electronics15061148

BibTeX
@article{Fan2026,
  author = {Fan, Guangsheng and Wei, Dengping and Yin, Banghu},
  title = {Spurious or Genuine? Evaluating Large Language Models in Validating Counterexamples for Loop Invariant Inference},
  journal = {Electronics},
  year = {2026},
  volume = {15},
  number = {6},
  pages = {1148},
  doi = {10.3390/electronics15061148}
}
Kostenlos starten →