Skip to main content
QUICK REVIEW

[Paper Review] Refinement Reflection: Complete Verification with SMT

Niki Vazou, Anish Tondwalkar|arXiv (Cornell University)|Nov 9, 2017
Logic, programming, and type systemsComputer Science11 citations
TL;DR

This paper introduces Refinement Reflection, a framework that embeds function implementations directly into their output refinement types, enabling complete, SMT-based verification of functional correctness properties. By reflecting function definitions into types and using Proof by Logical Evaluation (PLE), the approach automates equational reasoning, allowing users to write proofs as programs via pattern matching and recursion, with full automation and decidability guarantees in Liquid Haskell.

ABSTRACT

We introduce Refinement Reflection, a new framework for building SMT-based deductive verifiers. The key idea is to reflect the code implementing a user-defined function into the function's (output) refinement type. As a consequence, at uses of the function, the function definition is instantiated in the SMT logic in a precise fashion that permits decidable verification. Reflection allows the user to write equational proofs of programs just by writing other programs using pattern-matching and recursion to perform case-splitting and induction. Thus, via the propositions-as-types principle, we show that reflection permits the specification of arbitrary functional correctness properties. Finally, we introduce a proof-search algorithm called Proof by Logical Evaluation that uses techniques from model checking and abstract interpretation, to completely automate equational reasoning. We have implemented reflection in Liquid Haskell and used it to verify that the widely used instances of the Monoid, Applicative, Functor, and Monad typeclasses actually satisfy key algebraic laws required to make the clients safe, and have used reflection to build the first library that actually verifies assumptions about associativity and ordering that are crucial for safe deterministic parallelism.

Motivation & Objective

  • To address the limitations of existing SMT-based verifiers that rely on incomplete heuristics for instantiating user-defined function axioms.
  • To bridge the gap between SMT-based verification and type-theory-based theorem proving by enabling fully automated, decidable reasoning over user-defined functions.
  • To provide a practical, language-integrated framework for writing and verifying complex functional correctness properties using familiar programming constructs like recursion and pattern matching.
  • To develop a proof-search algorithm that guarantees completeness for equational proofs in total, terminating functions.

Proposed method

  • Reflects the implementation of a user-defined function into its output refinement type, turning the function's definition into a precise logical description in the SMT logic.
  • Uses the propositions-as-types principle to represent proofs as executable programs, allowing equational reasoning through pattern matching and recursion.
  • Employs Proof by Logical Evaluation (PLE), a proof-search algorithm that mimics type-level computation by unfolding function applications using guarded definitions and SMT reasoning.
  • Applies abstract interpretation and model checking techniques to ensure the proof search is a universal (must) abstraction of the function's concrete semantics, guaranteeing termination.
  • Leverages SMT solvers to automate quantifier-free reasoning, enabling efficient verification of logical subgoals within proofs.
  • Integrates the framework into Liquid Haskell, reusing the existing compiler and ecosystem to verify algebraic laws of standard typeclasses.

Experimental results

Research questions

  • RQ1Can SMT-based verification be made complete and fully automated for user-defined functions without relying on heuristics?
  • RQ2Can functional correctness proofs be expressed naturally as programs using standard language features like recursion and pattern matching?
  • RQ3Can a proof-search algorithm be designed that is both sound and complete for equational reasoning in total functions?
  • RQ4Can the framework verify complex algebraic laws—such as associativity and commutativity—of widely used Haskell typeclasses?
  • RQ5Can the integration of proof automation with refinement types lead to practical, scalable verification in real-world codebases?

Key findings

  • Refinement Reflection enables complete, decidable verification of user-defined functions by reflecting their implementations into refinement types, eliminating reliance on incomplete instantiation heuristics.
  • Proof by Logical Evaluation (PLE) is a complete proof-search algorithm that systematically unfolds function applications using guarded definitions and SMT reasoning, guaranteeing termination for total functions.
  • The framework successfully verified the algebraic laws of Monoid, Applicative, Functor, and Monad typeclasses in Liquid Haskell, including associativity and ordering properties critical for deterministic parallelism.
  • The approach allows writing proofs as programs using pattern matching and recursion, with SMT-aided automation of quantifier-free subgoals, achieving a high degree of expressivity and tooling integration.
  • The integration into Liquid Haskell demonstrates that existing language ecosystems can be repurposed as theorem provers with minimal overhead, enabling practical verification at scale.
  • The method provides a universal abstraction of function semantics via PLE, ensuring that all valid equational proofs are discoverable, thus achieving completeness in proof search.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.