12 SATEncoder *satEncoder;
16 /** This is a vector of constraints that must be satisfied. */
17 HashSetBoolean constraints;
19 /** This is a vector of all boolean structs that we have allocated. */
20 Vector<Boolean *> allBooleans;
22 /** This is a vector of all set structs that we have allocated. */
23 Vector<Set *> allSets;
25 /** This is a vector of all element structs that we have allocated. */
26 Vector<Element *> allElements;
28 /** This is a vector of all predicate structs that we have allocated. */
29 Vector<Predicate *> allPredicates;
31 /** This is a vector of all table structs that we have allocated. */
32 Vector<Table *> allTables;
34 /** This is a vector of all order structs that we have allocated. */
35 Vector<Order *> allOrders;
37 /** This is a vector of all function structs that we have allocated. */
38 Vector<Function *> allFunctions;
40 /** This function creates a set containing the elements passed in the array. */
42 Set *createSet(VarType type, uint64_t *elements, uint num);
44 /** This function creates a set from lowrange to highrange (inclusive). */
46 Set *createRangeSet(VarType type, uint64_t lowrange, uint64_t highrange);
48 /** This function creates a mutable set. */
50 MutableSet *createMutableSet(VarType type);
52 /** This function adds a new item to a set. */
54 void addItem(MutableSet *set, uint64_t element);
56 /** This function adds a new unique item to the set and returns it.
57 This function cannot be used in conjunction with manually adding
60 uint64_t createUniqueItem(MutableSet *set);
62 /** This function creates an element variable over a set. */
64 Element *getElementVar(Set *set);
66 /** This function creates an element constrant. */
67 Element *getElementConst(VarType type, uint64_t value);
69 /** This function creates a boolean variable. */
71 Boolean *getBooleanVar(VarType type);
73 /** This function creates a function operator. */
75 Function *createFunctionOperator(ArithOp op, Set **domain, uint numDomain, Set *range,
76 OverFlowBehavior overflowbehavior);
78 /** This function creates a predicate operator. */
80 Predicate *createPredicateOperator(CompOp op, Set **domain, uint numDomain);
82 Predicate *createPredicateTable(Table *table, UndefinedBehavior behavior);
84 /** This function creates an empty instance table.*/
86 Table *createTable(Set **domains, uint numDomain, Set *range);
88 Table *createTableForPredicate(Set **domains, uint numDomain);
89 /** This function adds an input output relation to a table. */
91 void addTableEntry(Table *table, uint64_t *inputs, uint inputSize, uint64_t result);
93 /** This function converts a completed table into a function. */
95 Function *completeTable(Table *, UndefinedBehavior behavior);
97 /** This function applies a function to the Elements in its input. */
99 Element *applyFunction(Function *function, Element **array, uint numArrays, Boolean *overflowstatus);
101 /** This function applies a predicate to the Elements in its input. */
103 Boolean *applyPredicateTable(Predicate *predicate, Element **inputs, uint numInputs, Boolean *undefinedStatus);
105 Boolean *applyPredicate(Predicate *predicate, Element **inputs, uint numInputs);
107 /** This function applies a logical operation to the Booleans in its input. */
109 Boolean *applyLogicalOperation(LogicOp op, Boolean **array, uint asize);
111 /** This function adds a boolean constraint to the set of constraints
114 void addConstraint(Boolean *constraint);
116 /** This function instantiates an order of type type over the set set. */
117 Order *createOrder(OrderType type, Set *set);
119 /** This function instantiates a boolean on two items in an order. */
120 Boolean *orderConstraint(Order *order, uint64_t first, uint64_t second);
122 /** When everything is done, the client calls this function and then csolver starts to encode*/
125 /** After getting the solution from the SAT solver, client can get the value of an element via this function*/
126 uint64_t getElementValue(Element *element);
128 /** After getting the solution from the SAT solver, client can get the value of a boolean via this function*/
129 bool getBooleanValue(Boolean *boolean);
131 HappenedBefore getOrderConstraintValue(Order *order, uint64_t first, uint64_t second);