Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lithium: a Rust-native back end #1321

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0928308
Add Lithium back end
JakuJ Feb 21, 2023
6821cff
Add Lithium to VerificationBackend enum
JakuJ Feb 21, 2023
eb4c416
Fix simple branching (if-statements in low vir)
JakuJ Feb 21, 2023
daceb78
Wonky way of reporting offending positions
JakuJ Feb 22, 2023
35843ff
Fix branching assumptions for switchInt
JakuJ Feb 22, 2023
74b090f
Fix "otherwise" branch of switchInt statements
JakuJ Feb 22, 2023
f6e7e11
Fix after rebase
JakuJ Feb 23, 2023
33fe480
Add tests for loops, remove empty Conditional statements
JakuJ Feb 27, 2023
e3cb301
Fix mod operator
JakuJ Feb 28, 2023
c68d489
Add initial F32 and F64 support
JakuJ Mar 1, 2023
9caacd3
Use FP operators, choose correct type declaration
JakuJ Mar 1, 2023
412772f
Tests for floating-point support
JakuJ Mar 1, 2023
9f3b962
Add preamble for CVC5, split fp.neq into 32 and 64-bit variants
JakuJ Mar 18, 2023
f69cb0b
Fixes after merge
JakuJ Mar 20, 2023
62f4a9b
Quantifiers to snapshots, fix unsized type bound checking bug
JakuJ Mar 22, 2023
08c1e9e
Hack quantifier generation for complex types
JakuJ Mar 28, 2023
d195597
Fix after rebase
JakuJ Apr 11, 2023
ada6736
Fix lowering for quantifiers that use closures over function arguments
JakuJ Apr 11, 2023
6370a93
Add sum-of-primes test file
JakuJ Apr 18, 2023
64d8cd2
Add super sale test case
JakuJ Apr 19, 2023
fda0031
Update test cases
JakuJ Apr 25, 2023
15579d1
Add Euclid test case, fix quantifiers type mismatch
JakuJ Apr 26, 2023
fcfeda2
Optimization module
JakuJ Apr 26, 2023
9a6c479
Correct reporting of failure reason positions
JakuJ May 3, 2023
4585665
Remove redundant reasons for failure if the same as failing place
JakuJ May 3, 2023
4b5e026
FP != for Viper
JakuJ May 5, 2023
ddddb3a
Passing FP test case
JakuJ May 5, 2023
c36a25d
Remove main.rs from Lithium
JakuJ May 31, 2023
9b08400
Commit the config
JakuJ Jun 4, 2023
c8a4d51
Use files, not stdio, fix negative int encoding
JakuJ Jun 13, 2023
4e368ac
Make clippy happy
JakuJ Jun 13, 2023
9ad4f34
cargo fmt
JakuJ Jun 13, 2023
614ebc1
More cargo fmt
JakuJ Jun 13, 2023
fc2e056
Increase SMT timeout, comment out problematic code in error_manager
JakuJ Jun 13, 2023
41bbaaa
Fix abs(i32::MIN) overflowing
JakuJ Jun 14, 2023
6f3ffcc
Refactor encoding of Statement::Conditional
JakuJ Jun 14, 2023
25ee57b
Fix invalid file paths when emitting SMT files
JakuJ Jun 14, 2023
6fedb19
Fix quantifier optimization rules
JakuJ Jun 16, 2023
56c0678
Various bugfixes
JakuJ Jun 18, 2023
f7bec36
Make sure positions are preserved by the optimizer
JakuJ Jun 19, 2023
bc085e4
Add bisect test case
JakuJ Jun 19, 2023
1ad0fbe
Remove overcomplicated tests
JakuJ Jun 19, 2023
d97b664
Fix test error placement
JakuJ Jun 22, 2023
8e18928
Clean up SMT preambles, fix modulo operator encoding
JakuJ Jun 23, 2023
6a216fe
Add Lithium test coverage script
JakuJ Jun 23, 2023
18db007
Fixes after merging master
JakuJ Jul 20, 2023
dce49bb
Make clippy happy
JakuJ Jul 20, 2023
9ba703d
Fix test compilation error
JakuJ Jul 20, 2023
18bc02f
Restore config
JakuJ Aug 18, 2023
9aed8af
Fixes after rebase
JakuJ Sep 1, 2023
8372022
Clippy
JakuJ Sep 1, 2023
000c701
Fix stopwatch getting released immediately
JakuJ Oct 27, 2023
cb38222
Merge branch 'master' into lithium
JakuJ Oct 27, 2023
09066e1
Add PRUSTI_NATIVE_VERIFIER env variable
JakuJ Oct 27, 2023
7664629
Restore test case unrelated to Lithium
JakuJ Oct 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ callgrind.*
core
report.csv
*.profraw
.DS_Store

*.lock
!/Cargo.lock
Expand Down
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions backend-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "backend-common"
version = "0.1.0"
authors = ["Prusti Devs <prusti_developers@sympa.ethz.ch>"]
edition = "2021"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
rustc-hash = "1.1.0"
vir = { path = "../vir" }
File renamed without changes.
5 changes: 5 additions & 0 deletions backend-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod verification_result;
mod java_exception;
mod silicon_counterexample;

pub use crate::{java_exception::*, silicon_counterexample::*, verification_result::*};
69 changes: 69 additions & 0 deletions backend-common/src/silicon_counterexample.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
use rustc_hash::FxHashMap;

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct SiliconCounterexample {
//pub heap: Heap,
//pub old_heaps: FxHashMap<String, Heap>,
pub model: Model,
pub functions: Functions,
pub domains: Domains,
pub old_models: FxHashMap<String, Model>,
// label_order because HashMaps do not guarantee order of elements
// whereas the Map used in scala does guarantee it
pub label_order: Vec<String>,
}

// Model Definitions
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Model {
pub entries: FxHashMap<String, ModelEntry>,
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum ModelEntry {
LitInt(String),
LitFloat(String),
LitBool(bool),
LitPerm(String),
Ref(String, FxHashMap<String, ModelEntry>),
NullRef(String),
RecursiveRef(String),
Var(String),
Seq(String, Vec<ModelEntry>),
Other(String, String),
DomainValue(String, String),
UnprocessedModel, //used for Silicon's Snap type
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Functions {
pub entries: FxHashMap<String, FunctionEntry>,
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct FunctionEntry {
pub options: Vec<(Vec<Option<ModelEntry>>, Option<ModelEntry>)>,
pub default: Option<ModelEntry>,
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Domains {
pub entries: FxHashMap<String, DomainEntry>,
}

#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DomainEntry {
pub functions: Functions,
}

impl FunctionEntry {
/// Given a vec of params it finds the correct entry in a function.
pub fn get_function_value(&self, params: &Vec<Option<ModelEntry>>) -> &Option<ModelEntry> {
for option in &self.options {
if &option.0 == params {
return &option.1;
}
}
&None
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

use crate::{silicon_counterexample::SiliconCounterexample, JavaException};
use crate::{JavaException, SiliconCounterexample};

/// The result of a verification request on a Viper program.
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
Expand Down Expand Up @@ -57,21 +57,3 @@ impl VerificationError {
}
}
}

/// The consistency error reported by the verifier.
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct ConsistencyError {
/// To which method corresponds the program that triggered the error.
pub method: String,
/// The actual error.
pub error: String,
}

/// The Java exception reported by the verifier.
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct JavaExceptionWithOrigin {
/// To which method corresponds the program that triggered the exception.
pub method: String,
/// The actual exception.
pub exception: JavaException,
}
20 changes: 20 additions & 0 deletions native-verifier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "native-verifier"
version = "0.1.0"
authors = ["Prusti Devs <prusti_developers@sympa.ethz.ch>"]
edition = "2021"
readme = "README.md"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
log = { version = "0.4", features = ["release_max_level_info"] }
error-chain = "0.12"
uuid = { version = "1.0", features = ["v4"] }
serde = { version = "1.0", features = ["derive"] }
prusti-common = { path = "../prusti-common" }
backend-common = { path = "../backend-common" }
prusti-utils = { path = "../prusti-utils" }
vir = { path = "../vir" }
lazy_static = "1.4"
regex = "1.7.1"
Loading
Loading