Interface Formula

All Superinterfaces:
Comparable<Formula>
All Known Subinterfaces:
Atom, Literal, Proposition
All Known Implementing Classes:
AtomicProposition, BooleanProposition, Conjunction, Constant, Disjunction, Implication, NegatedAtom, Negation, Predication, Term, Variable

public interface Formula extends Comparable<Formula>
The parent class of all logical formulas.
Author:
Stephen G. Ware
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
     
    default boolean
    equals(Formula other, Substitution substitution)
    Tests whether the formula represented by this object would be the same as another formula under the given substitution.
    boolean
    Checks whether this formula contains any variables.
    substitute(Substitution substitution)
    Returns a version of this formula such that any elements that appear in the given substitution are replaced.
    unify(Formula other, Bindings bindings)
    Finds the bindings that would be necessary to make this formula the same as another formula (if any exist).
  • Method Details

    • compareTo

      default int compareTo(Formula other)
      Specified by:
      compareTo in interface Comparable<Formula>
    • equals

      default boolean equals(Formula other, Substitution substitution)
      Tests whether the formula represented by this object would be the same as another formula under the given substitution.
      Parameters:
      other - the other logical formula to be compared to
      substitution - a substitution
      Returns:
      true if the formulas would be the same after performing the substitution, false otherwise
    • isGround

      boolean isGround()
      Checks whether this formula contains any variables.
      Returns:
      true if the formula is ground, false otherwise
    • substitute

      Formula substitute(Substitution substitution)
      Returns a version of this formula such that any elements that appear in the given substitution are replaced.
      Parameters:
      substitution - the substitution
      Returns:
      a formula with replacements from the substitution
    • unify

      Bindings unify(Formula other, Bindings bindings)
      Finds the bindings that would be necessary to make this formula the same as another formula (if any exist).
      Parameters:
      other - the other formula
      bindings - an existing set of bindings that will be added to
      Returns:
      the bindings that would make both formulas the same, or null if so such bindings exist