本文整理汇总了C++中Enode::isLit方法的典型用法代码示例。如果您正苦于以下问题:C++ Enode::isLit方法的具体用法?C++ Enode::isLit怎么用?C++ Enode::isLit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enode
的用法示例。
在下文中一共展示了Enode::isLit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: giveToSolver
//
// Give the formula to the solver
//
bool Cnfizer::giveToSolver( Enode * f )
{
vector< Enode * > clause;
//
// A unit clause
//
if ( f->isLit( ) )
{
clause.push_back( f );
#ifdef PRODUCE_PROOF
if ( config.produce_inter > 0 )
return solver.addSMTClause( clause, current_partitions );
#endif
return solver.addSMTClause( clause );
}
//
// A clause
//
if ( f->isOr( ) )
{
vector< Enode * > lits;
retrieveClause( f, lits );
for ( unsigned i = 0 ; i < lits.size( ) ; i ++ )
{
Enode * arg = lits[ i ];
assert( arg->isLit( ) );
clause.push_back( arg );
}
#ifdef PRODUCE_PROOF
if ( config.produce_inter > 0 )
return solver.addSMTClause( clause, current_partitions );
return solver.addSMTClause( clause );
#else
return solver.addSMTClause( clause );
#endif
}
//
// Conjunction
//
assert( f->isAnd( ) );
vector< Enode * > conj;
retrieveTopLevelFormulae( f, conj );
bool result = true;
for ( unsigned i = 0 ; i < conj.size( ) && result ; i ++ )
result = giveToSolver( conj[ i ] );
return result;
}
示例2: cnfize
//
// Performs the actual cnfization
//
bool Tseitin::cnfize( Enode * formula, map< enodeid_t, Enode * > & cnf_cache )
{
(void)cnf_cache;
assert( formula );
assert( !formula->isAnd( ) );
Enode * arg_def = egraph.valDupMap1( formula );
if ( arg_def != NULL )
{
vector< Enode * > clause;
clause.push_back( arg_def );
#ifdef PRODUCE_PROOF
if ( config.produce_inter > 0 )
return solver.addSMTClause( clause, egraph.getIPartitions( formula ) );
#endif
return solver.addSMTClause( clause );
}
vector< Enode * > unprocessed_enodes; // Stack for unprocessed enodes
unprocessed_enodes.push_back( formula ); // formula needs to be processed
//
// Visit the DAG of the formula from the leaves to the root
//
while( !unprocessed_enodes.empty( ) )
{
Enode * enode = unprocessed_enodes.back( );
//
// Skip if the node has already been processed before
//
if ( egraph.valDupMap1( enode ) != NULL )
{
unprocessed_enodes.pop_back( );
continue;
}
bool unprocessed_children = false;
Enode * arg_list;
for ( arg_list = enode->getCdr( ) ;
arg_list != egraph.enil ;
arg_list = arg_list->getCdr( ) )
{
Enode * arg = arg_list->getCar( );
assert( arg->isTerm( ) );
//
// Push only if it is an unprocessed boolean operator
//
if ( enode->isBooleanOperator( )
&& egraph.valDupMap1( arg ) == NULL )
{
unprocessed_enodes.push_back( arg );
unprocessed_children = true;
}
//
// If it is an atom (either boolean or theory) just
// store it in the cache
//
else if ( arg->isAtom( ) )
{
egraph.storeDupMap1( arg, arg );
}
}
//
// SKip if unprocessed_children
//
if ( unprocessed_children )
continue;
unprocessed_enodes.pop_back( );
Enode * result = NULL;
//
// At this point, every child has been processed
//
//
// Do the actual cnfization, according to the node type
//
char def_name[ 32 ];
if ( enode->isLit( ) )
{
result = enode;
}
else if ( enode->isNot( ) )
{
Enode * arg_def = egraph.valDupMap1( enode->get1st( ) );
assert( arg_def );
result = egraph.mkNot( egraph.cons( arg_def ) ); // Toggle the literal
}
else
{
Enode * arg_def = NULL;
Enode * new_arg_list = egraph.copyEnodeEtypeListWithCache( enode->getCdr( ) );
//
// If the enode is not top-level it needs a definition
//
if ( formula != enode )
{
//.........这里部分代码省略.........