Exemplo n.º 1
0
Formula* CardConstrToFO::visit(PredForm* pf) {
	if (not VocabularyUtils::isComparisonPredicate(pf->symbol())) {
		return traverse(pf);
	}

	auto left = pf->subterms()[0];
	auto right = pf->subterms()[1];
	Formula* newformula;
	if (isCard(left)) {
		newformula = new AggForm(pf->sign(), right->clone(), invertComp(FormulaUtils::getComparison(pf)), dynamic_cast<AggTerm*>(left)->clone(), pf->pi());
	} else if (isCard(right)) {
		newformula = new AggForm(pf->sign(), left->clone(), FormulaUtils::getComparison(pf), dynamic_cast<AggTerm*>(right)->clone(), pf->pi());
	}else{
		return traverse(pf);
	}
	delete (pf);
	return newformula->accept(this);
}
Exemplo n.º 2
0
void FOBDDFactory::visit(const EqChainForm* ef) {
	Formula* efclone = ef->cloneKeepVars(); //We are not allowed to change the vars, since the manager keeps a vars->bddvars mapping.
	efclone = FormulaUtils::splitComparisonChains(efclone, _vocabulary);
	efclone->accept(this);
	efclone->recursiveDeleteKeepVars();
}