Extend Must Analysis
[satune.git] / src / csolver.h
index bd90bf3054a5cbf85e4b506097391c2786e51d7d..b35f80100b278d6846b77eaefaa3e3aded85e134 100644 (file)
@@ -5,6 +5,7 @@
 #include "structs.h"
 
 struct CSolver {
+       SATEncoder* satEncoder;
        /** This is a vector of constraints that must be satisfied. */
        VectorBoolean * constraints;
 
@@ -64,6 +65,9 @@ uint64_t createUniqueItem(CSolver *, MutableSet * set);
 
 Element * getElementVar(CSolver *, Set * set);
 
+/** This function creates an element constrant. */
+Element * getElementConst(CSolver *, VarType type, uint64_t value);
+
 /** This function creates a boolean variable. */
 
 Boolean * getBooleanVar(CSolver *, VarType type);
@@ -77,17 +81,20 @@ Function * createFunctionOperator(CSolver *solver, ArithOp op, Set ** domain, ui
 
 Predicate * createPredicateOperator(CSolver *solver, CompOp op, Set ** domain, uint numDomain);
 
+Predicate * createPredicateTable(CSolver *solver, Table* table, UndefinedBehavior behavior);
+
 /** This function creates an empty instance table.*/
 
 Table * createTable(CSolver *solver, Set **domains, uint numDomain, Set * range);
 
+Table * createTableForPredicate(CSolver *solver, Set **domains, uint numDomain);
 /** This function adds an input output relation to a table. */
 
 void addTableEntry(CSolver *solver, Table* table, uint64_t* inputs, uint inputSize, uint64_t result);
 
 /** This function converts a completed table into a function. */
 
-Function * completeTable(CSolver *, Table *);
+Function * completeTable(CSolver *, Table *, UndefinedBehavior behavior);
 
 /** This function applies a function to the Elements in its input. */
 
@@ -95,6 +102,8 @@ Element * applyFunction(CSolver *, Function * function, Element ** array, uint n
 
 /** This function applies a predicate to the Elements in its input. */
 
+Boolean * applyPredicateTable(CSolver *, Predicate * predicate, Element ** inputs, uint numInputs, Boolean* undefinedStatus);
+
 Boolean * applyPredicate(CSolver *, Predicate * predicate, Element ** inputs, uint numInputs);
 
 /** This function applies a logical operation to the Booleans in its input. */
@@ -104,7 +113,7 @@ Boolean * applyLogicalOperation(CSolver *, LogicOp op, Boolean ** array, uint as
 /** This function adds a boolean constraint to the set of constraints
     to be satisfied */
 
-void addBoolean(CSolver *, Boolean * constraint);
+void addConstraint(CSolver *, Boolean * constraint);
 
 /** This function instantiates an order of type type over the set set. */
 Order * createOrder(CSolver *, OrderType type, Set * set);
@@ -113,5 +122,14 @@ Order * createOrder(CSolver *, OrderType type, Set * set);
 Boolean * orderConstraint(CSolver *, Order * order, uint64_t first, uint64_t second);
 
 /** When everything is done, the client calls this function and then csolver starts to encode*/
-void startEncoding(CSolver*);
+int startEncoding(CSolver*);
+
+/** After getting the solution from the SAT solver, client can get the value of an element via this function*/
+uint64_t getElementValue(CSolver*, Element* element);
+
+/** After getting the solution from the SAT solver, client can get the value of a boolean via this function*/
+bool getBooleanValue( CSolver* , Boolean* boolean);
+
+HappenedBefore getOrderConstraintValue(CSolver*, Order * order, uint64_t first, uint64_t second);
+
 #endif