https://github.com/viperproject/prusti-dev Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + By Plan + Enterprise + Teams + Compare all + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} viperproject / prusti-dev Public * Notifications * Fork 67 * Star 917 A static verifier for Rust, based on the Viper verification infrastructure. prusti.org License View license 917 stars 67 forks Star Notifications * Code * Issues 139 * Pull requests 18 * Actions * Security * Insights More * Code * Issues * Pull requests * Actions * Security * Insights viperproject/prusti-dev This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 52 branches 8 tags Code * Clone HTTPS GitHub CLI [https://github.com/v] Use Git or checkout with SVN using the web URL. [gh repo clone viperp] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @fpoli fpoli Update README.md ... 3b70cb2 Oct 6, 2022 Update README.md 3b70cb2 Git stats * 6,908 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .cargo Lift requirement of having the prusti feature enabled (#1146) Sep 26, 2022 .devcontainer Add devcontainer settings. Jun 2, 2022 .github Avoid debug dumps when running cargo-prusti (fixes #1185) Oct 6, 2022 .vscode Make rust-analyzer use x.py (#1141) Aug 29, 2022 analysis Bump version and update authors Sep 30, 2022 docs Action to publish prusti-contracts to crates.io (#1144) Sep 27, 2022 jni-gen Bump version and update authors Sep 30, 2022 prusti-common Quantifier optimization fix for conditionals (#1153) Oct 5, 2022 prusti-contracts-build Bump version and update authors Sep 30, 2022 prusti-contracts Bump version and update authors Sep 30, 2022 prusti-interface Bump version and update authors Sep 30, 2022 prusti-launch Fix toolchain used by cargo check Oct 4, 2022 prusti-rustc-interface Bump version and update authors Sep 30, 2022 prusti-server Bump version and update authors Sep 30, 2022 prusti-smt-solver Bump version and update authors Sep 30, 2022 prusti-tests Quantifier optimization fix for conditionals (#1153) Oct 5, 2022 prusti-utils Bump version and update authors Sep 30, 2022 prusti-viper Bump version and update authors Sep 30, 2022 prusti Bump version and update authors Sep 30, 2022 scripts Fix x.py for other oses Aug 23, 2022 smt-log-analyzer Bump version and update authors Sep 30, 2022 test-crates Bump version and update authors Sep 30, 2022 viper-sys Bump version and update authors Sep 30, 2022 viper Bump version and update authors Sep 30, 2022 vir-gen Bump version and update authors Sep 30, 2022 vir Bump version and update authors Sep 30, 2022 .dockerignore Skip verification of prusti-contracts Jun 4, 2021 .gitattributes Add PNG to .gitattributes Feb 16, 2022 .gitignore Lift requirement of having the prusti feature enabled (#1146) Sep 26, 2022 .rustfmt.toml Fix a deprecation warning in rustfmt.toml. Aug 3, 2021 CONTRIBUTING.md Update CONTRIBUTING.md Feb 10, 2021 Cargo.lock Bump version and update authors Sep 30, 2022 Cargo.toml Try to reduce disk usage of tests Oct 5, 2022 Dockerfile Skip verification of prusti-contracts Jun 4, 2021 LICENSE Move tests from prusti-tests back to prusti Jul 19, 2019 README.md Update README.md Oct 6, 2022 benchmarked-files.csv Fix benchmark file Feb 17, 2021 bors.toml Start migration to rustc_smir. Jun 25, 2022 flake.lock Added a simple test Apr 27, 2021 flake.nix Added a simple test Apr 27, 2021 rust-toolchain mk_compile Sep 19, 2022 viper-toolchain Update dependencies (rustc nightly-2022-09-15, viper v-2022-09-02-0742) Sep 15, 2022 x.py Fix logging in x.py Sep 30, 2022 View code Prusti Documentation Quick example Using Prusti README.md Prusti Test Deploy Test coverage Project chat Prusti is a prototype verifier for Rust, built upon the Viper verification infrastructure. By default Prusti verifies absence of integer overflows and panics by proving that statements such as unreachable!() and panic!() are unreachable. Overflow checking can be disabled with a configuration flag, treating all integers as unbounded. In Prusti, the functional behaviour of a function can be specified by using annotations, among which are preconditions, postconditions, and loop invariants. The tool checks them, reporting error messages when the code does not adhere to the provided specification. Documentation * The user guide contains installation instructions, a guided tutorial and a description of various verification features. * The developer guide contains Prusti details intended to make the project more approachable for new contributors. Do you still have questions? Open an issue or contact us on the Zulip chat. Quick example 1. Take the following program: /// A monotonically increasing discrete function, with domain [0, domain_size) trait Function { fn domain_size(&self) -> usize; fn eval(&self, x: usize) -> i32; } /// Find the `x` s.t. `f(x) == target` fn bisect(f: &T, target: i32) -> Option { let mut low = 0; let mut high = f.domain_size(); while low < high { let mid = (low + high) / 2; let mid_val = f.eval(mid); if mid_val < target { low = mid + 1; } else if mid_val > target { high = mid; } else { return Some(mid) } } None } 2. Run Prusti. You get the following error: error: [Prusti: verification error] assertion might fail with "attempt to add with overflow" --> example.rs:12:15 | 12 | let mid = (low + high) / 2; | ^^^^^^^^^^^^ Verification failed 3. Fix the buggy line with let mid = low + ((high - low) / 2); 4. Run Prusti. Now the bisect function verifies. Congratulations! You just proved absence of panics and integer overflows in the bisect function. To additionally prove that the result is correct (i.e. such that f(x) == target), see this example. Using Prusti The easiest way to try out Prusti is by using the "Prusti Assistant" extension for VS Code. Alternatively, if you wish to use Prusti from the command line there are three options: * Download the precompiled binaries for Ubuntu, Windows, or MacOS from a GitHub release. * Compile from the source code, by installing rustup, running ./ x.py setup and then ./x.py build --release. * (unmaintained) Build a Docker image from this Dockerfile. All three options provide the prusti-rustc and cargo-prusti programs that can be used analogously to, respectively, rustc and cargo check. For more detailed instructions, refer to the guides linked above. About A static verifier for Rust, based on the Viper verification infrastructure. prusti.org Topics rust verification viper formal-verification Resources Readme License View license Stars 917 stars Watchers 15 watching Forks 67 forks Releases 8 Release v-2022-10-05-0726 Latest Oct 5, 2022 + 7 releases Used by 70 * @Ramla-I * @viperproject * @dewert99 * @rmehri01 * @zhoudongxu * @mohammadhossam * @mlimbeck * @Omar0Tarek + 62 Contributors 47 * @fpoli * @vakaras * @bors[bot] * @Aurel300 * @JonasAlaif * @vl0w * @cmatheja * @dario23 * @juliand665 * @zgrannan * @Pointerbender + 36 contributors Languages * Rust 95.0% * Shell 4.3% * Other 0.7% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.