FLATPOLARITYEXPR(3)

NAME
flatPolarityExpr - translates the inverters of an expression to the level of atomic expressions

SYNOPSYS
#include "logmmm.h"
chain_list *flatPolarityExpr(expr,sign)
chain_list *expr;
int sign;

PARAMETERS

expr
    expression to transform

sign
    expression or expression inverted

DESCRIPTION
flatPolarityExpr() creates a new ABL in which inverters are translated to the level of atomic expressions by applying Morgan's laws and simplification law. If sign = 0 the function returns the transformed expression after having complemented it.
Tranformation law
- (NOT (NOT a))   --> a
- (NOT (AND a b)) --> (OR (NOT a) (NOT b))
- (NOT (OR a b))  --> (AND (NOT a) (NOT b))

EXAMPLE
#include "mutnnn.h"		/* mbk utilities */
#include "logmmm.h"
chain_list *expr1,*expr2,*expr3;
expr1 = createExpr(OR);
addQExpr(expr1,createAtom("a"));
addQExpr(expr1,createAtom("b"));
expr1 = notExpr(expr1);
expr2 = flatPolarityExpr(expr1,0);
expr3 = flatPolarityExpr(expr1,1);
displayExpr(expr1);
displayExpr(expr2);
displayExpr(expr3);
/* it will display
(NOT (OR a b))
(AND (NOT a) (NOT b))
(OR a b)
*/
freeExpr(expr1);
freeExpr(expr2);
freeExpr(expr3);

SEE ALSO
log(1), abl(1), copyExpr(3), substExpr(3), substPhyExpr(3), flatArityExpr(3), maxExpr(3), minExpr(3), sortExpr(3), normExpr(3).