pub struct Formula { /* private fields */ }Implementations§
Source§impl Formula
impl Formula
pub fn new(clauses: BTreeSet<Clause>, shared: BTreeSet<Clause>) -> Self
pub fn with_clause(clause: Clause) -> Self
pub fn with_clauses(clauses: impl IntoIterator<Item = Clause>) -> Self
pub fn is_empty(&self) -> bool
pub fn first(&self) -> &Clause
pub fn is_subset(&self, other: &Formula) -> bool
pub fn into_inner(self) -> (BTreeSet<Clause>, BTreeSet<Clause>)
pub fn elements(&self) -> &BTreeSet<Clause>
pub fn merge(self, other: Formula) -> Self
pub fn len(&self) -> usize
Sourcepub fn normalize(self) -> Self
pub fn normalize(self) -> Self
Normalize a formula.
For any formula, we define a normal form which exists, is unique, and is equivalent to the original formula under the usual interpretation of boolean logic.
Clauses are always normal, since all literals are positive. Formulae are normalized by removing any clause subsumed by any other. A clause c is subsumed by a clause s if s <= c. This is the obvious O(mn) algorithm. Our formulae are usually of size 1, so this is just fine.
Trait Implementations§
Source§impl Ord for Formula
note: we rely on this ordering when building the dag
impl Ord for Formula
note: we rely on this ordering when building the dag
Source§impl PartialOrd for Formula
impl PartialOrd for Formula
impl Eq for Formula
Auto Trait Implementations§
impl Freeze for Formula
impl RefUnwindSafe for Formula
impl Send for Formula
impl Sync for Formula
impl Unpin for Formula
impl UnwindSafe for Formula
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more