A monadic framework for relational verification: applied to information security, program equivalence, and optimizations
Proceedings of the 7th ACM SIGPLAN International Conference on Certified Programs and Proofs - CPP 2018
Relational properties describe multiple runs of one or more programs. They characterize many useful notions of security, program refinement, and equivalence for programs with diverse computational effects, and they have received much attention in the recent literature. Rather than developing separate tools for special classes of effects and relational properties, we advocate using a general purpose proof assistant as a unifying framework for the relational verification of effectful programs.
... ectful programs. The essence of our approach is to model effectful computations using monads and to prove relational properties on their monadic representations, making the most of existing support for reasoning about pure programs. We apply this method in F ⋆ and evaluate it by encoding a variety of relational program analyses, including information flow control, semantic declassification, program equivalence and refinement at higher order, correctness of program optimizations. By relying on SMT-based automation, unary weakest preconditions, user-defined effects, and monadic reification, we show that, compared to unary properties, verifying relational properties requires little additional effort from the F ⋆ programmer. let rec sum_up r lo hi = if lo hi then (r := !r+lo; sum_up r (lo+1) hi) let rec sum_dn r lo hi = if lo hi then (r := !r+hi−1; sum_dn r lo (hi−1)) Both functions sum all numbers between lo and hi into some accumulator reference r, the former function by counting up and the latter function by counting down.