Git Product home page Git Product logo

rustproof's Introduction

Rustproof

Build Status

Rustproof is a compiler plugin for the Rust programming language. It generates verification conditions for functions with supplied preconditions(P) and postconditions(Q). That is, given a supplied postcondition on a function, rustproof uses predicate transformer semantics to generate a weakest precondition(WP(S, Q)) from the postcondition and a body of statements(S). The verification condition P->WP(S,Q) is then checked for validity by a SMT solver (z3). This process results in a proof of function correctness.

Dependencies

  • rustc 1.12.0-nightly (2016-08-12).

  • z3

Your installation of z3 needs to be in your PATH for rustproof to work.

Supported Rust Language Features

  • Integer arithmetic
    • isize and usize are unsupported
  • Boolean expressions, variables, and literals
  • Assertions (integer/boolean)
    • assert_eq!() is unsupported
  • If statements

Usage

Including Rustproof in Your Project

Add rustproof as a dependency in Cargo.toml

[dependencies]
rustproof = { git = "https://github.com/Rust-Proof/rustproof.git" }

Using Rustproof

#![plugin(rustproof)] is required in each file where rustproof is used. Typically this is placed at the beginning of a file.

Rustproof uses a custom attribute condition to allow declaring pre/postconditions on functions.

The attribute is supplied as: #[condition(pre=" ", post=" ")] and must be supplied before a function definition.

See USAGE for a detailed explanation of the attribute system.

See EXAMPLES for example functions with condition attributes.

Additionally, #![plugin(rustproof(debug))] prints out basic blocks of each function annotated with #[condition(..)], as well as a step-by-step view of generating the verification condition.

Contributors

Matthew Slocum
Sami Sahli
Vincent Schuster
Michael Salter
Bradley Rasmussen
Drew Gohman
Matthew O'Brien

Reporting Issues

Please report all issues on the github issue tracker.

License

Rustproof is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

rustproof's People

Contributors

arc3x avatar selenesal avatar bajr avatar salterm avatar vschuster avatar blindmosquito avatar ssahli avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.