Class Conjunction

All Implemented Interfaces:
Formula, Proposition, Comparable<Formula>

public class Conjunction extends BooleanProposition
A conjunction, or logical AND statement, is true just when all of its arguments are true.
Author:
Stephen G. Ware
  • Field Details

    • CONJUNCTION_PREDICATE

      public static final String CONJUNCTION_PREDICATE
      The word used to express a conjunction
      See Also:
  • Constructor Details

    • Conjunction

      public Conjunction(ImmutableArray<Proposition> arguments)
      Constructs a conjunction from a group of arguments.
      Parameters:
      arguments - the arguments
    • Conjunction

      public Conjunction(Proposition... arguments)
      Constructs a conjunction from a group of arguments.
      Parameters:
      arguments - the arguments
    • Conjunction

      public Conjunction(Iterable<? extends Proposition> arguments)
      Constructs a conjunction from a group of arguments.
      Parameters:
      arguments - the arguments
  • 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
    • substitute

      public Proposition 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.
      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).
      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
    • isTrue

      public boolean isTrue(State state)
      Description copied from interface: Proposition
      Tests whether this proposition is true in the given state.
      Parameters:
      state - the state in which to test this proposition
      Returns:
      true if the proposition is true, false otherwise
    • makeTrue

      public void makeTrue(MutableState state)
      Description copied from interface: Proposition
      Modifies the given state object to make this proposition true. Note that some propositions (such as Disjunctions) are non-deterministic, meaning there are multiple ways to make them true, and thus the state that would result from this operation is not clearly defined.
      Parameters:
      state - the state to modify
    • simplify

      public Proposition simplify()
      Description copied from interface: Proposition
      Returns an equivalent proposition which may be simpler.
      Returns:
      the simplified proposition
    • negate

      public Disjunction negate()
      Description copied from interface: Proposition
      Returns a proposition whose truth values are opposite of this proposition (i.e. true when this one is false, false when this one is true).
      Returns:
      a proposition with opposite truth values
    • toCNF

      public Proposition toCNF()
      Description copied from interface: Proposition
      Converts this proposition to Conjunctive Normal Form (CNF). There are three kinds of formulas that are considered to be in CNF:
      1. A Literal by itself
      2. A Disjunction of literals, called a clause
      3. A Conjunction of clauses
      Returns:
      an equivalent proposition in CNF
    • toDNF

      public Proposition toDNF()
      Description copied from interface: Proposition
      Converts this proposition to Disjunctive Normal Form (DNF). There are three kinds of formulas that are considered to be in DNF:
      1. A Literal by itself
      2. A Conjunction of literals, called a clause
      3. A Disjunction of clauses
      Returns:
      an equivalent proposition in DNF