Companion

object Companion

Properties

Link copied to clipboard

The default unification strategy: an empty-context strict, comparing Terms' identity through plain Term.equals.

Link copied to clipboard
const val DEFAULT_CACHE_CAPACITY: Int = 32

The default capacity of the LRU cache used by cached when no explicit capacity is provided.

Functions

Link copied to clipboard
fun cached(other: Unificator, capacity: Int = DEFAULT_CACHE_CAPACITY): Unificator

Decorates other so that its most recently computed Unificator.mgu/Unificator.merge results (and, transitively, Unificator.match/Unificator.unify, which are defined in terms of Unificator.mgu) are memoized in an LRU cache, avoiding recomputation for repeated requests with the same arguments.

Link copied to clipboard
infix fun Term.matches(other: Term): Boolean

Computes whether this and other match, using the default unification strategy.

Link copied to clipboard

Merges this and other, using the default unification strategy.

Link copied to clipboard

Computes the Most General Unifier of this and other, using the default unification strategy.

Link copied to clipboard

Creates a naive unification strategy (see naive) with an empty starting context.

Creates a naive unification strategy, with the given starting context, that checks Terms' equality through Term.equals, except for numeric terms which are compared by value rather than by exact representation — e.g. an it.unibo.tuprolog.core.Integer 1 and a it.unibo.tuprolog.core.Real 1.0 are considered equal.

Link copied to clipboard

Creates a strict unification strategy (see strict) with an empty starting context.

Creates a strict unification strategy, with the given starting context, that checks Terms' equality through plain Term.equals — including for numeric terms, so e.g. an integer 1 and a real 1.0 are not considered equal (unlike with naive).

Link copied to clipboard
infix fun Term.unifyWith(other: Term): Term?

Computes the unified term resulting from unifying this with other, using the default strategy.