Library

interface Library : Pluggable

A type for logic libraries, i.e. aliases aggregates of (possibly empty) collections of

A library alias is aimed at identifying the library in the eyes of a solver.

Bundling all four kinds of extension together, rather than exposing four separate registration points on it.unibo.tuprolog.solve.Solver, is what makes it possible to ship a self-contained feature (e.g. :io-lib, :oop-lib) as a single pluggable unit. Since more than one Library can be loaded into a Runtime at once, alias is what lets clashing predicate indicators between libraries be resolved without either library needing to know about the other (see of and its alias parameter).

See also

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val alias: String

The alias identifying this library

Link copied to clipboard
abstract val clauses: List<Clause>

Rules, facts, or directories to be loaded by a solver when the library is used

Link copied to clipboard

LogicFunctions to be loaded by a solver when the library is used, indexed by their Signature in the eyes of the solver

Link copied to clipboard
abstract val operators: OperatorSet

Operators to be loaded by a solver when the library is used

Link copied to clipboard

Primitives to be loaded by a solver when the library is used, indexed by their Signature in the eyes of the solver

Link copied to clipboard

The Signature of every Rule (i.e. non-fact clause) among clauses, deduplicated.

Functions

Link copied to clipboard
open operator fun contains(operator: Operator): Boolean

Checks whether this library contains the definition of provided operator

open operator fun contains(signature: Signature): Boolean

Checks whether this library contains the provided signature.

Link copied to clipboard
abstract operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Shorthand for this Library's declared Library.operators, as a Sequence.

Link copied to clipboard
open fun hasFunction(signature: Signature): Boolean

Checks whether this library has a LogicFunction with provided signature

Link copied to clipboard
abstract override fun hashCode(): Int
Link copied to clipboard
open fun hasPrimitive(signature: Signature): Boolean

Checks whether this library has a Primitive with provided signature

Link copied to clipboard
open fun hasProtected(signature: Signature): Boolean

Checks whether the provided signature, is protected in this library

Link copied to clipboard
abstract fun hasRule(signature: Signature): Boolean

Checks whether this library has a Rule with provided signature

Link copied to clipboard
operator fun Library.plus(other: Library): Runtime

Combines this Library and other into a two-library Runtime, via Runtime.of. Note that, unlike Runtime.plus, this does not reject a clashing Library.alias: if both share the same alias, other silently wins.

Link copied to clipboard

Converts the current library into a Runtime containing a single library

Link copied to clipboard
abstract override fun toString(): String