Class Rules

java.lang.Object
fr.inria.rules.integraal.util.Rules

public final class Rules extends Object
Utility class for rules
  • Constructor Details

    • Rules

      public Rules()
      Creates the rule utility.
  • Method Details

    • computeSinglePiece

      public static Collection<FORule> computeSinglePiece(FORule rule)
      Generate a set of mono-piece rules equivalent of the specified rule.
      Parameters:
      rule - rule to split into single piece
      Returns:
      a Collection of Rule which is a decomposition of the specified rule to single piece rules.
    • getPositiveBodyPart

      public static FOFormula getPositiveBodyPart(FORule rule)
      Returns the positive body part of the supplied rule.
      Parameters:
      rule - the rule to get the positive part of the body
      Returns:
      the conjunction representing the positive parts of the body of the given rule
    • getNegativeBodyParts

      public static FOFormula getNegativeBodyParts(FORule rule)
      Returns the negative body parts of the supplied rule.
      Parameters:
      rule - the rule to get the negative parts of the body
      Returns:
      the conjunction representing the negative parts of the body of the given rule
    • computeSafeNegation

      public static Collection<FORule> computeSafeNegation(FORule rule)
      Generate a set of safe-negative rules equivalent of the specified rule. A rule is safe-negative iff each negative part contains only variables that appear in the positive part.

      Let R a rule, B+ the positive part of R, B- = A1, ..., Ak a negative part of R

      This decomposition replaces each B- by a new atom and adds a rule R' = B- -> p(x1, ..., xj) where x1, ..., xj are the variables that appear both in B+ and B-.

      Parameters:
      rule - rule to decompose into safe negation
      Returns:
      a Collection of rule which is a decomposition of the specified rule to safe-negation rules.
    • freshRenaming

      public static FORule freshRenaming(FORule rule)
      Create a new rule corresponding to the given rule by renaming all the variables with fresh variables
      Parameters:
      rule - to rename
      Returns:
      a new rule corresponding to the given rule by renaming all the variables with fresh variables
    • createImageWith

      public static FORule createImageWith(FORule r, Substitution s)
      Applies a substitution to the supplied rule and returns the resulting image.
      Parameters:
      r - the rule to apply the substitution on
      s - the substitution to apply
      Returns:
      a new FORule corresponding to the given FORule in which the given substitution have been applied