Reference¶
Information-oriented technical description of 2P-Kt's modules and APIs.
The full generated API documentation (Dokka, covering every module) is available at
/api/.
At a glance: the Term hierarchy¶
Every piece of logic data in 2P-Kt — atoms, numbers, variables, structures, clauses — is a Term.
Terms are immutable, tree-like data structures:
package it.unibo.tuprolog.core
import it.unibo.tuprolog.utils.Castable
import it.unibo.tuprolog.utils.Taggable
import kotlin.js.JsName
/**
* Base type for all logic terms: [Var]iables, [Constant]s ([Atom]s and [Numeric]s), and [Struct]ures
* (including [Clause]s, [List]s, [Tuple]s, and [Block]s, which are all just structures with a conventional
* functor). Every piece of data 2P-Kt's logic engine manipulates is, ultimately, a [Term].
*
* [Term]s are immutable tree-like data structures: there is no public API mutating a [Term] in place, only
* ones (like [freshCopy] and [Applicable.apply]) that return a new [Term]. This is what lets terms be shared
* freely between larger terms, knowledge bases, and concurrent computations without any risk of aliasing.
*
* [Term] also defines three, deliberately distinct, notions of equality — [equals] (identity-like, comparing
See Module map for how the ~30 modules relate to each other.
Suggested reading order¶
Reference pages are self-contained lookup material, but they build on each other roughly in this order — from the big picture down to specific APIs, ending with a couple of project-meta pages:
- Module map — what the ~30 modules are and how they depend on each other.
- Term hierarchy — the core logic-data model everything else is built on.
- Unification API — unifying and substituting
Terms. - Solver API — the platform-agnostic goal-resolution API.
- Primitives and functions — the building blocks a
Solverexecutes. - Default predicates — the standard predicates built from those primitives.
- Libraries — bundling predicates/functions into a pluggable unit.
- I/O library — the
:io-libpredicate catalogue and platform caveats, a concreteLibraryexample. - Prolog DSL — the Kotlin DSL for building terms/theories/queries.
- Errors and exceptions — the exception hierarchy raised during resolution.
- CI/CD pipeline — project-meta: how 2P-Kt itself is built, tested, and released.