Skip to content

tuProlog/cilc-2022-2pkt-demo

Repository files navigation

Context

  • Logic-based technologies (LBT) are either built

    • on top of Prolog
    • from Scratch
  • Building LBT on top of Prolog means

    • be tailored on the way Prolog does stuff
    • either rely on FLI, or call Prolog from the command line, or write in Prolog
  • Building LBT from scratch means

    • reinventing the wheel over and over again

Why 2P-Kt

  • Provide LP functialities

    • as a library, for mainstream programming languages
    • individually, to ease selective exploitation and combination
    • to as many platform/languages as possible, hence maximising the potential audience
  • Provide an ecosystem of logic-based facilities aimed for re-use, e.g.

    • to create novel logic-based facilities
    • to exploit LP in every-day programming
  • Avoid the need for reimplementing the same functionalities on a per-project basis

    • e.g. terms/clauses contruction/manipulation, unification, etc.
    • providing the facilities as ready-to-use, and customisable libraries

Demonstration of 2P-Kt functionalities

We shall demonstrate "How to do stuff" in 2P-Kt, in particular concerning:

  1. terms and clauses manipulation

    • creation, exploitation, parsing, and formatting
  2. unification of terms and clauses

  3. theories manipulation

    • creation, exploitation, parsing
  4. resolution

    • e.g. in Prolog, or concurrent LP

Terms

Creation

terms can be created via method calls

terms can be created via kotlin DSL

terms can be parsed from strings

handy ways exist for building particular terms such as lists

Manipulation

one may easily access inner properties for terms

one may easily rewrite terms by applying substitutions to variables

Non-trivial usage example

the first N terms in the Herbrand universe spawned by z|0 and s|1 are the first N Peano numbers

Clauses

Creation

clauses can be created via method calls

clauses can be parsed from strings

Manipulation

one may easily access inner properties for clauses

one may easily get all the variables in a clause

one may rewrite clauses by substitutions application

Unification

one may easily check weather two terms unify or not

one may use unification to manipulate terms

Theories

Creation

theories may be parsed from strings

theories can be created via kotlin DSL

Manipulation

theories are iterable containers for clauses

theories may be queried via unification

clauses may be retracted from theory via unification

clauses may be asserted into theories

Non-trivial usage example

propositional theories may be easily converted in relational form

Solvers

Creation and usage

using Prolog, let's compute all solutions for the N-queens problem

using concurrent LP, let's compute all solutions for the N-queens problem

Extend solvers with primitives

natural primitive

Prolog solvers can be extended with Kotlin functions having a logic API

concurrent LP solvers can be extended with Kotlin functions having a logic API

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages