pub struct PureLiteralElimination;Expand description
Preprocessor for Pure Literal Elimination.
A pure literal is a literal that appears in the formula with only one polarity
(e.g. x appears but !x does not, or vice versa).
If a literal l is pure:
- All clauses containing
lcan be satisfied by settinglto true. These clauses can be removed. - Literals that are pure do not need to be part of the simplified formula sent to the solver, as their assignment is determined.
This implementation removes clauses containing any pure literal.
Implementations§
Source§impl PureLiteralElimination
impl PureLiteralElimination
Sourcepub fn find_pures<L: Literal, S: LiteralStorage<L>>(
cnf: &[Clause<L, S>],
) -> FxHashSet<L>
pub fn find_pures<L: Literal, S: LiteralStorage<L>>( cnf: &[Clause<L, S>], ) -> FxHashSet<L>
Finds all pure literals in the given CNF formula.
A literal l is pure if its negation !l does not appear in any clause
while l itself does appear.
The complexity is roughly proportional to the total number of literals in the CNF.
§Arguments
cnf: A slice ofClause<L, S>.
§Returns
A FxHashSet<L> containing all pure literals found.
Trait Implementations§
Source§impl Clone for PureLiteralElimination
impl Clone for PureLiteralElimination
Source§fn clone(&self) -> PureLiteralElimination
fn clone(&self) -> PureLiteralElimination
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PureLiteralElimination
impl Debug for PureLiteralElimination
Source§impl Default for PureLiteralElimination
impl Default for PureLiteralElimination
Source§fn default() -> PureLiteralElimination
fn default() -> PureLiteralElimination
Returns the “default value” for a type. Read more
Source§impl PartialEq for PureLiteralElimination
impl PartialEq for PureLiteralElimination
Source§impl<L: Literal, S: LiteralStorage<L>> Preprocessor<L, S> for PureLiteralElimination
impl<L: Literal, S: LiteralStorage<L>> Preprocessor<L, S> for PureLiteralElimination
Source§fn preprocess(&self, cnf: &[Clause<L, S>]) -> Vec<Clause<L, S>>
fn preprocess(&self, cnf: &[Clause<L, S>]) -> Vec<Clause<L, S>>
Applies pure literal elimination.
- Finds all pure literals in the
cnf. - Removes all clauses that contain any of these pure literals.
(Assigning a pure literal
lto true satisfies any clause containingl.)
The complexity is dominated by find_pures and iterating through clauses again.
impl Copy for PureLiteralElimination
impl Eq for PureLiteralElimination
impl StructuralPartialEq for PureLiteralElimination
Auto Trait Implementations§
impl Freeze for PureLiteralElimination
impl RefUnwindSafe for PureLiteralElimination
impl Send for PureLiteralElimination
impl Sync for PureLiteralElimination
impl Unpin for PureLiteralElimination
impl UnwindSafe for PureLiteralElimination
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<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