Leveraging Rust Types for Program Synthesis


Loading...

Date

2023-06

Publication Type

Journal Article

ETH Bibliography

yes

Citations

Altmetric

Data

Abstract

The Rust type system guarantees memory safety and data-race freedom. However, to satisfy Rust's type rules, many familiar implementation patterns must be adapted substantially. These necessary adaptations complicate programming and might hinder language adoption. In this paper, we demonstrate that, in contrast to manual programming, automatic synthesis is not complicated by Rust's type system, but rather benefits in two major ways. First, a Rust synthesizer can get away with significantly simpler specifications. While in more traditional imperative languages, synthesizers often require lengthy annotations in a complex logic to describe the shape of data structures, aliasing, and potential side effects, in Rust, all this information can be inferred from the types, letting the user focus on specifying functional properties using a slight extension of Rust expressions. Second, the Rust type system reduces the search space for synthesis, which improves performance. In this work, we present the first approach to automatically synthesizing correct-by-construction programs in safe Rust. The key ingredient of our synthesis procedure is Synthetic Ownership Logic, a new program logic for deriving programs that are guaranteed to satisfy both a user-provided functional specification and, importantly, Rust's intricate type system. We implement this logic in a new tool called RusSOL. Our evaluation shows the effectiveness of RusSOL, both in terms of annotation burden and performance, in synthesizing provably correct solutions to common problems faced by new Rust developers.

Publication status

published

Editor

Book title

Volume

7 (PLDI)

Pages / Article No.

1414 - 1437

Publisher

Association for Computing Machinery

Event

Edition / version

Methods

Software

Geographic location

Date collected

Date created

Subject

Program logic; Program synthesis; Rust; type systems

Organisational unit

03653 - Müller, Peter / Müller, Peter check_circle

Notes

Funding

Related publications and datasets