[−][src]Struct libprop_sat_solver::tableaux_solver::theory::Theory
A Theory
is a set of alternative PropositionalFormula
s.
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)
fork
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]
&mut self,
existing: &PropositionalFormula,
replacement: PropositionalFormula
)
Replace existing formula with a new formula.
pub fn swap_formula2(
&mut self,
existing: &PropositionalFormula,
replacements: (PropositionalFormula, PropositionalFormula)
)
[src]
&mut self,
existing: &PropositionalFormula,
replacements: (PropositionalFormula, PropositionalFormula)
)
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,