Unifier

sealed interface Unifier: Substitution, Any

A type for successful Substitutions (a.k.a. unifiers) actually assigning Vars to Terms

Methods

minus

abstract fun minus(keys: Iterable<Var>): Unifier

Returns a new substitution containing all entries of the original substitution except those entries which variable keys are contained in the given keys iterable.

Regardless of its type, the resulting Substitution will contain the same tags of the original one

Parameters

Name Description
keys: Iterable<Var>

ReturnValue

Name Description
Unifier

minus

abstract fun minus(other: Substitution): Unifier

Returns a new substitution containing all entries of the original substitution except those entries which variable keys are contained in the given other substitution.

Regardless of its type, the resulting Substitution will contain the same tags of the original one

Parameters

Name Description
other: Substitution

ReturnValue

Name Description
Unifier

minus

abstract fun minus(variable: Var): Unifier

Parameters

Name Description
variable: Var

ReturnValue

Name Description
Unifier

minus

abstract fun minus(variable: Var, vararg otherVariables: Var): Unifier

Parameters

Name Description
variable: Var
vararg otherVariables: Var

ReturnValue

Name Description
Unifier

filter

abstract fun filter(predicate: (Entry<Var, Term>)->Boolean): Unifier

Returns a new substitution containing all key-value pairs matching the given predicate.

The returned map preserves the entry iteration order of the original map.

Regardless of its type, the resulting Substitution will contain the same tags of the original one

Parameters

Name Description
predicate: (Entry<Var, Term>)->Boolean

ReturnValue

Name Description
Unifier

filter

abstract fun filter(predicate: (Var, Term)->Boolean): Unifier

Returns a new substitution containing all key-value pairs matching the given predicate.

The returned map preserves the entry iteration order of the original map.

Parameters

Name Description
predicate: (Var, Term)->Boolean

ReturnValue

Name Description
Unifier

filter

abstract fun filter(variables: Collection<Var>): Unifier

Returns a new substitution containing all key-value pairs whose key is in variables.

The returned map preserves the entry iteration order of the original map.

Regardless of its type, the resulting Substitution will contain the same tags of the original one

Parameters

Name Description
variables: Collection<Var>

ReturnValue

Name Description
Unifier

applyTo

abstract fun applyTo(term: Term): Term

Applies this Substitution to the given Term, returning null if it is Substitution.Fail

Parameters

Name Description
term: Term

ReturnValue

Name Description
Term

replaceTags

abstract fun replaceTags(tags: Map<String, Any>): Unifier

Parameters

Name Description
tags: Map<String, Any>

ReturnValue

Name Description
Unifier

asUnifier

open fun asUnifier(): Unifier

Casts the current Substitution to Unifier, if possible, or returns null otherwise

ReturnValue

Name Description
Unifier

the current Substitution, casted to Unifier, or null, if the current term is not an instance of Unifier