Results 11 -
11 of
11
Inferring Precise Polymorphic Specifications for the Hoare State Monad
"... Abstract. The Hoare state monad provides a powerful means of structuring the verification of higher-order, stateful programs. However, most prior works involving the Hoare monad have been in the context of interactive proof assistants, imposing a significant cost both for computing verification cond ..."
Abstract
- Add to MetaCart
Abstract. The Hoare state monad provides a powerful means of structuring the verification of higher-order, stateful programs. However, most prior works involving the Hoare monad have been in the context of interactive proof assistants, imposing a significant cost both for computing verification conditions and for discharging their proofs. This paper aims to reduce this cost by automatically inferring verification conditions for programs using the Hoare monad. The inferred conditions can then be fed to a standard, first-order, automated theorem prover, e.g., an SMT solver. Our approach has several novelties and benefits. Most prominently, the specifications inferred for stateful functions involve the use of predicate transformers applied to arbitrary, polymorphic post-conditions. This allows us to easily implement a syntactic, unification-based type inference algorithm, even in the presence of calls to higher-order functions. We show how to structure specifications so that despite the use of higher-order logic in the types of higher-order functions, we can generate first-order verification conditions for many programs. The present work also has some limitations: we focus primarily on specification inference for (recursion-free) clients of higher-order libraries; the libraries themselves (as well as all loop invariants) require manual specifications. We have implemented our inference algorithm as a front-end to the F ⋆ compiler and report on a preliminary evaluation of our tool on a collection of benchmarks. 1

