2

Consider the problem of equivalence checking two terminating sequential programs $P$ and $P'$ with the same input signatures and return statements. Two programs are equivalent if for all inputs ($args$) they terminate with the same return value $ret$ and contain the same heap values ($mem$).

One approach is to model both programs as transitions systems and check that $P$ and $P'$ are bisimilar. As bisimilarity is often too strong to capture some programs that are equivalent (often the case for program transformations that require reordering), various approaches try to instead show a weaker notion of bisimilarity for proving program equivalence ([1],[2],[3]).

Another approach for checking program equivalence is to construct the product program $PP' = P;P'$ where all state variables in $P'$ are primed and return statements from $P$ and $P'$ are composed into tuples. For equivalence we can check for the validity of the hoare triple $\{args=args' \land mem=mem'\} PP' \{ret=ret' \land mem=mem'\}$. If loops are involved, we would generate inductive loop invariants that are strong enough to imply the post-condition. No transition system or notion of bisimilarity is needed here.

My questions:

  1. What literature discusses this second (hoare logic + product program) approach?
  2. Why is it less commonly used compared to the bisimulation method?

[1] https://people.eecs.berkeley.edu/~necula/Papers/tv_pldi00.pdf

[2] https://dl.acm.org/doi/pdf/10.1145/3445814.3446751

[3] https://theory.stanford.edu/~aiken/publications/papers/pldi19.pdf

Albi
  • 23
  • 4

2 Answers2

3

Have a look at the Related Work section of The Next 700 Relational Program Logics by Maillard et al., which has a paragraph about "Product program constructions".

Li-yao Xia
  • 1,128
  • 5
  • 6
1

I don't think it's obvious which is more commonly used. The general problem is undecidable so no method will be complete. This means you need to choose between different tradeoffs. Bisimilarity might be easier to check but less complete; formal verification might be more complete but more challenging to apply in practice (e.g., you have to find appropriate loop invariants, etc.).

D.W.
  • 167,959
  • 22
  • 232
  • 500