arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2503.22641quant-phcs.SE
收藏

QuCheck:Qiskit中量子程序的基于属性的测试框架

QuCheck: A Property-based Testing Framework for Quantum Programs in Qiskit

Gabriel Pontolillo, Mohammad Reza Mousavi, Marek Grzesiuk

AI总结:

本文提出QuCheck,一个基于Qiskit的量子程序属性测试框架,通过变异分析验证其有效性,相比QSharpCheck多检测36%故障且耗时减少81%,证实了属性测试在量子系统验证中的可行性。

摘要:

基于属性的测试先前已在Q#中通过QSharpCheck被提出用于量子程序;然而,该实现功能有限,缺乏可扩展性,并且仅在单一属性下对有限范围的程序进行了评估。为了解决这些局限性,我们提出了QuCheck,一个在Qiskit中增强的基于属性的测试框架。通过利用Qiskit和更广泛的Python生态系统,QuCheck促进了属性的构建,引入了灵活的输入生成器和断言,并支持表达性前置条件。我们通过对五个量子程序(2-10量子比特)进行变异分析来评估其有效性,变化属性数量、输入和测量次数以评估它们对故障检测的影响,并展示基于属性的测试在各种条件下的有效性。结果显示,变异分数(故障检测的一种度量)与评估的属性数量之间存在强正相关,而假阳性率与测量次数之间存在中等负相关。在最彻底的测试配置中,评估三个属性的配置在所有五个算法中实现了平均变异分数在0.90到0.92之间,假阳性率在0到0.04之间。QuCheck比QSharpCheck多识别了36.0%的故障,执行时间减少了81.1%,尽管有一个假阳性。这些发现强调了基于属性的测试在验证量子系统方面的可行性。

英文摘要:

Property-based testing has been previously proposed for quantum programs in Q# with QSharpCheck; however, this implementation was limited in functionality, lacked extensibility, and was evaluated on a narrow range of programs using a single property. To address these limitations, we propose QuCheck, an enhanced property-based testing framework in Qiskit. By leveraging Qiskit and the broader Python ecosystem, QuCheck facilitates property construction, introduces flexible input generators and assertions, and supports expressive preconditions. We assessed its effectiveness through mutation analysis on five quantum programs (2-10 qubits), varying the number of properties, inputs, and measurement shots to assess their impact on fault detection and demonstrate the effectiveness of property-based testing across a range of conditions. Results show a strong positive correlation between the mutation score (a measure of fault detection) and number of properties evaluated, with a moderate negative correlation between the false positive rate and number of measurement shots. Among the most thorough test configurations, those evaluating three properties achieved a mean mutation score ranging from 0.90 to 0.92 across all five algorithms, with the false positive rate between 0 and 0.04. QuCheck identified 36.0% more faults than QSharpCheck, with execution time reduced by 81.1%, despite one false positive. These findings underscore the viability of property-based testing for verifying quantum systems.

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

↑