Trait modus_lib::builtin::BuiltinPredicate
source · [−]pub trait BuiltinPredicate {
fn name(&self) -> &'static str;
fn kind(&self) -> Kind;
fn arg_groundness(&self) -> &'static [bool];
fn apply(&self, lit: &Literal) -> Option<Literal>;
fn select(&self, lit: &Literal) -> SelectBuiltinResult { ... }
}
Required methods
The kind of this predicate or operator. Should match https://github.com/modus-continens/docs/blob/main/src/library/README.md
fn arg_groundness(&self) -> &'static [bool]
fn arg_groundness(&self) -> &'static [bool]
Return if the argument is allowed to be ungrounded. This means that a “false” here will force a constant.
Return a new literal specifically constructed to unify with the input literal. The returned literal will essentially be used as the head of a new “hidden” rule, which will hopefully unify with the input literal. The rule will contain no body literals.
For example, the implementation of run should simply return the input literal, after checking that it only contains a constant. (Returning any unresolved variables can make the actual generation of build instructions impossible)
Renaming will not be done on this literal, so if variables are needed they must all be either auxillary or some existing variables from the input.