Companion

object Companion

Equation companion object

Functions

Link copied to clipboard
fun allOf(pair: Pair<Term, Term>, equalityChecker: (Term, Term) -> Boolean = Term::equals): Sequence<Equation>

Same as allOf, but taking the two Terms as a Pair (pair.first = lhs, pair.second = rhs).

fun allOf(lhs: Term, rhs: Term, equalityChecker: (Term, Term) -> Boolean = Term::equals): Sequence<Equation>

Recursively decomposes lhs and rhs into a (possibly empty) sequence of Equations, none of which is a Comparison between structurally-matching compound terms: lists, tuples and structs sharing the same functor/arity are unfolded and paired element-wise (recursing into each pair), rather than being classified as a single Comparison the way of would. This is what AbstractUnificator uses to expand a pair of Terms into the equations it then simplifies to compute an MGU.

Link copied to clipboard
fun from(pairs: Iterable<Pair<Term, Term>>, equalityChecker: (Term, Term) -> Boolean = Term::equals): Sequence<Equation>

Same as from, for an Iterable of Pairs.

fun from(pairs: Sequence<Pair<Term, Term>>, equalityChecker: (Term, Term) -> Boolean = Term::equals): Sequence<Equation>

Applies allOf to every Pair in pairs, concatenating the resulting fully-decomposed Equations.

fun from(vararg pairs: Pair<Term, Term>, equalityChecker: (Term, Term) -> Boolean = Term::equals): Sequence<Equation>

Same as from, for a vararg of Pairs.

Link copied to clipboard
fun of(pair: Pair<Term, Term>, equalityChecker: (Term, Term) -> Boolean = Term::equals): Equation

Same as of, but taking the two Terms as a Pair (pair.first = lhs, pair.second = rhs).

fun of(lhs: Term, rhs: Term, equalityChecker: (Term, Term) -> Boolean = Term::equals): Equation

Classifies lhs and rhs into the appropriate Equation subtype: Identity if they are trivially equal (per equalityChecker, or structurally for variables), LeftAssignment/RightAssignment if exactly one side is a Var, Contradiction if they can be told apart at this level (different constants, or structs with different functor/arity), or Comparison if they need further decomposition (e.g. two structs with the same functor/arity, whose arguments are not inspected by this shallow classification — use allOf to recursively decompose down to non-decomposable equations).