Equation
An equation between two logic Terms, lhs = rhs, as built and progressively simplified while computing a Substitution (see AbstractUnificator).
LHS stands for Left-Hand side and RHS stands for Right-Hand side, of the Equation. Every Equation falls into exactly one of five shapes, reflected by this sealed class' subtypes and the corresponding is/as/castTo member triples (isIdentity/asIdentity/castToIdentity and so on):
Identity — both sides are already equal (a no-op for unification purposes);
Assignment (further split into LeftAssignment and RightAssignment) — one side is a Var that could be bound to the other side, turning the equation into a Substitution entry;
Comparison — both sides are non-variable, non-equal terms still to be decomposed further (e.g. two structs with the same functor/arity, to be compared argument-wise);
Contradiction — both sides are irreconcilably different, signaling unification failure.
Instances are normally created through the factory functions in the companion object, which classify a pair of Terms into the appropriate subtype rather than requiring callers to pick one manually.
Inheritors
Types
Properties
Whether this Equation is an Assignment (either LeftAssignment or RightAssignment).
Whether this Equation is a Comparison, i.e. still needs decomposing into sub-equations.
Whether this Equation is a Contradiction, i.e. represents unification failure.
Whether this Equation is a LeftAssignment, i.e. shaped as Var = Term.
Whether this Equation is a RightAssignment, i.e. shaped as Term = Var.
Functions
Applies given substitution to the Equation left-hand and right-hand sides, returning the new Equation
This Equation as an Assignment, or null if isAssignment is false.
This Equation as a Comparison, or null if isComparison is false.
This Equation as a Contradiction, or null if isContradiction is false.
This Equation as an Identity, or null if isIdentity is false.
This Equation as a LeftAssignment, or null if isLeftAssignment is false.
This Equation as a RightAssignment, or null if isRightAssignment is false.
This Equation as an Assignment. @throws ClassCastException if isAssignment is false.
This Equation as a Comparison. @throws ClassCastException if isComparison is false.
This Equation as a Contradiction. @throws ClassCastException if isContradiction is false.
This Equation as an Identity. @throws ClassCastException if isIdentity is false.
This Equation as a LeftAssignment. @throws ClassCastException if isLeftAssignment is false.
This Equation as a RightAssignment. @throws ClassCastException if isRightAssignment is false.
Turns this Equation into a Contradiction with the same lhs and rhs, regardless of its actual shape.
The single-binding Substitution this Equation amounts to, i.e. its Var side unified with the other side.