Enum cop::fof::Fof

source ·
pub enum Fof<A, V> {
    Atom(A),
    Neg(Box<Fof<A, V>>),
    Bin(Box<Fof<A, V>>, Op, Box<Fof<A, V>>),
    BinA(OpA, Vec<Fof<A, V>>),
    Quant(Quantifier, V, Box<Fof<A, V>>),
}
Expand description

Full first-order formula over atoms A and variables V.

Variants§

§

Atom(A)

atom

§

Neg(Box<Fof<A, V>>)

negation

§

Bin(Box<Fof<A, V>>, Op, Box<Fof<A, V>>)

binary operation

§

BinA(OpA, Vec<Fof<A, V>>)

associative binary operation

§

Quant(Quantifier, V, Box<Fof<A, V>>)

quantification

Implementations§

source§

impl<P: Clone, C: Clone> Fof<FofAtom<P, C, usize>, usize>

source

pub fn eq_constant(c: &C, arity: usize) -> Option<Self>

Produce the substitution axiom for the given constant of arity.

source

pub fn eq_predicate(p: &P, arity: usize) -> Option<Self>

Produce the substitution axiom for the given predicate of arity.

source

pub fn eq_axioms(preds: Vec<(&P, usize)>, consts: Vec<(&C, usize)>) -> Self

Produce equality axioms from a sequence of predicates and constants.

Assume that p1, ..., pn and c1, ..., cm are substitution axioms for the given predicates and constants. Then the final output will be ((refl & sym & trans) & p1 & ... & pn) & c1 & ... & cm, where the conjunction is associated to the right.

source§

impl<A, V> Fof<A, V>

source

pub fn bin(l: Self, o: Op, r: Self) -> Self

Apply a binary operation to two formulas.

source

pub fn bina(l: Self, o: OpA, r: Self) -> Self

Apply an associative binary operation to two formulas.

If r is itself an application of o, then l is simply added to r. For example, if o is conjunction and r is a & b, then the result is l & a & b, not l & (a & b).

source

pub fn binas(o: OpA, fms: impl DoubleEndedIterator<Item = Self>) -> Self

For formulas f1, .., fn, return f1 o (… o fn).

source

pub fn imp(l: Self, r: Self) -> Self

Create the implication from l to r.

source

pub fn quant(q: Quantifier, v: V, fm: Self) -> Self

Create a quantification.

source

pub fn forall(v: V, fm: Self) -> Self

Create a universal quantification.

source

pub fn foralls(vs: impl Iterator<Item = V>, fm: Self) -> Self

Universally quantify over a sequence of variables.

source

pub fn add_premise(self, premise: Self) -> Self

If self is of shape a => b, then return premise & a => b, else premise => self.

source

pub fn mark_impl(self, fm: impl Fn() -> Self) -> (bool, Self)

If self is of shape a => c, then return a & fm() => fm() & c, else self.

Also return whether self is an implication, i.e. whether the output formula does not equal self.

source

pub fn map_atoms<B>(self, f: &mut impl FnMut(A) -> B) -> Fof<B, V>

Apply a function to all atoms.

source

pub fn map_vars<W>(self, f: &mut impl FnMut(V) -> W) -> Fof<A, W>

Apply a function to all variables.

source

pub fn atoms(&self) -> Box<dyn Iterator<Item = &A> + '_>

Return all atoms occurring in the formula.

source§

impl<P, C, V> Fof<FofAtom<P, C, V>, V>

source

pub fn atom(p: P, args: Args<Term<C, V>>) -> Self

Construct an atom.

source

pub fn eqtm(l: Term<C, V>, r: Term<C, V>) -> Self

Construct an equality between two terms.

source§

impl<A: Clone + Neg<Output = A>, V: Clone> Fof<A, V>

source

pub fn qnnf( self, f: &impl Fn(bool, Self, Op, Self) -> Self ) -> Nnf<A, V, Quantifier>

Convert to NNF, replacing non-associative binary operations via function.

source

pub fn unfold_eqfm_disj_conj(pol: bool, l: Self, op: Op, r: Self) -> Self

Unfold logical equivalence with a disjunction of conjunctions.

Used in (nondefinitional) leanCoP.

source

pub fn unfold_eqfm_conj_impl(pol: bool, l: Self, op: Op, r: Self) -> Self

Unfold logical equivalence with a conjunction of implications.

Used in nanoCoP.

source§

impl<P: Eq, C: Eq, V> Fof<FofAtom<P, C, V>, V>

source

pub fn predconst_unique(&self) -> (Vec<(&P, usize)>, Vec<(&C, usize)>)

Corresponds to leanCoP’s collect_predfunc.

Trait Implementations§

source§

impl<A, V> BitAnd<Fof<A, V>> for Fof<A, V>

§

type Output = Fof<A, V>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: Self) -> Self

Performs the & operation. Read more
source§

impl<A, V> BitOr<Fof<A, V>> for Fof<A, V>

§

type Output = Fof<A, V>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
source§

impl<A: Clone, V: Clone> Clone for Fof<A, V>

source§

fn clone(&self) -> Fof<A, V>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A: Debug, V: Debug> Debug for Fof<A, V>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Atom: Display, V: Display> Display for Fof<Atom, V>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<A, V> Neg for Fof<A, V>

§

type Output = Fof<A, V>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<A: PartialEq, V: PartialEq> PartialEq<Fof<A, V>> for Fof<A, V>

source§

fn eq(&self, other: &Fof<A, V>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A: Eq, V: Eq> Eq for Fof<A, V>

source§

impl<A, V> StructuralEq for Fof<A, V>

source§

impl<A, V> StructuralPartialEq for Fof<A, V>

Auto Trait Implementations§

§

impl<A, V> RefUnwindSafe for Fof<A, V>where A: RefUnwindSafe, V: RefUnwindSafe,

§

impl<A, V> Send for Fof<A, V>where A: Send, V: Send,

§

impl<A, V> Sync for Fof<A, V>where A: Sync, V: Sync,

§

impl<A, V> Unpin for Fof<A, V>where A: Unpin, V: Unpin,

§

impl<A, V> UnwindSafe for Fof<A, V>where A: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, R> Rewind<PutRewind<T, R>> for Twhere T: Rewind<R>,

source§

fn rewind(&mut self, state: PutRewind<T, R>)

Rewind to some state.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.