Class AtomicProposition

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

public class AtomicProposition extends Object implements Atom
An individual statement that has a truth value (the atoms of propositional logic).
Author:
Stephen G. Ware
  • Field Details

    • name

      public final String name
      The proposition's name
  • Constructor Details

    • AtomicProposition

      public AtomicProposition(String name)
      Constructs a new atom with the given name.
      Parameters:
      name - the atom's name
  • 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