[][src]Struct libprop_sat_solver::tableaux_solver::theory::Theory

pub struct Theory { /* fields omitted */ }

A Theory is a set of alternative PropositionalFormulas.

It corresponds to one particular branch of the tableau tree.

Methods

impl Theory[src]

pub fn new() -> Self[src]

Construct an empty theory.

pub fn from_propositional_formula(formula: PropositionalFormula) -> Self[src]

Construct a Theory from a given propositional formula.

pub fn formulas(&self) -> impl Iterator<Item = &PropositionalFormula>[src]

Get the formulas.

pub fn add(&mut self, formula: PropositionalFormula)[src]

Add a propositional formula to the theory iff the theory does not already contain the formula.

pub fn is_fully_expanded(&self) -> bool[src]

Checks if the Theory is fully expanded, i.e. each propositional_formula in the given Theory is a literal (e.g. p, -(p), a propositional variable or its negation).

pub fn has_contradictions(&self) -> bool[src]

Checks if a Theory contains contradictions. That is, if the Theory contains a literal p AND its negation -p.

Space and Time Complexity

This function uses a HashMap (specifically, a map from some &str to the tuple (has_literal, has_negation): (bool, bool). As soon as we encounter the case where has_literal && has_negation then we have found a contradiction.

  • Worst-case time complexity: O(n) because we iterate through all of the formulas for the given theory.
  • Worst-case space complexity: O(k) for k propositional variables appearing in literals.

pub fn get_non_literal_formula(&mut self) -> Option<PropositionalFormula>[src]

Get a non-literal formula (not a propositional variable or its negation) from the current Theory.

pub fn swap_formula(
    &mut self,
    existing: &PropositionalFormula,
    replacement: PropositionalFormula
)
[src]

Replace existing formula with a new formula.

pub fn swap_formula2(
    &mut self,
    existing: &PropositionalFormula,
    replacements: (PropositionalFormula, PropositionalFormula)
)
[src]

Replace existing formula with two new formulas.

Trait Implementations

impl Clone for Theory[src]

impl Debug for Theory[src]

impl PartialEq<Theory> for Theory[src]

impl StructuralPartialEq for Theory[src]

Auto Trait Implementations

impl RefUnwindSafe for Theory

impl Send for Theory

impl Sync for Theory

impl Unpin for Theory

impl UnwindSafe for Theory

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.