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

  • Type Parameters:
    T - the specific rule class
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, java.util.RandomAccess

    public class Derivation<T extends Rule<?,​?>>
    extends java.util.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:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Derivation​(java.util.List<T> rules)
      Creates a new derivation with the given sequence of rules.
    • Method Summary

      Modifier and Type Method Description
      static <S extends Rule<?,​?>>
      java.util.Set<Derivation<S>>
      allDerivations​(java.util.Collection<? extends S> rules)
      Returns the set of all possible derivations from the set of rules.
      static <S extends Rule<?,​?>>
      java.util.Set<Derivation<S>>
      allDerivations​(java.util.Collection<? extends S> rules, Formula conclusion)
      Returns the set of all possible derivations with the given conclusion from the set of rules.
      boolean equals​(java.lang.Object obj)  
      Formula getConclusion()
      Returns the conclusion of this derivation.
      int hashCode()  
      boolean isFounded()
      Checks whether this derivation is founded, i.e.
      boolean isMinimal()
      Checks whether this derivation is minimal with respect to set inclusion.
      • Methods inherited from class java.util.ArrayList

        add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • Derivation

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

      • getConclusion

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

        public static <S extends Rule<?,​?>> java.util.Set<Derivation<S>> allDerivations​(java.util.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<?,​?>> java.util.Set<Derivation<S>> allDerivations​(java.util.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 java.util.Collection<T extends Rule<?,​?>>
        Specified by:
        hashCode in interface java.util.List<T extends Rule<?,​?>>
        Overrides:
        hashCode in class java.util.ArrayList<T extends Rule<?,​?>>
      • equals

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