int
Rbc_Convert2Cnf(
Rbc_Manager_t * rbcManager,
Rbc_t * f,
lsList clauses,
lsList vars
)
- Given `rbcManager' and `f', `clauses' is filled with the
disjunctions corresponding to the rbc nodes according to
the rules:
f = A & B => -f A f = A <-> B => f A B
-f B f -A -B
f -A -B -f -A B
-f A -B
`vars' is filled with the variables that occurred in `f'
(original or model variables). It is user's responsibility
to create `clauses' and `vars' *before* calling the function.
New variables are added by the conversion: the maximum
index (the last added variable) is returned by the function.
The function returns 0 when `f' is true or false.
- Side Effects `clauses' and `vars' are filled up. `clauses' is the empty
list if `f' was true, and contains a single empty clause if
`f' was false.
Rbc_t *
Rbc_GetIthVar(
Rbc_Manager_t * rbcManager,
int varIndex
)
- Returns a pointer to an rbc node containing the requested
variable. Works in three steps:
- the requested variable index exceeds the current capacity:
allocated more room up to the requested index;
- the variable node does not exists: inserts it in the dag
and makes it permanent;
- returns the variable node.
- Side Effects none
Rbc_t *
Rbc_GetLeftOpnd(
Rbc_t * f
)
- Gets the left operand.
- Side Effects none
Rbc_t *
Rbc_GetOne(
Rbc_Manager_t * rbcManager
)
- Returns the rbc that stands for logical truth.
- Side Effects none
Rbc_t *
Rbc_GetRightOpnd(
Rbc_t * f
)
- Gets the right operand.
- Side Effects none
int
Rbc_GetVarIndex(
Rbc_t * f
)
- Returns the variable index,
-1 if the rbc is not a variable.
- Side Effects none
Rbc_t *
Rbc_GetZero(
Rbc_Manager_t * rbcManager
)
- Returns the rbc that stands for logical falsity.
- Side Effects none
Rbc_t *
Rbc_MakeAnd(
Rbc_Manager_t * rbcManager,
Rbc_t * left,
Rbc_t * right,
Rbc_Bool_c sign
)
- Makes the conjunction of two rbcs.
Works in three steps:
- performs boolean simplification: if successfull, returns
the result of the simplification;
- orders left and right son pointers;
- looks up the formula in the dag and returns it.
- Side Effects none
Rbc_t *
Rbc_MakeIff(
Rbc_Manager_t * rbcManager,
Rbc_t * left,
Rbc_t * right,
Rbc_Bool_c sign
)
- Makes the coimplication of two rbcs.
Works in four steps:
- performs boolean simplification: if successfull, returns
the result of the simplification;
- orders left and right son pointers;
- re-encodes the negation
- looks up the formula in the dag and returns it.
- Side Effects none
Rbc_t *
Rbc_MakeIte(
Rbc_Manager_t * rbcManager,
Rbc_t * c,
Rbc_t * t,
Rbc_t * e,
Rbc_Bool_c sign
)
- Makes the if-then-else of three rbcs: expands the connective
into the corresponding product-of-sums.
- Side Effects none
Rbc_t *
Rbc_MakeNot(
Rbc_Manager_t * rbcManager,
Rbc_t * left
)
- Returns the complement of an rbc.
- Side Effects none
Rbc_t *
Rbc_MakeOr(
Rbc_Manager_t * rbcManager,
Rbc_t * left,
Rbc_t * right,
Rbc_Bool_c sign
)
- Makes the disjunction of two rbcs: casts the connective to
the negation of a conjunction using De Morgan's law.
- Side Effects none
Rbc_t *
Rbc_MakeXor(
Rbc_Manager_t * rbcManager,
Rbc_t * left,
Rbc_t * right,
Rbc_Bool_c sign
)
- Makes the exclusive disjunction of two rbcs: casts the
connective as the negation of a coimplication.
- Side Effects none
Rbc_Manager_t *
Rbc_ManagerAlloc(
int varCapacity
)
- Creates a new RBC manager:
- varCapacity how big is the variable index
(this number must be strictly greater than 0)
Returns the allocated manager if varCapacity is greater than 0,
and NIL(Rbc_Manager_t) otherwise.
- Side Effects none
- See Also
Rbc_ManagerFree
int
Rbc_ManagerCapacity(
Rbc_Manager_t * rbcManager
)
- This number is the maximum number of variables (starting from 0)
that can be requested without causing any memory allocation.
- Side Effects none
void
Rbc_ManagerFree(
Rbc_Manager_t * rbcManager
)
- Frees the variable index and the internal dag manager.
- Side Effects none
void
Rbc_ManagerGC(
Rbc_Manager_t * rbcManager
)
- Relies on the internal DAG garbage collector.
- Side Effects None
void
Rbc_ManagerReserve(
Rbc_Manager_t * rbcManager,
int newVarCapacity
)
- If the requested space is bigger than the current one
makes room for more variables in the varTable.
- Side Effects none
void
Rbc_Mark(
Rbc_Manager_t * rbc,
Rbc_t * f
)
- Marks the vertex in the internal dag. This saves the rbc
from being wiped out during garbage collection.
- Side Effects none
void
Rbc_OutputDaVinci(
Rbc_Manager_t * rbcManager,
Rbc_t * f,
FILE * outFile
)
- Print out an rbc using DaVinci graph format.
- Side Effects None
void
Rbc_OutputSexpr(
Rbc_Manager_t * rbcManager,
Rbc_t * f,
FILE * outFile
)
- Print out an rbc using LISP S-exrpressions.
- Side Effects None
void
Rbc_PrintStats(
Rbc_Manager_t * rbcManager,
int clustSz,
FILE * outFile
)
- Prints various statistics.
- Side Effects None
Rbc_t *
Rbc_Shift(
Rbc_Manager_t * rbcManager,
Rbc_t * f,
int shift
)
- Given `rbcManager', the rbc `f', and the integer `shift',
replaces every occurence of the variable x_i in in `f' with
the variable x_(i + shift).
- Side Effects none
Rbc_t *
Rbc_SubstRbc(
Rbc_Manager_t * rbcManager,
Rbc_t * f,
Rbc_t ** substRbc
)
- Given `rbcManager', the rbc `f', and the array of rbcs
`substRbc', replaces every occurence of the variable
x_i in in `f' with the rbc r_i provided that
substRbc[i
- Side Effects none
Rbc_t *
Rbc_Subst(
Rbc_Manager_t * rbcManager,
Rbc_t * f,
int * subst
)
- Given `rbcManager', the rbc `f', and the array of integers
`subst', replaces every occurence of the variable
x_i in in `f' with the variable x_j provided that
subst[i
- Side Effects none
void
Rbc_Unmark(
Rbc_Manager_t * rbc,
Rbc_t * f
)
- Unmarks the vertex in the internal dag. This exposes the rbc
to garbage collection.
- Side Effects none