Unfolding Iterators. Specification and Verification of Higher-Order Iterators, in OCaml - Chirica, Ion (2024)
When it comes to software development, programmers find themselves hardly implement- ing anything from scratch, relying on internal or third-party libraries with pre-written code. Besides providing genericity, abstraction, and performant features, by encapsulat- ing everything in a library, we are more keen to standardize code that has been formally proved correct. This work aims to formally prove a subset of the OCamlGraph library, with special concern on algorithms that employ higher-order iteration. By asserting the correctness of its algorithms, its users can feel safer knowing that the library is not error-inducing. We will base ourselves on GOSPEL specifications that can be consumed by the verification framework Cameleer. As most graph algorithms in the OCamlGraph library employ some sort of higher-ordered iteration, we seek to answer the question: “How to soundly and reliably formally verify implementations and clients of OCaml higher-order iteration, using mostly automated proof tools?”. In this document, we outline some theoretical and practical background concerning deductive verification in the functional paradigm and available techniques for specifying and verifying higher-order iteration. We also present our methodology for the specifica- tion and verification of higher-order iterators in OCaml using GOSPEL specifications. We complement this methodology with a collection of case studies that sustain our work.