Skip to main content

Predicate

An abstract class in Root.Township, Alta.Intelligence.

Base for a logic term in the AI knowledge system: a functor with argument terms that is evaluated against a KnowledgeHolder to produce weighted results. Operators combine predicates.

Constructors​

MemberWhat it is
Predicate(BaseAtom functor, params ITerm[] terms)Creates a Predicate from functor and terms.

Properties​

MemberWhat it is
BaseAtom Functor { get; private set; }The predicate's head atom.
ITerm[] Terms { get; private set; }The predicate's arguments.
2 private and internal properties
MemberWhat it is
private ITerm Alta.Intelligence.ICompoundPart.First { get; }The functor, as the compound's first part.
private ITerm[] Alta.Intelligence.ICompoundPart.Remaining { get; }The terms, as the compound's remaining parts.

Methods​

MemberWhat it is
ITerm CheckBind(Dictionary<ITerm, ITerm> bindings)Returns this predicate with any bound variables replaced, or itself if nothing is bound.
void ConstantInitialize(IAtomDefinition definition)Initializes constant terms from an atom definition.
bool Contains(ITerm other)True if the given term is this predicate, its functor or inside any of its terms.
IEnumerable<Result> Evaluate(KnowledgeHolder knowledgeHolder) (iterator)Evaluates against a knowledge holder and merges results with the same bindings, keeping the highest weighting.
static Predicate op_Addition(Predicate left, Predicate right)Combines two predicates with Plus.
static Predicate op_BitwiseAnd(Predicate left, Predicate right)Combines two predicates with And.
static Predicate op_BitwiseOr(Predicate left, Predicate right)Combines two predicates with Or.
static Predicate op_ExclusiveOr(Predicate left, Predicate right)Combines two predicates with Xor.
static Predicate op_Implicit(bool value)Converts a bool: true becomes a True predicate, false becomes null.
static Predicate op_LogicalNot(Predicate right)Wraps a predicate in Not.
protected abstract IEnumerable<Result> EvaluateInternal(KnowledgeHolder knowledgeHolder)Subclass evaluation. Results are deduplicated by Evaluate.
protected abstract Predicate FromCompoundPart(CompoundPart compoundPart)Builds a predicate of the same kind from a rebuilt functor and terms.

Used in​

Members of other types that take, return or hold a Predicate: