Unifier

class Unifier: Substitution, Map<Var, Term>

Creates a new Successful Substitution (aka Unifier) with given mappings (after some checks)

Fields

Name Description
val isSuccess: Boolean

Whether this Substitution is a successful one (is a Unifier)

Constructors

<init>

constructor(mappings: Map<Var, Term>)

Creates a new Successful Substitution (aka Unifier) with given mappings (after some checks)

Parameters

Name Description
mappings: Map<Var, Term>

Methods

getOriginal

fun getOriginal(variable: Var): Var?

Retrieves the original variable name of the provided variable, if any, or null otherwise

Consider for instance the substitution { X -> Y, Y -> Z }, then the invocation of getOriginal(Z) should retrieve X

Parameters

Name Description
variable: Var

ReturnValue

Name Description
Var?

minus

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.

Parameters

Name Description
keys: Iterable<Var>

ReturnValue

Name Description
Unifier

minus

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.

Parameters

Name Description
other: Substitution

ReturnValue

Name Description
Unifier

filter

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.

Parameters

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

ReturnValue

Name Description
Unifier

filter

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

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.

Parameters

Name Description
variables: Collection<Var>

ReturnValue

Name Description
Unifier

equals

fun equals(other: Any?): Boolean

Parameters

Name Description
other: Any?

ReturnValue

Name Description
Boolean

hashCode

fun hashCode(): Int

ReturnValue

Name Description
Int

toString

fun toString(): String

ReturnValue

Name Description
String