一句话:提出通用编码理论,把 ∀∃ 关系霍尔逻辑归约为标准一元霍尔逻辑,无需扩展框架或重证可靠性。
验证真实程序的功能正确性可分解为程序精化与高层算法正确性证明。关系霍尔逻辑能建立精化,但在非确定性场景下需要 ∀∃ 关系霍尔逻辑;现有编码引入 ghost state 与不变量,增加形式化复杂度和可靠性证明负担。本文提出通用编码理论:重新定义关系霍尔三元组的有效性,同时保留原有证明规则,并将 ∀∃ 模式封装进断言,从而把关系三元组归约为标准一元霍尔三元组。作者证明编码后的标准霍尔三元组有效性与原关系三元组有效性等价,并说明常见关系霍尔证明规则是标准霍尔规则的特例,关系证明步骤对应标准证明步骤。由此,标准霍尔逻辑只需定义 Exec 谓词即可证明 ∀∃ 关系性质,无需修改逻辑框架或重新验证可靠性。
Verifying a real-world program’s functional correctness can be decomposed into (1) a refinement proof showing that the program implements a more abstract high-level program and (2) an algorithm correctness proof at the high level. Relational Hoare logic serves as a powerful tool to establish refinement but often necessitates formalization beyond standard Hoare logic. Particularly in the nondeterministic setting, the ∀∃ relational Hoare logic is required. Existing approaches encode this logic into a Hoare logic with ghost states and invariants, yet these extensions significantly increase formalization complexity and soundness proof overhead. This paper proposes a generic encoding theory that reduces the ∀∃ relational Hoare logic to standard (unary) Hoare logic. Precisely, we propose to redefine the validity of relational Hoare triples while preserving the original proof rules and then encapsulate the ∀∃ pattern within assertions. We have proved that the validity of encoded standard Hoare triples is equivalent to the validity of the desired relational Hoare triples. Moreover, the encoding theory demonstrates how common relational Hoare logic proof rules are indeed special cases of standard Hoare logic proof rules, and relational proof steps correspond to standard proof steps. Our theory enables standard Hoare logic to prove ∀∃ relational properties by defining a predicate Exec , without requiring modifications to the logic framework or re-verification of soundness.
@article{paperbot2901,
title = {Encode the ∀∃ Relational Hoare Logic into Standard Hoare Logic},
author = {Shushu Wu and Xiwei Wu and Qinxiang Cao},
journal = {Proceedings of the ACM on Programming Languages},
volume = {9},
number = {OOPSLA2},
year = {2025},
doi = {10.1145/3763138}
}