Program Derivation and Mechanized Verification of Imperative Dynamic Programming Algorithms
Author:
Affiliation:

  • Article
  • | |
  • Metrics
  • |
  • Reference [34]
  • |
  • Related [20]
  • |
  • Cited by
  • | |
  • Comments
    Abstract:

    As a recursive method for finding the optimal solution to a problem, dynamic programming mainly solves the original problem by first solving the subproblems and then combining their solutions. Due to a large number of dependencies and constraints among its subproblems, the validation procedure is laborious, and especially the correctness verification of imperative dynamic programming algorithms is a challenge. Based on the functional modeling and verification of dynamic programming algorithms Isabelle/HOL, this study avoids dealing with complex dependencies and constraints in proving correctness by verifying the equivalence of imperative dynamic programming algorithms and their programs. Meanwhile, a framework for the design of imperative dynamic programming algorithmic programs and their mechanized verification are proposed. First, according to the optimization method (memo method) and properties (optimal substructure property and subproblems overlapping property) of dynamic programming algorithms, the problem specification is described, the recursive relations are inductively derived, and the loop invariants are formally constructed. Then, the IMP (minimalistic imperative programming language) code is generated based on the recursive relations. Second, the problem specification, loop invariants, and generated IMP code are fed into VCG (verification condition generator) to generate the verification condition for correctness automatically. Additionally, the verification condition is then mechanically verified in the Isabelle/HOL theorem prover. The algorithm is initially designed in the general form of an imperative dynamic programming algorithm and further instantiated to obtain specific algorithms. Finally, the effectiveness of the proposed framework is validated by case studies to provide references for automated derivation and verification of dynamic programming algorithms.

    Reference
    [1] Bellman R. Dynamic programming. Science, 1966, 153(3731): 34–37.
    [2] 王戟, 詹乃军, 冯新宇, 刘志明. 形式化方法概貌. 软件学报, 2019, 30(1): 33–61. http://www.jos.org.cn/1000-9825/5652.htm
    Wang J, Zhan NJ, Feng XY, Liu ZM. Overview of formal methods. Ruan Jian Xue Bao/Journal of Software, 2019, 30(1): 33–61 (in Chinese with English abstract). http://www.jos.org.cn/1000-9825/5652.htm
    [3] 石海鹤, 揭安全, 薛锦云. 0-1背包问题的一种新解法. 计算机工程, 2008, 34(17): 37–38, 49.
    Shi HH, Jie AQ, Xue JY. New algorithm of 0-1 knapsack problem. Computer Engineering, 2008, 34(17): 37–38, 49 (in Chinese with English abstract).
    [4] 王昌晶, 薛锦云. 一类0-1背包问题算法程序的形式化推导. 武汉大学学报(理学版), 2009, 55(6): 674–680.
    Wang CJ, Xue JY. Formal derivation of a kind of 0-1 knapsack problems algorithmic programs. Journal of Wuhan University (Natural Science Edition), 2009, 55(6): 674–680 (in Chinese with English abstract).
    [5] 游颖. 算法形式化方法在三类组合数学问题求解中的应用研究 [硕士学位论文]. 南昌: 江西师范大学, 2017.
    You Y. The application research of algorithm formal method in three kinds of combinatorial mathematical problems [MS. Thesis]. Nanchang: Jiangxi Normal University, 2017 (in Chinese with English abstract).
    [6] Dasgupta S, Papadimitriou CH, Vazirani UV. Algorithms. McGraw-Hill Education, 2006.
    [7] Lew A, Mauch H. Dynamic Programming: A Computational Tool. Berlin: Springer, 2006. [doi: 10.1007/978-3-540-37014-7]
    [8] Mofarah-Fathi L, Norvell TS. Formal derivation of dynamic programming algorithms. 2007. https://www.engr.mun.ca/~theo/Publications/submitted -NECEC2007.pdf
    [9] Bortin M. A formalisation of the Cocke-Younger-Kasami algorithm. Archive of Formal Proofs, 2016. https://isa-afp.org/entries/CYK.html
    [10] Nipkow T, Klein G. Concrete Semantics: With Isabelle/HOL. Springer, 2014.
    [11] Wimmer S, Hu SW, Nipkow T. Verified memoization and dynamic programming. In: Proc. of the 9th Int’l Conf. on Interactive Theorem Proving. Oxford: Springer, 2018. 579-596. [doi: 10.1007/978-3-319-94821-8_34]
    [12] Wimmer S, Hu SW, Nipkow T. Monadification, memoization and dynamic programming. Archive of Formal Proofs, 2018. https://isa-afp.org/entries/Monad_Memo_DP.html
    [13] Si XJ, Dai HJ, Raghothaman M, Naik M, Song L. Learning loop invariants for program verification. In: Proc. of the 32nd Int’l Conf. on Neural Information Processing Systems. Montréal: Curran Associates Inc., 2018. 7762–7773.
    [14] 吴涛. 动态规划算法应用及其在时间效率上的优化 [硕士学位论文]. 南京: 南京理工大学, 2008.
    Wu T. Application of dynamic programming algorithm and its optimization on time efficiency [MS. Thesis]. Nanjing: Nanjing University of Science and Technology, 2008 (in Chinese with English abstract).
    [15] Itzhaky S, Singh R, Solar-Lezama A, Yessenov K, Lu YQ, Leiserson C, Chowdhury R. Deriving divide-and-conquer dynamic programming algorithms using solver-aided transformations. ACM SIGPLAN Notices, 2016, 51(10): 145–164.
    [16] Javanmard MM, Ahmad Z, Zola J, Pouchet LN, Chowdhury R, Harrison R. Efficient execution of dynamic programming algorithms on apache spark. In: Proc. of the 2020 IEEE Int’l Conf. on Cluster Computing (CLUSTER). Kobe: IEEE, 2020. 337–348.
    [17] Erwig M, Kumar P. Explainable dynamic programming. Journal of Functional Programming, 2021, 31: e10.
    [18] Eddy SR. What is dynamic programming? Nature Biotechnology, 2004, 22(7): 909–910.
    [19] Luus R. Iterative Dynamic Programming. Boca Raton: CRC Press, 2000.
    [20] Hoare CAR. An axiomatic basis for computer programming. Communications of the ACM, 1969, 12(10): 576–580.
    [21] Ryan G, Wong J, Yao J, Gu RH, Jana S. CLN2INV: Learning loop invariants with continuous logic networks. arXiv:1909.11542, 2019.
    [22] 左正康, 黄志鹏, 黄箐, 王渊, 王昌晶. 程序求精新策略及自动验证方法研究. 郑州大学学报(理学版), 2022, 54(5): 1–7.
    Zuo ZK, Huang ZP, Huang Q, Wang Y, Wang CJ. Research on new strategy of program refinement and automatic verification method. Journal of Zhengzhou University (Natural Science Edition), 2022, 54(5): 1–7 (in Chinese with English abstract).
    [23] Zuo ZK, Hu Y, Huang Q, Wang Y, Wang CJ. Automatic algorithm programming model based on the improved Morgan’s refinement calculus. Wuhan University Journal of Natural Sciences, 2022, 27(5): 405–414.
    [24] Paulson LC, Nipkow T, Wenzel M. From LCF to Isabelle/HOL. Formal Aspects of Computing, 2019, 31(6): 675–698.
    [25] 江南, 李清安, 汪吕蒙, 张晓瞳, 何炎祥. 机械化定理证明研究综述. 软件学报, 2020, 31(1): 82–112. http://www.jos.org.cn/1000-9825/5870.htm
    Jiang N, Li QA, Wang LM, Zhang XT, He YX. Overview on mechanized theorem proving. Ruan Jian Xue Bao/Journal of Software, 2020, 31(1): 82–112 (in Chinese with English abstract). http://www.jos.org.cn/1000-9825/5870.htm
    [26] 马博林, 张铮, 刘健雄. 应用于动态异构Web服务器的相似度求解方法. 计算机工程与设计, 2018, 39(1): 282–287.
    Ma BL, Zhang Z, Liu JX. Similarity calculation method applied to dynamic heterogeneous Web server system. Computer Engineering and Design, 2018, 39(1): 282–287 (in Chinese with English abstract).
    Cited by
    Comments
    Comments
    分享到微博
    Submit
Get Citation

左正康,孙欢,王昌晶,游珍,黄箐,王唱唱.命令式动态规划类算法程序推导及机械化验证.软件学报,2024,35(9):4218-4241

Copy
Share
Article Metrics
  • Abstract:382
  • PDF: 2502
  • HTML: 902
  • Cited by: 0
History
  • Received:September 11,2023
  • Revised:October 30,2023
  • Online: January 05,2024
  • Published: September 06,2024
You are the first2036646Visitors
Copyright: Institute of Software, Chinese Academy of Sciences Beijing ICP No. 05046678-4
Address:4# South Fourth Street, Zhong Guan Cun, Beijing 100190,Postal Code:100190
Phone:010-62562563 Fax:010-62562533 Email:jos@iscas.ac.cn
Technical Support:Beijing Qinyun Technology Development Co., Ltd.

Beijing Public Network Security No. 11040202500063