
软件学报 ISSN 1000-9825, CODEN RUXUEW E-mail: jos@iscas.ac.cn
Journal of Software,2017,28(4):819−826 [doi: 10.13328/j.cnki.jos.005196] http://www.jos.org.cn
©中国科学院软件研究所版权所有. Tel: +86-10-62562563
基于 Z3 的 Coq 自动证明策略的设计和实现
∗
张恒若
1
,
付
明
2,3
1
(中国科学技术大学 信息科学技术学院,安徽 合肥 230026)
2
(中国科学技术大学 计算机科学与技术学院,安徽 合肥 230026)
3
(中国科学技术大学 苏州研究院软件安全实验室,江苏 苏州 215123)
通讯作者: 付明, E-mail: fuming@ustc.edu.cn
摘 要: 形式化验证方法被认为是一种构建高可信软件系统的有效手段.在定理证明工具通过手动写证明脚本来
验证系统软件的功能正确性,这种验证方式表达力强,可以证明复杂系统,但是自动化程度低、验证代价比较高;而
使用程序验证器接受经过规范标注的源代码生成验证条件,并将验证条件交给约束求解器自动求解,这种方式自动
化程度高,缺点在于它很难验证复杂系统软件的全部功能的正确性.结合上述两种方式的优点,在定理证明工具 Coq
中实现了一个自动证明策略 smt4coq,它通过在 Coq 中调用约束求解器 Z3 自动证明 32 位机器整数相关的数学命题,
提高了自动化验证的程度,减少了用户手动验证程序的开销.
关键词: 形式化验证;定理证明工具;约束求解器;Coq;Z3
中图法分类号: TP311
中文引用格式: 张恒若,付明.基于 Z3 的 Coq 自动证明策略的设计和实现.软件学报,2017,28(4):819−826. http://www.jos.org.
cn/1000-9825/5196.htm
英文引用格式: Zhang HR, Fu M. Design and implementation of Coq tactics based on Z3. Ruan Jian Xue Bao/Journal of Software,
2017,28(4):819−826 (in Chinese). http://www.jos.org.cn/1000-9825/5196.htm
Design and Implementation of Coq Tactics Based on Z3
ZHANG Heng-Ruo
1
, FU Ming
2,3
1
(School of Information Science and Technology, University of Science and Technology of China, Hefei 230026, China)
2
(School of Computer Science, University of Science and Technology of China, Hefei 230026, China)
3
(Software Security Laboratory, Suzhou Institute for Advanced Study, University of Science and Technology of China, Suzhou 215123,
China)
Abstract: Formal verification is an effective approach to construct high confidence software. Verifying the functional correctness of
complex system software by manually writing proof scripts in proof assistant tools is feasible with the low degree of automation, and the
verification cost is relatively high. The automatic program verifiers verify programs by taking the annotated source code as their input to
generate verification conditions automatically solved by SMT solvers. This approach has a high degree of automation, but it is impossible
to verify the functional correctness of the entire system software. By combining the advantage of the above two methods, this paper
implements a novel Coq tactic plug-in named “smt4coq”, which allows calling the Z3 SMT solver in Coq to automatically prove
mathematical propositions involved with 32-bit machine integers. The new tactic improves the degree of automation and reduces the cost
of manual verification.
Key words: formal verification; proof assistant tool; SMT solver; Coq; Z3
∗ 基金项目: 国家自然科学基金(61103023, 61229201, 61379039, 91318301, 61632005)
Foundation item: National Natural Science Foundation of China (61103023, 61229201, 61379039, 91318301, 61632005)
收稿时间: 2016-06-20; 修改时间: 2016-09-08; 采用时间: 2016-11-26; jos 在线出版时间: 2017-01-24
CNKI 网络优先出版: 2017-02-20 13:43:28, http://www.cnki.net/kcms/detail/11.2560.TP.20170220.1343.003.html
评论