commonMain.it.unibo.tuprolog.dsl.theory.LogicProgrammingScope.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dsl-theory-jvm Show documentation
Show all versions of dsl-theory-jvm Show documentation
Kotlin DSL for logic programming, enriched with unification and clause storage facilities
The newest version!
package it.unibo.tuprolog.dsl.theory
import it.unibo.tuprolog.core.Scope
import it.unibo.tuprolog.core.VariablesProvider
import it.unibo.tuprolog.dsl.LogicProgrammingScopeWithOperators
import it.unibo.tuprolog.dsl.LogicProgrammingScopeWithPrologStandardLibrary
import it.unibo.tuprolog.dsl.LogicProgrammingScopeWithSubstitutions
import it.unibo.tuprolog.dsl.LogicProgrammingScopeWithVariables
import it.unibo.tuprolog.dsl.MinimalLogicProgrammingScope
import it.unibo.tuprolog.dsl.Termificator
import it.unibo.tuprolog.dsl.unify.LogicProgrammingScopeWithUnification
import it.unibo.tuprolog.theory.IndexedTheoryFactory
import it.unibo.tuprolog.theory.TheoryFactory
import it.unibo.tuprolog.unify.Unificator
import kotlin.js.JsName
interface LogicProgrammingScope :
MinimalLogicProgrammingScope,
LogicProgrammingScopeWithSubstitutions,
LogicProgrammingScopeWithPrologStandardLibrary,
LogicProgrammingScopeWithOperators,
LogicProgrammingScopeWithVariables,
LogicProgrammingScopeWithUnification,
LogicProgrammingScopeWithTheories {
companion object {
internal val defaultUnificator = Unificator.default
@JsName("empty")
fun empty(): LogicProgrammingScope = of()
@JsName("of")
fun of(
scope: Scope = Scope.empty(),
termificator: Termificator = Termificator.default(scope),
variablesProvider: VariablesProvider = VariablesProvider.of(scope),
unificator: Unificator = defaultUnificator,
theoryFactory: TheoryFactory = IndexedTheoryFactory(unificator),
): LogicProgrammingScope =
LogicProgrammingScopeImpl(
scope,
if (termificator.scope === scope) termificator else termificator.copy(scope),
if (variablesProvider.scope === scope) variablesProvider else variablesProvider.copy(scope),
unificator,
if (theoryFactory.unificator === unificator) theoryFactory else theoryFactory.copy(unificator),
)
@JsName("ofUnificator")
fun of(
unificator: Unificator,
theoryFactory: TheoryFactory = IndexedTheoryFactory(unificator),
scope: Scope = Scope.empty(),
termificator: Termificator = Termificator.default(scope),
variablesProvider: VariablesProvider = VariablesProvider.of(scope),
): LogicProgrammingScope = of(scope, termificator, variablesProvider, unificator, theoryFactory)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy