Enum BitBlaster

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<BitBlaster>

    public enum BitBlaster
    extends java.lang.Enum<BitBlaster>
    BitBlaster implements an encoder of Fortress nodes to SAT4J CNFs.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  BitBlaster.Operand
      Represents a bit-vector operand.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AND
      Encodes a conjunction of n boolean variables, i.e.
      BVADD
      Encodes a word-level constraint of the form u == x + const or u == x + y.
      BVADD_CONSTANT
      Encodes a word-level constraint of the form u == x + const.
      BVADD_VARIABLE
      Encodes a word-level constraint of the form u == x + y.
      BVAND
      Encodes a word-level constraint of the form u == x & const or u == x & y.
      BVAND_CONSTANT
      Encodes a word-level constraint of the form u == x & const.
      BVAND_VARIABLE
      Encodes a word-level constraint of the form u == x & y.
      BVASHL
      Encodes a word-level constraint of the form u == x << const or u == x << y.
      BVASHR
      Encodes a word-level constraint of the form u == x >> const or u == x >> y.
      BVASHR_CONSTANT
      Encodes a word-level constraint of the form u == x >> const.
      BVASHR_VARIABLE
      Encodes a word-level constraint of the form u == x >> y.
      BVCONCAT
      Encodes a word-level constraint of the form u == x :: y.
      BVLSHL
      Encodes a word-level constraint of the form u == x << const or u == x << y.
      BVLSHL_CONSTANT
      Encodes a word-level constraint of the form u == x << const.
      BVLSHL_VARIABLE
      Encodes a word-level constraint of the form u == x << y.
      BVLSHR
      Encodes a word-level constraint of the form u == x >>> const or u == x >>> y.
      BVLSHR_CONSTANT
      Encodes a word-level constraint of the form u == x >>> const.
      BVLSHR_VARIABLE
      Encodes a word-level constraint of the form u == x >>> y.
      BVNAND
      Encodes a word-level constraint of the form u == ~(x & const) or u == ~(x & y).
      BVNEG
      Encodes a word-level constraint of the form u == ~x or u == ~const.
      BVNOR
      Encodes a word-level constraint of the form u == ~(x | const) or u == ~(x | y).
      BVOR
      Encodes a word-level constraint of the form u == x | const or u == x | y.
      BVOR_CONSTANT
      Encodes a word-level constraint of the form u == x | const.
      BVOR_VARIABLE
      Encodes a word-level constraint of the form u == x | y.
      BVROL
      Encodes a word-level constraint of the form u == x rol const or u == x rol y.
      BVROL_CONSTANT
      Encodes a word-level constraint of the form u == x rol const.
      BVROL_VARIABLE
      Encodes a word-level constraint of the form u == x rol y.
      BVROR
      Encodes a word-level constraint of the form u == x ror const or u == x ror y.
      BVROR_CONSTANT
      Encodes a word-level constraint of the form u == x ror const.
      BVROR_VARIABLE
      Encodes a word-level constraint of the form u == x ror y.
      BVSGE
      Encodes a word-level constraint of the form x >= const or x >= y (signed).
      BVSGE_CONSTANT
      Encodes a word-level constraint of the form x >= const (signed).
      BVSGE_VARIABLE
      Encodes a word-level constraint of the form x >= y (signed).
      BVSGT
      Encodes a word-level constraint of the form x > const or x > y (signed).
      BVSGT_CONSTANT
      Encodes a word-level constraint of the form x > const (signed).
      BVSGT_VARIABLE
      Encodes a word-level constraint of the form x > y (signed).
      BVSLE
      Encodes a word-level constraint of the form x <= const or x <= y (signed).
      BVSLE_CONSTANT
      Encodes a word-level constraint of the form x <= const (signed).
      BVSLE_VARIABLE
      Encodes a word-level constraint of the form x <= y (signed).
      BVSLT
      Encodes a word-level constraint of the form x < const or x < y (signed).
      BVSLT_CONSTANT
      Encodes a word-level constraint of the form x < const (signed).
      BVSLT_VARIABLE
      Encodes a word-level constraint of the form x < y (signed).
      BVUGE
      Encodes a word-level constraint of the form x >= const or x >= y (unsigned).
      BVUGE_CONSTANT
      Encodes a word-level constraint of the form x >= const (unsigned).
      BVUGE_VARIABLE
      Encodes a word-level constraint of the form x >= y (unsigned).
      BVUGT
      Encodes a word-level constraint of the form x > const or x > y (unsigned).
      BVUGT_CONSTANT
      Encodes a word-level constraint of the form x > const (unsigned).
      BVUGT_VARIABLE
      Encodes a word-level constraint of the form x > y (unsigned).
      BVULE
      Encodes a word-level constraint of the form x <= const or x <= y.
      BVULE_CONSTANT
      Encodes a word-level constraint of the form x <= const (unsigned).
      BVULE_VARIABLE
      Encodes a word-level constraint of the form x <= y (unsigned).
      BVULT
      Encodes a word-level constraint of the form x < const or x < y (unsigned).
      BVULT_CONSTANT
      Encodes a word-level constraint of the form x < const (unsigned).
      BVULT_VARIABLE
      Encodes a word-level constraint of the form x < y (unsigned).
      BVXOR
      Encodes a word-level constraint of the form u == x ^ const or u == x ^ y.
      BVXOR_CONSTANT
      Encodes a word-level constraint of the form u == x ^ const.
      BVXOR_VARIABLE
      Encodes a word-level constraint of the form u == x ^ y.
      EQ
      Encodes a word-level constraint of the form x == const or x == y.
      EQ_CONSTANT
      Encodes a word-level constraint of the form x == const.
      EQ_VARIABLE
      Encodes a word-level constraint of the form x == y.
      EQUIV
      Encodes an equivalence of 2 boolean variables, i.e.
      FALSE
      Encodes the false constant.
      IMPL
      Encodes an implication of 2 boolean variables, i.e.
      ITE
      Encodes an if-then-else operation, i.e.
      NOTEQ
      Encodes a word-level constraint of the form x != const or x != y.
      NOTEQ_CONSTANT
      Encodes a word-level constraint of the form x != const.
      NOTEQ_VARIABLE
      Encodes a word-level constraint of the form x != y.
      OR
      Encodes a disjunction of n boolean variables, i.e.
      TRUE
      Encodes the true constant.
      VOTE
      Encodes a voting functions of 3 boolean variables, i.e.
      XOR
      Encodes an exclusive disjunction of n boolean variables, i.e.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<IntArray> encode​(BitBlaster.Operand[] operands, int flagIndex, java.util.function.IntSupplier newIndex)
      Encodes a word-level constraint linked to a flag, i.e.
      java.util.Collection<IntArray> encode​(BitBlaster.Operand[] operands, int flagIndex, java.util.function.IntSupplier newIndex, boolean negation)
      Encodes a word-level constraint linked to a flag, i.e.
      java.util.Collection<IntArray> encode​(BitBlaster.Operand[] operands, java.util.function.IntSupplier newIndex)
      Encodes a word-level constraint to the bit-level CNF.
      java.util.Collection<IntArray> encode​(BitBlaster.Operand[] operands, java.util.function.IntSupplier newIndex, boolean negation)
      Encodes a word-level constraint to the bit-level CNF.
      abstract java.util.Collection<IntArray> encodeNegative​(BitBlaster.Operand[] operands, java.util.function.IntSupplier newIndex)
      Encodes the negation of a word-level constraint to the bit-level CNF.
      abstract java.util.Collection<IntArray> encodePositive​(BitBlaster.Operand[] operands, java.util.function.IntSupplier newIndex)
      Encodes a word-level constraint to the bit-level CNF.
      static java.util.Collection<IntArray> linkToFlag​(int flagIndex, java.util.Collection<IntArray> positiveClauses, java.util.Collection<IntArray> negativeClauses)
      Encodes the constraint of the form f <=> C.
      static java.util.Collection<IntArray> linkToFlag​(int flagIndex, java.util.Collection<IntArray> positiveClauses, java.util.Collection<IntArray> negativeClauses, boolean negation)
      Encodes the constraint of the form f <=> C.
      static BitBlaster valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static BitBlaster[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • TRUE

        public static final BitBlaster TRUE
        Encodes the true constant.
      • FALSE

        public static final BitBlaster FALSE
        Encodes the false constant.
      • AND

        public static final BitBlaster AND
        Encodes a conjunction of n boolean variables, i.e. x[0] & ... & x[n-1].
      • OR

        public static final BitBlaster OR
        Encodes a disjunction of n boolean variables, i.e. x[0] | ... | x[n-1].
      • XOR

        public static final BitBlaster XOR
        Encodes an exclusive disjunction of n boolean variables, i.e. x[0] ^ ... ^ x[n-1].
      • IMPL

        public static final BitBlaster IMPL
        Encodes an implication of 2 boolean variables, i.e. x -> y.
      • EQUIV

        public static final BitBlaster EQUIV
        Encodes an equivalence of 2 boolean variables, i.e. x <-> y.
      • ITE

        public static final BitBlaster ITE
        Encodes an if-then-else operation, i.e. x ? y : z.
      • VOTE

        public static final BitBlaster VOTE
        Encodes a voting functions of 3 boolean variables, i.e. (x & y) | (x & z) | (y & z).
      • EQ_CONSTANT

        public static final BitBlaster EQ_CONSTANT
        Encodes a word-level constraint of the form x == const.
      • EQ_VARIABLE

        public static final BitBlaster EQ_VARIABLE
        Encodes a word-level constraint of the form x == y.
      • EQ

        public static final BitBlaster EQ
        Encodes a word-level constraint of the form x == const or x == y.
      • NOTEQ_CONSTANT

        public static final BitBlaster NOTEQ_CONSTANT
        Encodes a word-level constraint of the form x != const.
      • NOTEQ_VARIABLE

        public static final BitBlaster NOTEQ_VARIABLE
        Encodes a word-level constraint of the form x != y.
      • NOTEQ

        public static final BitBlaster NOTEQ
        Encodes a word-level constraint of the form x != const or x != y.
      • BVULE_CONSTANT

        public static final BitBlaster BVULE_CONSTANT
        Encodes a word-level constraint of the form x <= const (unsigned).
      • BVULE_VARIABLE

        public static final BitBlaster BVULE_VARIABLE
        Encodes a word-level constraint of the form x <= y (unsigned).
      • BVULE

        public static final BitBlaster BVULE
        Encodes a word-level constraint of the form x <= const or x <= y.
      • BVULT_CONSTANT

        public static final BitBlaster BVULT_CONSTANT
        Encodes a word-level constraint of the form x < const (unsigned).
      • BVULT_VARIABLE

        public static final BitBlaster BVULT_VARIABLE
        Encodes a word-level constraint of the form x < y (unsigned).
      • BVULT

        public static final BitBlaster BVULT
        Encodes a word-level constraint of the form x < const or x < y (unsigned).
      • BVUGE_CONSTANT

        public static final BitBlaster BVUGE_CONSTANT
        Encodes a word-level constraint of the form x >= const (unsigned).
      • BVUGE_VARIABLE

        public static final BitBlaster BVUGE_VARIABLE
        Encodes a word-level constraint of the form x >= y (unsigned).
      • BVUGE

        public static final BitBlaster BVUGE
        Encodes a word-level constraint of the form x >= const or x >= y (unsigned).
      • BVUGT_CONSTANT

        public static final BitBlaster BVUGT_CONSTANT
        Encodes a word-level constraint of the form x > const (unsigned).
      • BVUGT_VARIABLE

        public static final BitBlaster BVUGT_VARIABLE
        Encodes a word-level constraint of the form x > y (unsigned).
      • BVUGT

        public static final BitBlaster BVUGT
        Encodes a word-level constraint of the form x > const or x > y (unsigned).
      • BVSLE_CONSTANT

        public static final BitBlaster BVSLE_CONSTANT
        Encodes a word-level constraint of the form x <= const (signed).
      • BVSLE_VARIABLE

        public static final BitBlaster BVSLE_VARIABLE
        Encodes a word-level constraint of the form x <= y (signed).
      • BVSLE

        public static final BitBlaster BVSLE
        Encodes a word-level constraint of the form x <= const or x <= y (signed).
      • BVSLT_CONSTANT

        public static final BitBlaster BVSLT_CONSTANT
        Encodes a word-level constraint of the form x < const (signed).
      • BVSLT_VARIABLE

        public static final BitBlaster BVSLT_VARIABLE
        Encodes a word-level constraint of the form x < y (signed).
      • BVSLT

        public static final BitBlaster BVSLT
        Encodes a word-level constraint of the form x < const or x < y (signed).
      • BVSGE_CONSTANT

        public static final BitBlaster BVSGE_CONSTANT
        Encodes a word-level constraint of the form x >= const (signed).
      • BVSGE_VARIABLE

        public static final BitBlaster BVSGE_VARIABLE
        Encodes a word-level constraint of the form x >= y (signed).
      • BVSGE

        public static final BitBlaster BVSGE
        Encodes a word-level constraint of the form x >= const or x >= y (signed).
      • BVSGT_CONSTANT

        public static final BitBlaster BVSGT_CONSTANT
        Encodes a word-level constraint of the form x > const (signed).
      • BVSGT_VARIABLE

        public static final BitBlaster BVSGT_VARIABLE
        Encodes a word-level constraint of the form x > y (signed).
      • BVSGT

        public static final BitBlaster BVSGT
        Encodes a word-level constraint of the form x > const or x > y (signed).
      • BVCONCAT

        public static final BitBlaster BVCONCAT
        Encodes a word-level constraint of the form u == x :: y.
      • BVNEG

        public static final BitBlaster BVNEG
        Encodes a word-level constraint of the form u == ~x or u == ~const.
      • BVAND_CONSTANT

        public static final BitBlaster BVAND_CONSTANT
        Encodes a word-level constraint of the form u == x & const.
      • BVAND_VARIABLE

        public static final BitBlaster BVAND_VARIABLE
        Encodes a word-level constraint of the form u == x & y.
      • BVAND

        public static final BitBlaster BVAND
        Encodes a word-level constraint of the form u == x & const or u == x & y.
      • BVOR_CONSTANT

        public static final BitBlaster BVOR_CONSTANT
        Encodes a word-level constraint of the form u == x | const.
      • BVOR_VARIABLE

        public static final BitBlaster BVOR_VARIABLE
        Encodes a word-level constraint of the form u == x | y.
      • BVOR

        public static final BitBlaster BVOR
        Encodes a word-level constraint of the form u == x | const or u == x | y.
      • BVXOR_CONSTANT

        public static final BitBlaster BVXOR_CONSTANT
        Encodes a word-level constraint of the form u == x ^ const.
      • BVXOR_VARIABLE

        public static final BitBlaster BVXOR_VARIABLE
        Encodes a word-level constraint of the form u == x ^ y.
      • BVXOR

        public static final BitBlaster BVXOR
        Encodes a word-level constraint of the form u == x ^ const or u == x ^ y.
      • BVNAND

        public static final BitBlaster BVNAND
        Encodes a word-level constraint of the form u == ~(x & const) or u == ~(x & y).
      • BVNOR

        public static final BitBlaster BVNOR
        Encodes a word-level constraint of the form u == ~(x | const) or u == ~(x | y).
      • BVADD_CONSTANT

        public static final BitBlaster BVADD_CONSTANT
        Encodes a word-level constraint of the form u == x + const.
      • BVADD_VARIABLE

        public static final BitBlaster BVADD_VARIABLE
        Encodes a word-level constraint of the form u == x + y.
      • BVADD

        public static final BitBlaster BVADD
        Encodes a word-level constraint of the form u == x + const or u == x + y.
      • BVLSHL_CONSTANT

        public static final BitBlaster BVLSHL_CONSTANT
        Encodes a word-level constraint of the form u == x << const.
      • BVLSHL_VARIABLE

        public static final BitBlaster BVLSHL_VARIABLE
        Encodes a word-level constraint of the form u == x << y.
      • BVLSHL

        public static final BitBlaster BVLSHL
        Encodes a word-level constraint of the form u == x << const or u == x << y.
      • BVLSHR_CONSTANT

        public static final BitBlaster BVLSHR_CONSTANT
        Encodes a word-level constraint of the form u == x >>> const.
      • BVLSHR_VARIABLE

        public static final BitBlaster BVLSHR_VARIABLE
        Encodes a word-level constraint of the form u == x >>> y.
      • BVLSHR

        public static final BitBlaster BVLSHR
        Encodes a word-level constraint of the form u == x >>> const or u == x >>> y.
      • BVASHL

        public static final BitBlaster BVASHL
        Encodes a word-level constraint of the form u == x << const or u == x << y.
      • BVASHR_CONSTANT

        public static final BitBlaster BVASHR_CONSTANT
        Encodes a word-level constraint of the form u == x >> const.
      • BVASHR_VARIABLE

        public static final BitBlaster BVASHR_VARIABLE
        Encodes a word-level constraint of the form u == x >> y.
      • BVASHR

        public static final BitBlaster BVASHR
        Encodes a word-level constraint of the form u == x >> const or u == x >> y.
      • BVROL_CONSTANT

        public static final BitBlaster BVROL_CONSTANT
        Encodes a word-level constraint of the form u == x rol const.
      • BVROL_VARIABLE

        public static final BitBlaster BVROL_VARIABLE
        Encodes a word-level constraint of the form u == x rol y.
      • BVROL

        public static final BitBlaster BVROL
        Encodes a word-level constraint of the form u == x rol const or u == x rol y.
      • BVROR_CONSTANT

        public static final BitBlaster BVROR_CONSTANT
        Encodes a word-level constraint of the form u == x ror const.
      • BVROR_VARIABLE

        public static final BitBlaster BVROR_VARIABLE
        Encodes a word-level constraint of the form u == x ror y.
      • BVROR

        public static final BitBlaster BVROR
        Encodes a word-level constraint of the form u == x ror const or u == x ror y.
    • Method Detail

      • values

        public static BitBlaster[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BitBlaster c : BitBlaster.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BitBlaster valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • linkToFlag

        public static java.util.Collection<IntArray> linkToFlag​(int flagIndex,
                                                                java.util.Collection<IntArray> positiveClauses,
                                                                java.util.Collection<IntArray> negativeClauses)
        Encodes the constraint of the form f <=> C.
        Parameters:
        flagIndex - the flag index (@{code f}).
        positiveClauses - the positive clauses (@{code C}).
        negativeClauses - the negative clauses (@{code ~C}).
        Returns:
        the CNF.
      • linkToFlag

        public static java.util.Collection<IntArray> linkToFlag​(int flagIndex,
                                                                java.util.Collection<IntArray> positiveClauses,
                                                                java.util.Collection<IntArray> negativeClauses,
                                                                boolean negation)
        Encodes the constraint of the form f <=> C.
        Parameters:
        flagIndex - the flag index (@{code f}).
        positiveClauses - the positive clauses (@{code C}).
        negativeClauses - the negative clauses (@{code ~C}).
        negation - the negation flag.
        Returns:
        the CNF.
      • encodePositive

        public abstract java.util.Collection<IntArray> encodePositive​(BitBlaster.Operand[] operands,
                                                                      java.util.function.IntSupplier newIndex)
        Encodes a word-level constraint to the bit-level CNF.
        Parameters:
        operands - the operands of the constraint.
        newIndex - the supplier of a new boolean variable index.
        Returns:
        the CNF.
      • encodeNegative

        public abstract java.util.Collection<IntArray> encodeNegative​(BitBlaster.Operand[] operands,
                                                                      java.util.function.IntSupplier newIndex)
        Encodes the negation of a word-level constraint to the bit-level CNF.
        Parameters:
        operands - the operands of the constraint.
        newIndex - the supplier of a new boolean variable index.
        Returns:
        the CNF.
      • encode

        public final java.util.Collection<IntArray> encode​(BitBlaster.Operand[] operands,
                                                           java.util.function.IntSupplier newIndex)
        Encodes a word-level constraint to the bit-level CNF.
        Parameters:
        operands - the operands of the constraint.
        newIndex - the supplier of a new boolean variable index.
        Returns:
        the CNF.
      • encode

        public final java.util.Collection<IntArray> encode​(BitBlaster.Operand[] operands,
                                                           java.util.function.IntSupplier newIndex,
                                                           boolean negation)
        Encodes a word-level constraint to the bit-level CNF.
        Parameters:
        operands - the operands of the constraint.
        newIndex - the supplier of a new boolean variable index.
        negation - the negation flag.
        Returns:
        the CNF.
      • encode

        public final java.util.Collection<IntArray> encode​(BitBlaster.Operand[] operands,
                                                           int flagIndex,
                                                           java.util.function.IntSupplier newIndex,
                                                           boolean negation)
        Encodes a word-level constraint linked to a flag, i.e. f <=> C.

        If the flag is zero, encodes the constraints w/o linking it to the flag, i.e. C.

        Parameters:
        operands - the operands of the constraint.
        flagIndex - the flag index (if zero, .
        newIndex - the supplier of a new boolean variable index.
        negation - the negation flag.
        Returns:
        the CNF.
      • encode

        public final java.util.Collection<IntArray> encode​(BitBlaster.Operand[] operands,
                                                           int flagIndex,
                                                           java.util.function.IntSupplier newIndex)
        Encodes a word-level constraint linked to a flag, i.e. f <=> C.

        If the flag is zero, encodes the constraints w/o linking it to the flag, i.e. C.

        Parameters:
        operands - the operands of the constraint.
        flagIndex - the flag index (if zero, .
        newIndex - the supplier of a new boolean variable index.
        Returns:
        the CNF.