Class Predication

java.lang.Object
edu.uky.ai.logic.Predication
All Implemented Interfaces:
Atom, Formula, Literal, Proposition, Comparable<Formula>

public class Predication extends Object implements Atom
The atoms of predicate logic, which are composed of statements that express relationships between things in the world (i.e. Terms).
Author:
Stephen G. Ware
  • Field Details

    • predicate

      public final String predicate
      The relationship between the terms, (often a preposition)
    • terms

      public final ImmutableArray<Term> terms
      The terms between which the relationship holds
  • Constructor Details

    • Predication

      public Predication(String predicate, ImmutableArray<Term> terms)
      Constructs a new predication with the given predicate and terms.
      Parameters:
      predicate - the relationship between the terms
      terms - the terms between which the relationship holds
    • Predication

      public Predication(String predicate, Term... terms)
      Constructs a new predication with the given predicate and terms.
      Parameters:
      predicate - the relationship between the terms
      terms - the terms between which the relationship holds
    • Predication

      public Predication(String predicate, Iterable<Term> terms)
      Constructs a new predication with the given predicate and terms.
      Parameters:
      predicate - the relationship between the terms
      terms - the terms between which the relationship holds
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isGround

      public boolean isGround()
      Description copied from interface: Formula
      Checks whether this formula contains any variables.
      Specified by:
      isGround in interface Formula
      Returns:
      true if the formula is ground, false otherwise
    • substitute

      public Atom substitute(Substitution substitution)
      Description copied from interface: Formula
      Returns a version of this formula such that any elements that appear in the given substitution are replaced.
      Specified by:
      substitute in interface Atom
      Specified by:
      substitute in interface Formula
      Specified by:
      substitute in interface Literal
      Specified by:
      substitute in interface Proposition
      Parameters:
      substitution - the substitution
      Returns:
      a formula with replacements from the substitution
    • unify

      public Bindings unify(Formula other, Bindings bindings)
      Description copied from interface: Formula
      Finds the bindings that would be necessary to make this formula the same as another formula (if any exist).
      Specified by:
      unify in interface Formula
      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