if (src != NULL && !isProxy(src) && getLitSizeCNF(src) == 0) {
if (dest == NULL) {
*dest = allocCNFExprBool(negate ? alwaysFalseCNF(src) : alwaysTrueCNF(src));
- } else if (isProxy(dest)) {
+ } else if (isProxy(*dest)) {
bool alwaysTrue = (negate ? alwaysFalseCNF(src) : alwaysTrueCNF(src));
if (alwaysTrue) {
- Literal clause[] = {getProxy(dest)};
+ Literal clause[] = {getProxy(*dest)};
addArrayClauseLiteral(cnf->solver, 1, clause);
} else {
- Literal clause[] = {-getProxy(dest)};
+ Literal clause[] = {-getProxy(*dest)};
addArrayClauseLiteral(cnf->solver, 1, clause);
}
*dest = allocCNFExprBool(negate ? alwaysFalseCNF(src) : alwaysTrueCNF(src));
} else {
- clearCNFExpr(dest, negate ? alwaysFalseCNF(src) : alwaysTrueCNF(src));
+ clearCNFExpr(*dest, negate ? alwaysFalseCNF(src) : alwaysTrueCNF(src));
}
return true;
}
return (Literal) (((intptr_t) expr) >> 1);
}
+CNF * createCNF();
+void deleteCNF(CNF * cnf);
+
uint hashNode(NodeType type, uint numEdges, Edge * edges);
Node * allocNode(NodeType type, uint numEdges, Edge * edges, uint hashCode);
bool compareNodes(Node * node, NodeType type, uint numEdges, Edge *edges);
Edge constraintNewVar(CNF *cnf);
void countPass(CNF *cnf);
void countConstraint(CNF *cnf, VectorEdge * stack, Edge e);
+void addConstraint(CNF *cnf, Edge constraint);
+
+
+
void convertPass(CNF *cnf, bool backtrackLit);
void convertConstraint(CNF *cnf, VectorEdge *stack, Edge e, bool backtrackLit);
void constrainCNF(CNF * cnf, Literal l, CNFExpr *exp);
DEPS := $(join $(addsuffix ., $(dir $(OBJECTS))), $(addsuffix .d, $(notdir $(OBJECTS))))
-CPPFLAGS += -I$(BASE) -I$(BASE)/AST -I$(BASE)/Collections
+CPPFLAGS += -I$(BASE) -I$(BASE)/AST -I$(BASE)/Collections -I$(BASE)/Backend
all: $(OBJECTS) ../bin/run.sh
--- /dev/null
+#include "nodeedge.h"
+
+int main(int numargs, char ** argv) {
+ CNF *cnf=createCNF();
+ Edge v1=constraintNewVar(cnf);
+ Edge v2=constraintNewVar(cnf);
+ Edge v3=constraintNewVar(cnf);
+ Edge nv1=constraintNegate(v1);
+ Edge nv2=constraintNegate(v2);
+ Edge iff1=constraintIFF(cnf, nv1, v2);
+ Edge iff2=constraintIFF(cnf, nv2, v3);
+ Edge iff3=constraintIFF(cnf, v3, nv1);
+ Edge cand=constraintAND(cnf, 3, (Edge[]) {iff1, iff2, iff3});
+ addConstraint(cnf, cand);
+ deleteCNF(cnf);
+}