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>
impl<P: Clone, C: Clone> Fof<FofAtom<P, C, usize>, usize>
sourcepub fn eq_constant(c: &C, arity: usize) -> Option<Self>
pub fn eq_constant(c: &C, arity: usize) -> Option<Self>
Produce the substitution axiom for the given constant of arity.
sourcepub fn eq_predicate(p: &P, arity: usize) -> Option<Self>
pub fn eq_predicate(p: &P, arity: usize) -> Option<Self>
Produce the substitution axiom for the given predicate of arity.
sourcepub fn eq_axioms(preds: Vec<(&P, usize)>, consts: Vec<(&C, usize)>) -> Self
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>
impl<A, V> Fof<A, V>
sourcepub fn bina(l: Self, o: OpA, r: Self) -> Self
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)
.
sourcepub fn binas(o: OpA, fms: impl DoubleEndedIterator<Item = Self>) -> Self
pub fn binas(o: OpA, fms: impl DoubleEndedIterator<Item = Self>) -> Self
For formulas f1, .., fn, return f1 o (… o fn).
sourcepub fn quant(q: Quantifier, v: V, fm: Self) -> Self
pub fn quant(q: Quantifier, v: V, fm: Self) -> Self
Create a quantification.
sourcepub fn foralls(vs: impl Iterator<Item = V>, fm: Self) -> Self
pub fn foralls(vs: impl Iterator<Item = V>, fm: Self) -> Self
Universally quantify over a sequence of variables.
sourcepub fn add_premise(self, premise: Self) -> Self
pub fn add_premise(self, premise: Self) -> Self
If self
is of shape a => b
, then return premise & a => b
, else premise => self
.
sourcepub fn mark_impl(self, fm: impl Fn() -> Self) -> (bool, Self)
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
.
sourcepub fn map_atoms<B>(self, f: &mut impl FnMut(A) -> B) -> Fof<B, V>
pub fn map_atoms<B>(self, f: &mut impl FnMut(A) -> B) -> Fof<B, V>
Apply a function to all atoms.
source§impl<A: Clone + Neg<Output = A>, V: Clone> Fof<A, V>
impl<A: Clone + Neg<Output = A>, V: Clone> Fof<A, V>
sourcepub fn qnnf(
self,
f: &impl Fn(bool, Self, Op, Self) -> Self
) -> Nnf<A, V, Quantifier>
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.
sourcepub fn unfold_eqfm_disj_conj(pol: bool, l: Self, op: Op, r: Self) -> Self
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.
sourcepub fn unfold_eqfm_conj_impl(pol: bool, l: Self, op: Op, r: Self) -> Self
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.