Class Derivation<T extends Rule<?,?>>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<T>
org.tweetyproject.commons.util.rules.Derivation<T>
Type Parameters:
T - the specific rule class
All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, List<T>, RandomAccess

public class Derivation<T extends Rule<?,?>> extends ArrayList<T>
This class models a derivation, i.e. a minimal (with respect to set inclusion) sequence of rules [R1, ... ,Rn] such that for any Ri and for any p in the premise of Ri there is an Rj with j > i and the conclusion of Rj equals p.
Author:
Matthias Thimm
See Also:
  • Constructor Details

    • Derivation

      public Derivation(List<T> rules)
      Creates a new derivation with the given sequence of rules.
      Parameters:
      rules - a sequence of rules.
  • Method Details

    • getConclusion

      public Formula getConclusion()
      Returns the conclusion of this derivation.
      Returns:
      the conclusion of this derivation.
    • allDerivations

      public static <S extends Rule<?, ?>> Set<Derivation<S>> allDerivations(Collection<? extends S> rules)
      Returns the set of all possible derivations from the set of rules.
      Type Parameters:
      S - the type of rules
      Parameters:
      rules - a set of rules
      Returns:
      the set of all possible derivations
    • allDerivations

      public static <S extends Rule<?, ?>> Set<Derivation<S>> allDerivations(Collection<? extends S> rules, Formula conclusion)
      Returns the set of all possible derivations with the given conclusion from the set of rules.
      Type Parameters:
      S - the type of rules
      Parameters:
      rules - a set of rules
      conclusion - the conclusion
      Returns:
      the set of all possible derivations with the given conclusion
    • isFounded

      public boolean isFounded()
      Checks whether this derivation is founded, i.e. whether every formula appearing in the premise of a rule is also the conclusion of a previous rule.
      Returns:
      "true" if this derivation is founded.
    • isMinimal

      public boolean isMinimal()
      Checks whether this derivation is minimal with respect to set inclusion. This is equivalent to checking whether every conclusion besides the first is used in a premise and no conclusion appear twice.
      Returns:
      "true" if this derivation is minimal.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<T extends Rule<?,?>>
      Specified by:
      hashCode in interface List<T extends Rule<?,?>>
      Overrides:
      hashCode in class ArrayList<T extends Rule<?,?>>
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface Collection<T extends Rule<?,?>>
      Specified by:
      equals in interface List<T extends Rule<?,?>>
      Overrides:
      equals in class ArrayList<T extends Rule<?,?>>