Safety at speed: in-place array algorithms from pure functional programs by safely re-using storage

We present a purely functional array programming language that offers safe, purely functional and crash-free in-place array transformations. The language supports high-level abstractions for pure and efficient array computations that fully support equational reasoning. We show how to execute selected parts of these computations safely in-place, with the compiler guaranteeing that in-place execution does not change the computation’s result. Correctness is ensured by using an off-the-shelf-theorem prover to discharge safety conditions. Our main contribution is the idea of virtual copies for expressing re-use of arrays, and techniques for verifying their safety, which allow a pure language to include in-place transformations without weakening its transparency or reasoning power.

[1]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.

[2]  Simon L. Peyton Jones,et al.  Linear Haskell: practical linearity in a higher-order polymorphic language , 2017, Proc. ACM Program. Lang..

[3]  John G. P. Barnes,et al.  High Integrity Software - The SPARK Approach to Safety and Security , 2003 .

[4]  John Launchbury,et al.  Guilt free ivory , 2015, Haskell.

[5]  Cormac Flanagan,et al.  Predicate abstraction for software verification , 2002, POPL '02.

[6]  Martin Vetterli,et al.  Fast Fourier transforms: a tutorial review and a state of the art , 1990 .

[7]  Emil Axelsson Compilation as a Typed EDSL-to-EDSL Transformation , 2016, ArXiv.

[8]  Martin Elsman,et al.  Futhark: purely functional GPU-programming with nested parallelism and in-place array updates , 2017, PLDI.

[9]  Wouter Swierstra,et al.  Data types à la carte , 2008, Journal of Functional Programming.

[10]  Juan Chen,et al.  Secure distributed programming with value-dependent types , 2011, Journal of Functional Programming.

[11]  Philip Wadler,et al.  Linear Types can Change the World! , 1990, Programming Concepts and Methods.

[12]  Nicholas D. Matsakis,et al.  The rust language , 2014, HILT '14.

[13]  James Cheney,et al.  Cyclone: A Safe Dialect of C , 2002, USENIX Annual Technical Conference, General Track.

[14]  Patrick Maxim Rondon,et al.  Liquid types , 2008, PLDI '08.

[15]  Mary Sheeran,et al.  The Design and Implementation of Feldspar - An Embedded Language for Digital Signal Processing , 2010, IFL.

[16]  J. Tukey,et al.  An algorithm for the machine calculation of complex Fourier series , 1965 .

[17]  Andrew D. Gordon,et al.  Semantic subtyping with an SMT solver , 2010, ICFP '10.

[18]  Mary Sheeran,et al.  Hardware software co-design in Haskell , 2017, Haskell.

[19]  Mary Sheeran,et al.  Feldspar: Application and Implementation , 2011, CEFP.

[20]  Steven G. Johnson,et al.  The Design and Implementation of FFTW3 , 2005, Proceedings of the IEEE.