arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2511.15403cs.SEcs.PL
收藏

MutDafny:一种基于变异的方法来评估Dafny规格

MutDafny: A Mutation-Based Approach to Assess Dafny Specifications

INESC TEC, Faculdade de Engenharia, Universidade do Porto(波尔图大学工程学院);Faculdade de Engenharia, Universidade do Porto & LASIGE, Universidade de Lisboa(波尔图大学工程学院)

Isabel Amaral, Alexandra Mendes, José Campos

AI总结:

本文提出MutDafny工具,通过变异测试揭示Dafny规格中的缺陷,分析了40种变异算子,评估了794个真实Dafny程序,发现5个需要加强的弱规格。

摘要:

在验证意识语言中,如Dafny,尽管其关键作用,规格与实现一样容易出错。规格中的缺陷可能导致形式验证的程序偏离预期行为。本文探讨了利用变异测试揭示Dafny规格中弱点的方法。我们提出了MutDafny工具,通过自动信号潜在弱点来提高Dafny规格的可靠性。使用变异测试方法,我们向代码中引入故障(变异),并依赖形式规格来检测它们。如果带有变异的程序通过验证,这可能表明规格中存在弱点。我们广泛分析了流行工具中的变异算子,识别出适用于Dafny的算子。此外,我们从公开可用的GitHub Dafny项目中提取bugfix提交,合成出针对该语言的算子。结合两者,我们为工具配备了总共40种变异算子。我们对794个真实Dafny程序的数据集评估了MutDafny的有效性和效率,并手动分析了部分未检测到的变异体,识别出5个需要加强的弱规格(平均每241行代码有一个)。

英文摘要:

In verification-aware languages, such as Dafny, despite their critical role, specifications are as prone to error as implementations. Flaws in specifications can result in formally verified programs that deviate from the intended behavior. In this paper, we explore the use of mutation testing to reveal weaknesses in formal specifications written in Dafny. We present MutDafny, a tool that increases the reliability of Dafny specifications by automatically signaling potential weaknesses. Using a mutation testing approach, we introduce faults (mutations) into the code and rely on formal specifications for detecting them. If a program with a mutant verifies, this may indicate a weakness in the specification. We extensively analyze mutation operators from popular tools, identifying the ones applicable to Dafny. In addition, we synthesize new operators tailored for the language from bugfix commits in publicly available Dafny projects on GitHub. Drawing from both, we equipped our tool with a total of 40 mutation operators. We evaluate MutDafny's effectiveness and efficiency on a dataset of 794 real-world Dafny programs, and manually analyze a subset of the resulting undetected mutants, identifying five weak real-world specifications (on average, one at every 241 lines of code) that would benefit from strengthening.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑