Package ru.ispras.fortress.logic
Enum BitBlaster
- java.lang.Object
-
- java.lang.Enum<BitBlaster>
-
- ru.ispras.fortress.logic.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 formu == x + const
oru == x + y
.BVADD_CONSTANT
Encodes a word-level constraint of the formu == x + const
.BVADD_VARIABLE
Encodes a word-level constraint of the formu == x + y
.BVAND
Encodes a word-level constraint of the formu == x & const
oru == x & y
.BVAND_CONSTANT
Encodes a word-level constraint of the formu == x & const
.BVAND_VARIABLE
Encodes a word-level constraint of the formu == x & y
.BVASHL
Encodes a word-level constraint of the formu == x << const
oru == x << y
.BVASHR
Encodes a word-level constraint of the formu == x >> const
oru == x >> y
.BVASHR_CONSTANT
Encodes a word-level constraint of the formu == x >> const
.BVASHR_VARIABLE
Encodes a word-level constraint of the formu == x >> y
.BVCONCAT
Encodes a word-level constraint of the formu == x :: y
.BVLSHL
Encodes a word-level constraint of the formu == x << const
oru == x << y
.BVLSHL_CONSTANT
Encodes a word-level constraint of the formu == x << const
.BVLSHL_VARIABLE
Encodes a word-level constraint of the formu == x << y
.BVLSHR
Encodes a word-level constraint of the formu == x >>> const
oru == x >>> y
.BVLSHR_CONSTANT
Encodes a word-level constraint of the formu == x >>> const
.BVLSHR_VARIABLE
Encodes a word-level constraint of the formu == x >>> y
.BVNAND
Encodes a word-level constraint of the formu == ~(x & const)
oru == ~(x & y)
.BVNEG
Encodes a word-level constraint of the formu == ~x
oru == ~const
.BVNOR
Encodes a word-level constraint of the formu == ~(x | const)
oru == ~(x | y)
.BVOR
Encodes a word-level constraint of the formu == x | const
oru == x | y
.BVOR_CONSTANT
Encodes a word-level constraint of the formu == x | const
.BVOR_VARIABLE
Encodes a word-level constraint of the formu == x | y
.BVROL
Encodes a word-level constraint of the formu == x rol const
oru == x rol y
.BVROL_CONSTANT
Encodes a word-level constraint of the formu == x rol const
.BVROL_VARIABLE
Encodes a word-level constraint of the formu == x rol y
.BVROR
Encodes a word-level constraint of the formu == x ror const
oru == x ror y
.BVROR_CONSTANT
Encodes a word-level constraint of the formu == x ror const
.BVROR_VARIABLE
Encodes a word-level constraint of the formu == x ror y
.BVSGE
Encodes a word-level constraint of the formx >= const
orx >= y
(signed).BVSGE_CONSTANT
Encodes a word-level constraint of the formx >= const
(signed).BVSGE_VARIABLE
Encodes a word-level constraint of the formx >= y
(signed).BVSGT
Encodes a word-level constraint of the formx > const
orx > y
(signed).BVSGT_CONSTANT
Encodes a word-level constraint of the formx > const
(signed).BVSGT_VARIABLE
Encodes a word-level constraint of the formx > y
(signed).BVSLE
Encodes a word-level constraint of the formx <= const
orx <= y
(signed).BVSLE_CONSTANT
Encodes a word-level constraint of the formx <= const
(signed).BVSLE_VARIABLE
Encodes a word-level constraint of the formx <= y
(signed).BVSLT
Encodes a word-level constraint of the formx < const
orx < y
(signed).BVSLT_CONSTANT
Encodes a word-level constraint of the formx < const
(signed).BVSLT_VARIABLE
Encodes a word-level constraint of the formx < y
(signed).BVUGE
Encodes a word-level constraint of the formx >= const
orx >= y
(unsigned).BVUGE_CONSTANT
Encodes a word-level constraint of the formx >= const
(unsigned).BVUGE_VARIABLE
Encodes a word-level constraint of the formx >= y
(unsigned).BVUGT
Encodes a word-level constraint of the formx > const
orx > y
(unsigned).BVUGT_CONSTANT
Encodes a word-level constraint of the formx > const
(unsigned).BVUGT_VARIABLE
Encodes a word-level constraint of the formx > y
(unsigned).BVULE
Encodes a word-level constraint of the formx <= const
orx <= y
.BVULE_CONSTANT
Encodes a word-level constraint of the formx <= const
(unsigned).BVULE_VARIABLE
Encodes a word-level constraint of the formx <= y
(unsigned).BVULT
Encodes a word-level constraint of the formx < const
orx < y
(unsigned).BVULT_CONSTANT
Encodes a word-level constraint of the formx < const
(unsigned).BVULT_VARIABLE
Encodes a word-level constraint of the formx < y
(unsigned).BVXOR
Encodes a word-level constraint of the formu == x ^ const
oru == x ^ y
.BVXOR_CONSTANT
Encodes a word-level constraint of the formu == x ^ const
.BVXOR_VARIABLE
Encodes a word-level constraint of the formu == x ^ y
.EQ
Encodes a word-level constraint of the formx == const
orx == y
.EQ_CONSTANT
Encodes a word-level constraint of the formx == const
.EQ_VARIABLE
Encodes a word-level constraint of the formx == 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 formx != const
orx != y
.NOTEQ_CONSTANT
Encodes a word-level constraint of the formx != const
.NOTEQ_VARIABLE
Encodes a word-level constraint of the formx != 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 formf <=> 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 formf <=> 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.
-
-
-
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 formx == const
.
-
EQ_VARIABLE
public static final BitBlaster EQ_VARIABLE
Encodes a word-level constraint of the formx == y
.
-
EQ
public static final BitBlaster EQ
Encodes a word-level constraint of the formx == const
orx == y
.
-
NOTEQ_CONSTANT
public static final BitBlaster NOTEQ_CONSTANT
Encodes a word-level constraint of the formx != const
.
-
NOTEQ_VARIABLE
public static final BitBlaster NOTEQ_VARIABLE
Encodes a word-level constraint of the formx != y
.
-
NOTEQ
public static final BitBlaster NOTEQ
Encodes a word-level constraint of the formx != const
orx != y
.
-
BVULE_CONSTANT
public static final BitBlaster BVULE_CONSTANT
Encodes a word-level constraint of the formx <= const
(unsigned).
-
BVULE_VARIABLE
public static final BitBlaster BVULE_VARIABLE
Encodes a word-level constraint of the formx <= y
(unsigned).
-
BVULE
public static final BitBlaster BVULE
Encodes a word-level constraint of the formx <= const
orx <= y
.
-
BVULT_CONSTANT
public static final BitBlaster BVULT_CONSTANT
Encodes a word-level constraint of the formx < const
(unsigned).
-
BVULT_VARIABLE
public static final BitBlaster BVULT_VARIABLE
Encodes a word-level constraint of the formx < y
(unsigned).
-
BVULT
public static final BitBlaster BVULT
Encodes a word-level constraint of the formx < const
orx < y
(unsigned).
-
BVUGE_CONSTANT
public static final BitBlaster BVUGE_CONSTANT
Encodes a word-level constraint of the formx >= const
(unsigned).
-
BVUGE_VARIABLE
public static final BitBlaster BVUGE_VARIABLE
Encodes a word-level constraint of the formx >= y
(unsigned).
-
BVUGE
public static final BitBlaster BVUGE
Encodes a word-level constraint of the formx >= const
orx >= y
(unsigned).
-
BVUGT_CONSTANT
public static final BitBlaster BVUGT_CONSTANT
Encodes a word-level constraint of the formx > const
(unsigned).
-
BVUGT_VARIABLE
public static final BitBlaster BVUGT_VARIABLE
Encodes a word-level constraint of the formx > y
(unsigned).
-
BVUGT
public static final BitBlaster BVUGT
Encodes a word-level constraint of the formx > const
orx > y
(unsigned).
-
BVSLE_CONSTANT
public static final BitBlaster BVSLE_CONSTANT
Encodes a word-level constraint of the formx <= const
(signed).
-
BVSLE_VARIABLE
public static final BitBlaster BVSLE_VARIABLE
Encodes a word-level constraint of the formx <= y
(signed).
-
BVSLE
public static final BitBlaster BVSLE
Encodes a word-level constraint of the formx <= const
orx <= y
(signed).
-
BVSLT_CONSTANT
public static final BitBlaster BVSLT_CONSTANT
Encodes a word-level constraint of the formx < const
(signed).
-
BVSLT_VARIABLE
public static final BitBlaster BVSLT_VARIABLE
Encodes a word-level constraint of the formx < y
(signed).
-
BVSLT
public static final BitBlaster BVSLT
Encodes a word-level constraint of the formx < const
orx < y
(signed).
-
BVSGE_CONSTANT
public static final BitBlaster BVSGE_CONSTANT
Encodes a word-level constraint of the formx >= const
(signed).
-
BVSGE_VARIABLE
public static final BitBlaster BVSGE_VARIABLE
Encodes a word-level constraint of the formx >= y
(signed).
-
BVSGE
public static final BitBlaster BVSGE
Encodes a word-level constraint of the formx >= const
orx >= y
(signed).
-
BVSGT_CONSTANT
public static final BitBlaster BVSGT_CONSTANT
Encodes a word-level constraint of the formx > const
(signed).
-
BVSGT_VARIABLE
public static final BitBlaster BVSGT_VARIABLE
Encodes a word-level constraint of the formx > y
(signed).
-
BVSGT
public static final BitBlaster BVSGT
Encodes a word-level constraint of the formx > const
orx > y
(signed).
-
BVCONCAT
public static final BitBlaster BVCONCAT
Encodes a word-level constraint of the formu == x :: y
.
-
BVNEG
public static final BitBlaster BVNEG
Encodes a word-level constraint of the formu == ~x
oru == ~const
.
-
BVAND_CONSTANT
public static final BitBlaster BVAND_CONSTANT
Encodes a word-level constraint of the formu == x & const
.
-
BVAND_VARIABLE
public static final BitBlaster BVAND_VARIABLE
Encodes a word-level constraint of the formu == x & y
.
-
BVAND
public static final BitBlaster BVAND
Encodes a word-level constraint of the formu == x & const
oru == x & y
.
-
BVOR_CONSTANT
public static final BitBlaster BVOR_CONSTANT
Encodes a word-level constraint of the formu == x | const
.
-
BVOR_VARIABLE
public static final BitBlaster BVOR_VARIABLE
Encodes a word-level constraint of the formu == x | y
.
-
BVOR
public static final BitBlaster BVOR
Encodes a word-level constraint of the formu == x | const
oru == x | y
.
-
BVXOR_CONSTANT
public static final BitBlaster BVXOR_CONSTANT
Encodes a word-level constraint of the formu == x ^ const
.
-
BVXOR_VARIABLE
public static final BitBlaster BVXOR_VARIABLE
Encodes a word-level constraint of the formu == x ^ y
.
-
BVXOR
public static final BitBlaster BVXOR
Encodes a word-level constraint of the formu == x ^ const
oru == x ^ y
.
-
BVNAND
public static final BitBlaster BVNAND
Encodes a word-level constraint of the formu == ~(x & const)
oru == ~(x & y)
.
-
BVNOR
public static final BitBlaster BVNOR
Encodes a word-level constraint of the formu == ~(x | const)
oru == ~(x | y)
.
-
BVADD_CONSTANT
public static final BitBlaster BVADD_CONSTANT
Encodes a word-level constraint of the formu == x + const
.
-
BVADD_VARIABLE
public static final BitBlaster BVADD_VARIABLE
Encodes a word-level constraint of the formu == x + y
.
-
BVADD
public static final BitBlaster BVADD
Encodes a word-level constraint of the formu == x + const
oru == x + y
.
-
BVLSHL_CONSTANT
public static final BitBlaster BVLSHL_CONSTANT
Encodes a word-level constraint of the formu == x << const
.
-
BVLSHL_VARIABLE
public static final BitBlaster BVLSHL_VARIABLE
Encodes a word-level constraint of the formu == x << y
.
-
BVLSHL
public static final BitBlaster BVLSHL
Encodes a word-level constraint of the formu == x << const
oru == x << y
.
-
BVLSHR_CONSTANT
public static final BitBlaster BVLSHR_CONSTANT
Encodes a word-level constraint of the formu == x >>> const
.
-
BVLSHR_VARIABLE
public static final BitBlaster BVLSHR_VARIABLE
Encodes a word-level constraint of the formu == x >>> y
.
-
BVLSHR
public static final BitBlaster BVLSHR
Encodes a word-level constraint of the formu == x >>> const
oru == x >>> y
.
-
BVASHL
public static final BitBlaster BVASHL
Encodes a word-level constraint of the formu == x << const
oru == x << y
.
-
BVASHR_CONSTANT
public static final BitBlaster BVASHR_CONSTANT
Encodes a word-level constraint of the formu == x >> const
.
-
BVASHR_VARIABLE
public static final BitBlaster BVASHR_VARIABLE
Encodes a word-level constraint of the formu == x >> y
.
-
BVASHR
public static final BitBlaster BVASHR
Encodes a word-level constraint of the formu == x >> const
oru == x >> y
.
-
BVROL_CONSTANT
public static final BitBlaster BVROL_CONSTANT
Encodes a word-level constraint of the formu == x rol const
.
-
BVROL_VARIABLE
public static final BitBlaster BVROL_VARIABLE
Encodes a word-level constraint of the formu == x rol y
.
-
BVROL
public static final BitBlaster BVROL
Encodes a word-level constraint of the formu == x rol const
oru == x rol y
.
-
BVROR_CONSTANT
public static final BitBlaster BVROR_CONSTANT
Encodes a word-level constraint of the formu == x ror const
.
-
BVROR_VARIABLE
public static final BitBlaster BVROR_VARIABLE
Encodes a word-level constraint of the formu == x ror y
.
-
BVROR
public static final BitBlaster BVROR
Encodes a word-level constraint of the formu == x ror const
oru == 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 namejava.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 formf <=> 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 formf <=> 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.
-
-