Package-level declarations

Types

Link copied to clipboard
interface ClauseListener

A visitor over Clauses, dispatching to a specific callback depending on the clause's concrete kind (onDirective/onFact/onRule/onClause for anything else), via listen.

Link copied to clipboard
interface ClausePartition

The result of splitting a collection of Clauses (typically a whole Theory) into the pieces of state a it.unibo.tuprolog.solve.Solver must be seeded with when loading it: plain clauses bound for the static/dynamic knowledge bases, plus everything expressed via directives (:- Goal facts) -- declared operators, flags (flagStore), goals to run at load time (initialGoals), and other theories to load (includes).

Link copied to clipboard
class ClausePartitioner(val unificator: Unificator, source: Iterable<Clause>, staticByDefault: Boolean = true) : ClausePartition, DirectiveSelector

The concrete ClausePartition/DirectiveSelector implementation, lazily partitioning source's clauses on first access to any of ClausePartition's properties (and caching the result thereafter). Plain Rules/Facts are routed to dynamicClauses or staticClauses depending on whether their signature was declared dynamic/1 or static/1 by a directive, falling back to staticByDefault when neither was declared.

Link copied to clipboard

A ClauseListener refinement that further dispatches Directives (:- Goal clauses) depending on which of patterns their body unifies with, rather than treating every directive alike via ClauseListener.onDirective.

Link copied to clipboard

The concrete DirectiveListener recognizing every directive pattern 2P-Kt gives special treatment to when loading a knowledge base: dynamic/1, static/1 (declaring a predicate's storage), initialization/1/solve/1 (a goal to run at load time), include/1/load/1 (another theory to load), op/3 (operator declaration), and set_flag/2/set_prolog_flag/2 (flag assignment). Each recognized pattern is routed to the corresponding on* callback (onDynamic, onStatic, onSolve, onLoad, onOperator, onSetFlag); anything else falls back to ClauseListener.onDirective.

Functions

Link copied to clipboard
fun Theory.partition(unificator: Unificator = this.unificator, staticByDefault: Boolean = true): ClausePartition

Partitions this Theory's clauses into a ClausePartition, using its own Theory.unificator by default.

fun <C : Clause> Iterable<C>.partition(unificator: Unificator = Unificator.default, staticByDefault: Boolean = true): ClausePartition

Partitions this collection of clauses into a ClausePartition, using unificator to match directive patterns.

Link copied to clipboard

Null-safe ClausePartition.plus: merges two possibly-null partitions, returning null only if both are.