Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sarsko committed Apr 10, 2024
1 parent 45de756 commit 4d653b9
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions NewDB/src/assignments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ impl ShallowModel for Assignments {
type ShallowModelTy = Seq<AssignedState>;

#[open]
#[logic]
#[logic]
fn shallow_model(self) -> Self::ShallowModelTy {
self.0.shallow_model()
}
}

impl Assignments {
#[open]
#[predicate]
#[predicate]
pub fn invariant(self) -> bool {
pearlite! {
forall<i: Int> 0 <= i && i < self@.len() ==>
Expand Down
14 changes: 7 additions & 7 deletions NewDB/src/clause_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ pub(crate) struct ClauseAllocator {

impl ClauseAllocator {
#[open]
#[logic]
#[logic]
//#[ensures(forall<i: Int> 0 <= i && i < (self@.buffer).len() ==> (self@.buffer)[i] == (result@.buffer)[i])]
//#[ensures(result@.num_vars == self.num_vars@)]
pub(crate) fn push(self, lit: Lit) -> Self {
self
}

#[open]
#[predicate]
#[predicate]
pub(crate) fn extended(self, new: ClauseAllocator) -> bool {
pearlite! {
forall<i: Int> 0 <= i && i < self.buffer@.len() ==> self.buffer@[i] == new.buffer@[i]
Expand All @@ -61,13 +61,13 @@ impl ClauseAllocator {

impl ClauseAllocator {
#[open]
#[predicate]
#[predicate]
pub(crate) fn invariant(self) -> bool {
pearlite! { self@.len() <= u32::MAX@ }
}

#[open]
#[logic]
#[logic]
//#[requires(cref_invariant(cref, self))]
pub(crate) fn get_clause_logic(self, cref: Int) -> Seq<Lit> {
pearlite! {
Expand All @@ -76,7 +76,7 @@ impl ClauseAllocator {
}

#[open]
#[logic]
#[logic]
//#[requires(cref_invariant(cref, self))]
pub(crate) fn get_clause_fset(self, cref: Int) -> FSet<Lit> {
pearlite! {
Expand All @@ -85,7 +85,7 @@ impl ClauseAllocator {
}

#[open]
#[logic]
#[logic]
//#[requires(cref_invariant(cref, self))]
#[variant(upper - idx)]
#[requires(idx >= 0 && upper <= self@.len())]
Expand All @@ -106,7 +106,7 @@ impl ShallowModel for ClauseAllocator {
type ShallowModelTy = Seq<Lit>;

#[open]
#[logic]
#[logic]
fn shallow_model(self) -> Self::ShallowModelTy {
self.buffer.shallow_model()
}
Expand Down
2 changes: 1 addition & 1 deletion NewDB/src/clause_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct ClauseManager {

impl ClauseManager {
#[open]
#[predicate]
#[predicate]
pub(crate) fn invariant(self) -> bool {
pearlite! {
self.clause_allocator.invariant()
Expand Down
6 changes: 3 additions & 3 deletions NewDB/src/cref_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ impl ShallowModel for CRefManager {
type ShallowModelTy = Seq<CRef>;

#[open]
#[logic]
#[logic]
fn shallow_model(self) -> Self::ShallowModelTy {
self.crefs.shallow_model()
}
}

impl CRefManager {
#[open]
#[predicate]
#[predicate]
pub(crate) fn invariant(self, clause_allocator: ClauseAllocator) -> bool {
pearlite! {
clause_allocator.invariant()
Expand All @@ -35,7 +35,7 @@ impl CRefManager {
}

#[open]
#[predicate]
#[predicate]
pub(crate) fn are_implied_by(self, original_clauses: CRefManager, clause_allocator: ClauseAllocator) -> bool {
pearlite! {
let formula = Formula::from(self@, clause_allocator, self.num_vars@);
Expand Down
12 changes: 6 additions & 6 deletions NewDB/src/formula.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn abs_just_inner(self, just: Seq<usize>, ix: Int) -> FSet<(theory::Term, th
impl Formula {
// TODO: Look at actually implementing from
#[open]
#[logic]
#[logic]
#[requires(clause_allocator.invariant())]
#[requires(forall<i: Int> 0 <= i && i < crefs.len() ==>
cref_invariant(crefs[i]@, clause_allocator, num_vars))] // CRefManager.invariant unwrapped -> TODO: refactor?
Expand All @@ -46,13 +46,13 @@ impl Formula {
}

#[open]
#[logic]
#[logic]
fn insert(self, clause: FSet<Lit>) -> Formula {
Formula { formula: self.formula.insert(clause), num_vars: self.num_vars }
}

#[open]
#[logic]
#[logic]
//#[variant((clause@_allocator).len() - idx)]
#[variant(crefs.len() - idx)]
#[requires(idx >= 0)]
Expand All @@ -75,15 +75,15 @@ impl Formula {
}

#[open]
#[predicate]
#[predicate]
pub(crate) fn implies(self, clause: FSet<Lit>) -> bool {
pearlite! {
self.eventually_sat_complete() ==> self.insert(clause).eventually_sat_complete()
}
}

#[open]
#[predicate]
#[predicate]
pub(crate) fn eventually_sat_complete(self) -> bool {
pearlite! {
exists<a: Seq<AssignedState>> a.len() == self.num_vars
Expand All @@ -93,7 +93,7 @@ impl Formula {
}

#[open]
#[predicate]
#[predicate]
pub(crate) fn sat(self, a: Seq<AssignedState>) -> bool {
pearlite! {
forall<c: _> self.formula.contains(c) ==> clause_sat(c, a)
Expand Down
12 changes: 6 additions & 6 deletions NewDB/src/friday.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct Pasn {

impl Assignments {
#[open]
#[predicate]
#[predicate]
fn compatible(self, pa: Pasn) -> bool {
pearlite! {
self.invariant() &&
Expand All @@ -31,7 +31,7 @@ pub struct Formula {

impl Formula {
#[open]
#[predicate]
#[predicate]
fn invariant(self) -> bool {
pearlite! {
forall<i: Int> 0 <= i && i < self.clauses@.len() ==>
Expand All @@ -40,7 +40,7 @@ impl Formula {
}

#[open]
#[predicate]
#[predicate]
fn sat(self, a: Assignments) -> bool {
pearlite! {
forall<i: Int> 0 <= i && i < self.clauses@.len() ==>
Expand All @@ -51,7 +51,7 @@ impl Formula {

impl Clause {
#[open]
#[predicate]
#[predicate]
fn vars_in_range(self, n: Int) -> bool {
pearlite! {
forall<i: Int> 0 <= i && i < self.0@.len() ==>
Expand All @@ -62,7 +62,7 @@ impl Clause {

impl Pasn {
#[open]
#[predicate]
#[predicate]
fn invariant(self, n: Int) -> bool {
pearlite! {
self.ix@ <= self.assign.0@.len()
Expand All @@ -74,7 +74,7 @@ impl Pasn {

impl Clause {
#[open]
#[predicate]
#[predicate]
fn clause_sat_logic(self, a: Assignments) -> bool {
pearlite! {
exists<i: Int> 0 <= i && i < self.0@.len() &&
Expand Down
10 changes: 5 additions & 5 deletions NewDB/src/lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ pub struct Lit {

impl Lit {
#[open]
#[logic]
#[logic]
#[why3::attr = "inline:trivial"]
pub fn index_logic(self) -> Int {
pearlite! { self.code@ / 2 }
}

#[open]
#[logic]
#[logic]
#[why3::attr = "inline:trivial"]
pub fn is_positive_logic(self) -> bool {
pearlite! { self.code@ % 2 == 0 }
Expand All @@ -29,15 +29,15 @@ impl Lit {

impl Lit {
#[open]
#[predicate]
#[predicate]
pub(crate) fn var_in_range(self, n: Int) -> bool {
pearlite! {
self.index_logic() < n
}
}

#[open]
#[predicate]
#[predicate]
#[why3::attr = "inline:trivial"]
pub(crate) fn lit_sat_logic(self, a: Assignments) -> bool {
pearlite! {
Expand All @@ -47,7 +47,7 @@ impl Lit {

// This is the one that is supposed to stay
#[open]
#[predicate]
#[predicate]
#[why3::attr = "inline:trivial"]
pub(crate) fn sat(self, a: Seq<AssignedState>) -> bool {
pearlite! {
Expand Down
4 changes: 2 additions & 2 deletions Robinson/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ extern crate creusot_contracts;
use creusot_contracts::*;

#[predicate]
#[open]//#[open(self)]
#[open] //#[open(self)]
pub fn sorted_range_rev(s: Seq<(usize, usize)>, l: Int, u: Int) -> bool {
pearlite! {
forall<i: Int, j: Int> l <= i && i < j && j < u ==> s[i].0 >= s[j].0
}
}

#[predicate]
#[open]//#[open(self)]
#[open] //#[open(self)]
pub fn sorted_rev(s: Seq<(usize, usize)>) -> bool {
sorted_range_rev(s, 0, s.len())
}
Expand Down

0 comments on commit 4d653b9

Please sign in to comment.