ClauseStore

Clause database backing the argumentation context.

It replaces a full Prolog solver per context branch: clauses are only ever asserted (asserta order), retracted, and looked up as facts or through clause/2, so a dedicated store suffices. Every argument position of a stored head is indexed by the preorder path of its symbols, up to the first variable: lookups only unify the clauses whose paths are compatible with the query ones. Branches share their data until one of them is modified (copy-on-write), and then only copy the predicates they modify.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun assertA(term: Term)

asserta: the new clause is returned before the existing ones

Link copied to clipboard
fun clausesFor(head: Term): List<Clause>

The stored clauses whose head may unify with the given one, newest first, as stored

Link copied to clipboard
fun <T : Any> derived(functor: String, arity: Int, name: String, compute: (List<Clause>) -> T): T

A value derived from the clauses of the predicate functor/arity (newest first), named name: computed once, until the predicate changes (the branches sharing the predicate share it)

Link copied to clipboard
Link copied to clipboard
fun retractAll(term: Term)

retractall: removes every clause whose head (and body, for a :- pattern) unifies with the given term

Link copied to clipboard
fun solve(goal: Term): Sequence<Substitution>

Solutions of a goal (a fact, a single-goal rule, or clause(Head, Body)) on a snapshot of the store

Link copied to clipboard
fun unifiableBodies(head: Term, body: Term): Sequence<Substitution>

Bodies of the clauses whose head unifies with the given one, as stored: the head bindings are not applied, so variables in the stored clauses are left untouched