Overcoming Restraint: Composing Verification of Foreign Functions with Cogent

12/11/2021
by   Louis Cheung, et al.
0

Cogent is a restricted functional language designed to reduce the cost of developing verified systems code. Because of its sometimes-onerous restrictions, such as the lack of support for recursion and its strict uniqueness type system, Cogent provides an escape hatch in the form of a foreign function interface (FFI) to C code. This poses a problem when verifying Cogent programs, as imported C components do not enjoy the same level of static guarantees that Cogent does. Previous verification of file systems implemented in Cogent merely assumed that their C components were correct and that they preserved the invariants of Cogent's type system. In this paper, we instead prove such obligations. We demonstrate how they smoothly compose with existing Cogent theorems, and result in a correctness theorem of the overall Cogent-C system. The Cogent FFI constraints ensure that key invariants of Cogent's type system are maintained even when calling C code. We verify reusable higher-order and polymorphic functions including a generic loop combinator and array iterators and demonstrate their application to several examples including binary search and the BilbyFs file system. We demonstrate the feasibility of verification of mixed Cogent-C systems, and provide some insight into verification of software comprised of code in multiple languages with differing levels of static guarantees.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/19/2021

Overcoming Restraint: Modular Refinement using Cogent's Principled Foreign Function Interface

Cogent is a restricted functional language designed to reduce the cost o...
research
12/20/2019

QuB: A Resource Aware Functional Programming Language

Managing resources—file handles, database connections, etc.—is a hard pr...
research
07/08/2022

Flux: Liquid Types for Rust

We introduce Flux, which shows how logical refinements can work hand in ...
research
11/13/2015

Specifying a Realistic File System

We present the most interesting elements of the correctness specificatio...
research
11/01/2018

Decidable Verification of Uninterpreted Programs

verifying uninterpreted programs---programs that work over arbitrary da...
research
01/24/2022

A Sorted Datalog Hammer for Supervisor Verification Conditions Modulo Simple Linear Arithmetic

In a previous paper, we have shown that clause sets belonging to the Hor...
research
03/18/2021

Computing Parameterized Invariants of Parameterized Petri Nets

A fundamental advantage of Petri net models is the possibility to automa...

Please sign up or login with your details

Forgot password? Click here to reset