-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update strategies + init Scratch + update README
- Loading branch information
Showing
30 changed files
with
6,055 additions
and
2,242 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,4 @@ trust_util = [] | |
trust_util_logic = [] | ||
trust_watches = [] | ||
trust_watches_logic = [] | ||
problem_child = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
[package] | ||
name = "Scratch" | ||
version = "0.1.0" | ||
authors = ["Sarek Høverstad Skotåm <sarek.skotam@gmail.com>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
clap = "2.33.3" | ||
creusot-contracts = { git = "https://github.com/xldenis/creusot", version = "^0", rev = "6a963bf" } | ||
|
||
# This is just copied verbatim from CreuSAT. | ||
[features] | ||
trust_all = [ | ||
"trust_assignments", | ||
"trust_clause", | ||
"trust_conflict", | ||
"trust_decision", | ||
"trust_formula", | ||
"trust_lit", | ||
"trust_solver", | ||
"trust_trail", | ||
"trust_unit", | ||
"trust_util", | ||
"trust_watches", | ||
"trust_logic", | ||
] | ||
trust_logic = [ | ||
"trust_clause_logic", | ||
"trust_conflict_logic", | ||
"trust_decision_logic", | ||
"trust_formula_logic", | ||
"trust_lit_logic", | ||
"trust_solver_logic", | ||
"trust_trail_logic", | ||
"trust_unit_logic", | ||
"trust_util_logic", | ||
"trust_watches_logic", | ||
"trust_logic_logic", | ||
] | ||
trust_assignments = [] | ||
trust_assignments_logic = [] | ||
trust_clause = [] | ||
trust_clause_logic = [] | ||
trust_conflict = ["trust_conflict_logic"] | ||
trust_conflict_logic = [] | ||
trust_decision = [] | ||
trust_decision_logic = [] | ||
trust_formula = ["trust_formula_logic"] | ||
trust_formula_logic = [] | ||
trust_lit = ["trust_lit_logic"] | ||
trust_lit_logic = [] | ||
trust_logic_logic = [] | ||
trust_solver = [] | ||
trust_solver_logic = [] | ||
trust_trail = ["trust_trail_logic"] | ||
trust_trail_logic = [] | ||
trust_unit = [] | ||
trust_unit_logic = [] | ||
trust_util = [] | ||
trust_util_logic = [] | ||
trust_watches = [] | ||
trust_watches_logic = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Scratch | ||
|
||
This is a scratch space for me to experiment with ideas. It is likely to be removed once those ideas are worked out. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
extern crate creusot_contracts; | ||
use creusot_contracts::std::*; | ||
use creusot_contracts::*; | ||
|
||
#[cfg(creusot)] | ||
use crate::logic::*; | ||
|
||
use crate::formula::*; | ||
|
||
// ===== Assignments ===== | ||
pub type AssignedState = u8; | ||
|
||
pub struct Assignments(pub Vec<AssignedState>); | ||
|
||
#[cfg(creusot)] | ||
impl ShallowModel for Assignments { | ||
type ShallowModelTy = Seq<AssignedState>; | ||
|
||
#[logic] | ||
fn shallow_model(self) -> Self::ShallowModelTy { | ||
self.0.shallow_model() | ||
} | ||
} | ||
|
||
#[predicate] | ||
pub fn compatible_inner(a: Seq<AssignedState>, a2: Seq<AssignedState>) -> bool { | ||
pearlite! { | ||
a.len() == a2.len() && (forall<i: Int> 0 <= i && i < a.len() ==> | ||
(unset(a[i]) || a[i] == a2[i])) | ||
} | ||
} | ||
|
||
#[predicate] | ||
pub fn complete_inner(a: Seq<AssignedState>) -> bool { | ||
pearlite! { | ||
forall<i: Int> 0 <= i && i < a.len() ==> !unset(a[i]) | ||
} | ||
} | ||
|
||
#[predicate] | ||
pub fn compatible_complete_inner(a: Seq<AssignedState>, a2: Seq<AssignedState>) -> bool { | ||
compatible_inner(a, a2) && complete_inner(a2) | ||
} | ||
|
||
// Predicates | ||
impl Assignments { | ||
#[predicate] | ||
pub fn invariant(self, f: Formula) -> bool { | ||
pearlite! { | ||
@f.num_vars == (@self).len() | ||
&& forall<i : Int> 0 <= i && i < (@self).len() ==> @(@self)[i] <= 3 | ||
} | ||
} | ||
|
||
#[predicate] | ||
pub fn complete(self) -> bool { | ||
pearlite! { | ||
forall<i: Int> 0 <= i && i < (@self).len() ==> !unset((@self)[i]) | ||
} | ||
} | ||
} |
Oops, something went wrong.