System FR as Foundations for Stainless

04/06/2019
by   Jad Hamza, et al.
0

We present the design, implementation, and foundation of a verifier for higher-order functional programs with generics and recursive data types. Our system supports proving safety and termination using preconditions, postconditions and assertions. It supports writing proof hints using assertions and recursive calls. To formalize the soundness of the system we introduce System FR, a calculus supporting System F polymorphism, dependent refinement types, and recursive types (including recursion through contravariant positions of function types). Through the use of sized types, System FR supports reasoning about termination of lazy data structures such as streams. We formalize a reducibility argument using the Coq proof assistant and prove the soundness of a type-checker with respect to call-by-value semantics, ensuring type safety and normalization for typeable programs. Our program verifier is implemented as an alternative verification-condition generator for the Stainless tool, which relies on existing SMT-based solver backend for automation. We demonstrate the efficiency of our approach by verifying a collection of higher-order functional programs comprising around 14000 lines of polymorphic higher-order Scala code, including graph search algorithms, basic number theory, monad laws, functional data structures, and assignments from popular Functional Programming MOOCs.

READ FULL TEXT
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

04/11/2021

On Probabilistic Termination of Functional Programs with Continuous Distributions

We study termination of higher-order probabilistic functional programs w...
03/13/2021

Proving and Disproving Programs with Shared Mutable Data

We present a tool for verification of deterministic programs with shared...
03/03/2021

Functional Extensionality for Refinement Types

Refinement type checkers are a powerful way to reason about functional p...
06/24/2017

Local Refinement Typing

We introduce the Fusion algorithm for local refinement type inference, y...
05/07/2019

A Type Theory for Defining Logics and Proofs

We describe a Martin-Löf-style dependent type theory, called Cocon, that...
12/11/2019

Practical Sized Typing for Coq

Termination of recursive functions and productivity of corecursive funct...
05/01/2018

Live Functional Programming with Typed Holes

This paper develops a dynamic semantics for incomplete functional progra...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.