Class DefeasibleLogicProgram

  • All Implemented Interfaces:
    Iterable<DelpRule>, Collection<DelpRule>, net.sf.tweety.commons.BeliefBase

    public class DefeasibleLogicProgram
    extends net.sf.tweety.commons.BeliefSet<DelpRule,​net.sf.tweety.logics.fol.syntax.FolSignature>
    This class models a defeasible logic program (DeLP).
    Author:
    Matthias Thimm
    • Field Summary

      • Fields inherited from class net.sf.tweety.commons.BeliefSet

        EQUALS_USES_SIGNATURE, signature
    • Method Summary

      Modifier and Type Method Description
      boolean disagree​(Set<net.sf.tweety.logics.fol.syntax.FolFormula> literals)
      Checks whether the given set of literals disagree with respect to the strict part of this program.
      Set<DelpArgument> getArguments()
      Returns the set of all possible arguments, that can be built in this delp.
      net.sf.tweety.arg.dung.syntax.DungTheory getDungTheory()
      This method translates this delp into an abstract Dung theory.
      net.sf.tweety.commons.Signature getMinimalSignature()  
      Set<DelpRule> getRulesWithHead​(net.sf.tweety.logics.fol.syntax.FolFormula l)
      Returns all defeasible and strict rules appearing in this program with the given literal as head
      Set<net.sf.tweety.logics.fol.syntax.FolFormula> getStrictClosure()
      Computes the strict closure of the program, i.e., the set of all strictly derivable literals.
      Set<net.sf.tweety.logics.fol.syntax.FolFormula> getStrictClosure​(Set<net.sf.tweety.logics.fol.syntax.FolFormula> literals)
      Computes the strict closure of the program, i.e., the set of all strictly derivable literals.
      Set<net.sf.tweety.logics.fol.syntax.FolFormula> getStrictClosure​(Set<net.sf.tweety.logics.fol.syntax.FolFormula> literals, Set<DefeasibleRule> defeasibleRules)
      Computes the strict closure of the program, i.e., the set of all strictly derivable literals.
      Set<net.sf.tweety.logics.fol.syntax.FolFormula> getStrictClosure​(Set<net.sf.tweety.logics.fol.syntax.FolFormula> literals, Set<DefeasibleRule> defeasibleRules, boolean usefacts)
      Computes the strict closure of the program, i.e., the set of all strictly derivable literals.
      DefeasibleLogicProgram ground()
      In general, a delp comprises of rule schemes with variables.
      DefeasibleLogicProgram ground​(Set<net.sf.tweety.logics.commons.syntax.Constant> constants)
      In general, a delp comprises of rule schemes with variables.
      protected net.sf.tweety.logics.fol.syntax.FolSignature instantiateSignature()  
      boolean isConsistent​(Set<DefeasibleRule> rules)
      Checks whether the given set of defeasible rules are consistent given the strict part of this program.
      boolean isGround()  
      static void main​(String[] args)
      Parsing DeLP from given file and performing given query against it.
      String toString()  
      • Methods inherited from class net.sf.tweety.commons.BeliefSet

        add, add, addAll, clear, contains, containsAll, equals, getSignature, hashCode, instantiateSet, isEmpty, iterator, remove, removeAll, retainAll, setSignature, size, toArray, toArray
    • Constructor Detail

      • DefeasibleLogicProgram

        public DefeasibleLogicProgram()
        Default constructor; initializes empty delpFacts, strict and defeasible rules and empty comparison criterion.
      • DefeasibleLogicProgram

        public DefeasibleLogicProgram​(DefeasibleLogicProgram delp)
        constructor; initializes this program with the given program
        Parameters:
        delp - a defeasible logic program
    • Method Detail

      • ground

        public DefeasibleLogicProgram ground()
        In general, a delp comprises of rule schemes with variables. This methods returns the corresponding grounded theory, i.e., all schematic elements are replaced with all their grounded instances, where all occurring variables are replaced with constants in every possible way. The set of constants used is the set of constants appearing in this delp.
        Returns:
        the grounded version of this
      • ground

        public DefeasibleLogicProgram ground​(Set<net.sf.tweety.logics.commons.syntax.Constant> constants)
        In general, a delp comprises of rule schemes with variables. This methods returns the corresponding grounded theory, i.e., all schematic elements are replaced with all their grounded instances, where all occurring variables are replaced with constants in every possible way.
        Parameters:
        constants - some set of constants.
        Returns:
        the grounded version of this
      • getDungTheory

        public net.sf.tweety.arg.dung.syntax.DungTheory getDungTheory()
        This method translates this delp into an abstract Dung theory. All arguments, that can be built in this theory are interpreted as abstract arguments. The attack relation is built using the dialectical proof theory of delp.
        Returns:
        the abstract Dung theory induced by this delp.
      • getArguments

        public Set<DelpArgument> getArguments()
        Returns the set of all possible arguments, that can be built in this delp.
        Returns:
        the set of all possible arguments, that can be built in this delp.
      • getStrictClosure

        public Set<net.sf.tweety.logics.fol.syntax.FolFormula> getStrictClosure​(Set<net.sf.tweety.logics.fol.syntax.FolFormula> literals,
                                                                                Set<DefeasibleRule> defeasibleRules,
                                                                                boolean usefacts)
        Computes the strict closure of the program, i.e., the set of all strictly derivable literals. For this computation the program may be extended by the given parameters
        Parameters:
        literals - a set of literals
        defeasibleRules - a set of defeasible rules
        usefacts - set to true iff the delpFacts of this program shall be used in computing the closure
        Returns:
        the closure of this program and the given parameters
      • getStrictClosure

        public Set<net.sf.tweety.logics.fol.syntax.FolFormula> getStrictClosure​(Set<net.sf.tweety.logics.fol.syntax.FolFormula> literals,
                                                                                Set<DefeasibleRule> defeasibleRules)
        Computes the strict closure of the program, i.e., the set of all strictly derivable literals. The program is extended with delpFacts and defeasible rules (which are interpreted as strict rules here) described by the parameters literals and defeasibleRules.
        Parameters:
        literals - a set of literals
        defeasibleRules - a set of defeasible rules
        Returns:
        the set of all strictly derivable literals.
      • getStrictClosure

        public Set<net.sf.tweety.logics.fol.syntax.FolFormula> getStrictClosure​(Set<net.sf.tweety.logics.fol.syntax.FolFormula> literals)
        Computes the strict closure of the program, i.e., the set of all strictly derivable literals. The program is extended with delpFacts described by the parameter literals
        Parameters:
        literals - a set of literals
        Returns:
        the set of all strictly derivable literals.
      • getStrictClosure

        public Set<net.sf.tweety.logics.fol.syntax.FolFormula> getStrictClosure()
        Computes the strict closure of the program, i.e., the set of all strictly derivable literals.
        Returns:
        the set of all strictly derivable literals.
      • isConsistent

        public boolean isConsistent​(Set<DefeasibleRule> rules)
        Checks whether the given set of defeasible rules are consistent given the strict part of this program.
        Parameters:
        rules - a set of defeasible rules
        Returns:
        false if the union of this program's delpFacts and strict rules with the given set of defeasible rules defeasibly derives two complementary literals
      • disagree

        public boolean disagree​(Set<net.sf.tweety.logics.fol.syntax.FolFormula> literals)
        Checks whether the given set of literals disagree with respect to the strict part of this program.
        Parameters:
        literals - a set of literals
        Returns:
        true if the union of this program's delpFacts and strict rules with the given set of literals defeasibly derives two complementary literals
      • isGround

        public boolean isGround()
      • toString

        public String toString()
        Specified by:
        toString in interface net.sf.tweety.commons.BeliefBase
        Overrides:
        toString in class net.sf.tweety.commons.BeliefSet<DelpRule,​net.sf.tweety.logics.fol.syntax.FolSignature>
      • getRulesWithHead

        public Set<DelpRule> getRulesWithHead​(net.sf.tweety.logics.fol.syntax.FolFormula l)
        Returns all defeasible and strict rules appearing in this program with the given literal as head
        Parameters:
        l - a literal
        Returns:
        a set of strict and defeasible rules
      • getMinimalSignature

        public net.sf.tweety.commons.Signature getMinimalSignature()
      • main

        public static void main​(String[] args)
                         throws IOException,
                                org.kohsuke.args4j.CmdLineException
        Parsing DeLP from given file and performing given query against it.
        Parameters:
        args - Options and arguments (try "-h" to get a help text with details)
        Throws:
        IOException - if an IO issue occurs.
        org.kohsuke.args4j.CmdLineException - if there is some problem parsing the command line
      • instantiateSignature

        protected net.sf.tweety.logics.fol.syntax.FolSignature instantiateSignature()
        Specified by:
        instantiateSignature in class net.sf.tweety.commons.BeliefSet<DelpRule,​net.sf.tweety.logics.fol.syntax.FolSignature>