2P-Kt

tuProlog in Kotlin
(description)

2P-Kt (tuProlog in Kotlin) is a multi-platform ecosystem in Kotlin for logic programming and symbolic artificial intelligence: the current implementation of tuProlog, built on a minimal core that is extended by modules rather than configured by options.

What 2P-Kt is

2P-Kt is

  • the current implementation of tuProlog, written afresh in Kotlin as a multi-platform project targetting the JVM, JS — server- and browser-side — and Android
  • built on a minimal, layered core — terms and clauses, unification, theories, resolution — extended by modules rather than configured by options
  • meant to give intelligent systems engineers a general-purpose, extensible, open ecosystem for symbolic AI, and not a Prolog interpreter alone
  • open source, released under the Apache 2.0 License

The two IDEs

The same Prolog IDE exists in two incarnations, sharing model and controller and differing only in the toolkit that draws them.

Editing, syntax highlighting, diagnostics and query solving behave the same way in both. They part company on storage: in the browser, New, Open, Save and Save as keep pages in the browser's own local storage, so they survive a reload without touching the file system, while Upload and Download are what read and write a theory file on disk.

The modules

2P-Kt is a family of modules, each a separate artefact, layered so that an application takes only what it needs.

modulewhat it provides
corelogic terms and clauses
unifyunification
theoryin-memory indexing and storage of theories
solvethe generic API for resolving queries — solve-classic and solve-streams target ISO Prolog
solve-plpprobabilistic logic programming, with solve-problog over the bdd module
solve-concurrentOR-concurrent resolution
dsl-*a Prolog-like domain specific language inside Kotlin
parser-core, parser-theoryparsing terms, and theories
serialize-core, serialize-theory(de)serialising terms, and theories
replProlog from the command line
ide, ide-plpProlog, and probabilistic logic programming, through a graphical interface

The architecture is deliberately unopinionated: it is meant to carry other sorts of symbolic AI than Prolog — answer set programming, tabled resolution, concurrent logic programming — as further modules. And because the project is pure Kotlin, committed to the common library alone, it stays small and portable: JVM, JS and Android today, Kotlin/Native in principle.

Warning

Found a problem with 2P-Kt? Please open an issue on the GitHub Issues page.

Releases

Versions, release notes and artefacts live with the code, on GitHub. These pages do not track them: what is current is best read there.

The engine it replaces

2P-Kt is a reboot, not a port: the Java engine it replaces is a project in its own right, with twenty years of its own history, and has its own pages here — tuProlog.

Documents

The documentation of 2P-Kt is published from the project's own sources:

The 262-page tuProlog Guide describes the Java engine, not this one; it is kept on the tuProlog pages.

Downloads

2P-Kt and its modules are released under the Apache 2.0 License through

  • GitHub releases — the executables, including the self-contained 2p-ide-<version>-redist.jar
  • Maven Central — group id it.unibo.tuprolog, for Kotlin, JVM and Android
  • NPM — the @tuprolog organisation, for JavaScript; every module is published as @tuprolog/2p-<module>, with the 2p- prefix, so the whole library is @tuprolog/2p-full
  • GitHub Packages — the same modules from an ad hoc Maven repository

The Web IDE

Nothing needs downloading at all to use 2P-Kt as a Prolog IDE: the Web IDE runs in the browser, at tuprolog.github.io/2p-kt/web-ide.

To serve it yourself, the release page carries an ide-web-<version>.zip asset: unzip it, serve the folder with any static file server — which is what its own end-to-end tests do — and open index.html in a modern browser.

The desktop IDE

The desktop IDE ships as a runnable jar. Beside the all-in-one 2p-ide-<version>-redist.jar the release carries platform-specific variants — -win, -linux, -mac, -mac-aarch64. On Apple Silicon use the mac-aarch64 variant: the all-in-one jar cannot carry the native libraries of both macOS architectures, since they share file names, so it ships the Intel ones and fails on an ARM JVM.

The old Java engine has its own downloads, under a different licence: see the tuProlog pages.

Logo