Package-level declarations

Types

Link copied to clipboard
abstract class AbstractPrologSolver(unificator: Unificator = Unificator.default, libraries: Runtime = Runtime.empty(), flags: FlagStore = FlagStore.empty(), initialStaticKb: Theory = Theory.empty(unificator), initialDynamicKb: Theory = MutableTheory.empty(unificator), inputChannels: InputStore = InputStore.fromStandard(), outputChannels: OutputStore = OutputStore.fromStandard(), trustKb: Boolean = false) : AbstractSolver<PrologExecutionContext>

Base implementation of every :solve-prolog it.unibo.tuprolog.solve.Solver/it.unibo.tuprolog.solve.MutableSolver (PrologSolver and MutablePrologSolver, both internal, are the only two concrete subclasses; instances are normally obtained through Arg2pPrologSolverFactory, which is what the Solver.prolog property resolves to).

Link copied to clipboard
object Arg2pPrologSolverFactory : SolverFactory

The SolverFactory of the engine of arg2p, the fork of 2P-Kt's ISO-standard, SLD-NF resolution engine (:solve-prolog) that inlines module calls and keeps the bindings of the goals left to solve (see README.md in this package). The solvers of arg2p are built with it (Arg2pSolverFactory); it is public for the tools building their own.

Link copied to clipboard
sealed class ChoicePointContext

One node of the :solve-prolog choice-point queue: a saved point in the proof search that it.unibo.tuprolog.argumentation.core.engine.fsm.StateBacktracking can resume from, chained to its parent to form the full lineage of choice points recorded since the query started (see pathToRoot).

Link copied to clipboard
fun interface ClauseObserver

Told of each clause the engine resolves a goal with (arg2p): to measure which clauses a run uses

Link copied to clipboard

The observers of the clauses resolved by the engine, in any resolution of any solver while they are registered: an instrument for tools such as coverage reports, costing a check of an empty list otherwise.

Link copied to clipboard
fun interface ClauseSource

Where the engine finds the clauses it resolves a goal with (arg2p): the theories of the program, or the source of a Sourcing delegation.

Link copied to clipboard
interface DelegatedCall : Primitive

A primitive whose goal the engine can solve itself, as a sub-goal of the same resolution, rather than through the solutions the primitive computes (arg2p: module calls, context lookups). Other solvers just call solve.

Link copied to clipboard
sealed interface Delegation

How the engine solves a DelegatedCall, in a frame of its own opaque to cut (as call/1)

Link copied to clipboard
data class Inlining(val goal: Struct, val libraries: Runtime) : Delegation

The goal solved in place, against the libraries given: when the frame is left, the caller goes on with its own libraries (module calls)

Link copied to clipboard
data class PrologExecutionContext(val procedure: Struct? = null, val unificator: Unificator = Unificator.default, val libraries: Runtime = Runtime.empty(), val flags: FlagStore = FlagStore.empty(), val staticKb: Theory = Theory.empty(unificator), val dynamicKb: MutableTheory = MutableTheory.empty(unificator), val operators: OperatorSet = getAllOperators(libraries, staticKb, dynamicKb).toOperatorSet(), val inputChannels: InputStore = InputStore.fromStandard(), val outputChannels: OutputStore = OutputStore.fromStandard(), val customData: CustomDataStore = CustomDataStore.empty(), val substitution: Substitution.Unifier = Substitution.empty(), val query: Struct = Truth.TRUE, val goals: Cursor<out Term> = Cursor.empty(), val rules: Cursor<out Rule> = Cursor.empty(), val primitives: Cursor<out Solve.Response> = Cursor.empty(), val startTime: TimeInstant, val maxDuration: TimeDuration = TimeDuration.MAX_VALUE, val choicePoints: ChoicePointContext? = null, val parent: PrologExecutionContext? = null, val depth: Int = 0, val step: Long = 0, val relevantGoals: RelevantGoals? = null, val trimmedSize: Int = 0, val inlined: Boolean = false, val scoped: Boolean = false, val theoryIndexes: TheoryIndexes = TheoryIndexes()) : ExecutionContext

One frame of the :solve-prolog execution-context stack: a substitution, the streams of remaining goals, candidate Rules and candidate primitive responses, plus a parent link. Frames chain into their parent rather than living in a separate stack container, so the parent chain (see pathToRoot) is the call stack -- ordinary heap-allocated data rather than native JVM/JS stack frames, which is what lets Prolog resolution of arbitrarily deep recursive programs run as an explicit, non-recursive it.unibo.tuprolog.argumentation.core.engine.fsm.State loop instead of unbounded host-language recursion.

Link copied to clipboard
class RelevantGoals(val goal: Term, val previous: RelevantGoals?)

The goals selected so far in a frame, the newest first: a chain extended at each step, rather than the set of their variables (arg2p: copying the set at each step made long conjunctions quadratic). The variables are only collected when a substitution is trimmed.

Link copied to clipboard
interface SolutionIterator : Iterator<Solution>

Drives the :solve-prolog finite-state machine, one State.next step at a time, and turns every visited end-state (see it.unibo.tuprolog.argumentation.core.engine.fsm.EndState) into an emitted Solution.

Link copied to clipboard
data class Sourcing(val goal: Struct, val source: ClauseSource) : Delegation

The goal (not a conjunction) resolved with the clauses of source as the clauses of its predicate, read when the call is made (context lookups)

Functions

Link copied to clipboard
fun ChoicePointContext?.appendPrimitives(alternatives: Cursor<out Solve.Response>, executionContext: PrologExecutionContext? = null): ChoicePointContext

Chains a new ChoicePointContext.Primitives recording alternatives onto this (null meaning "the root").

Link copied to clipboard
fun ChoicePointContext?.appendRules(alternatives: Cursor<out Rule>, executionContext: PrologExecutionContext? = null): ChoicePointContext

Chains a new ChoicePointContext.Rules recording alternatives onto this (null meaning "the root").

Link copied to clipboard

The ChoicePointContext.depth a new choice point chained onto this one (or null, for the root) would have.