本文整理汇总了C++中Enode::isIff方法的典型用法代码示例。如果您正苦于以下问题:C++ Enode::isIff方法的具体用法?C++ Enode::isIff怎么用?C++ Enode::isIff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enode
的用法示例。
在下文中一共展示了Enode::isIff方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cnfize
//.........这里部分代码省略.........
//
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 )
{
sprintf( def_name, CNF_STR, formula->getId( ), enode->getId( ) );
egraph.newSymbol( def_name, sstore.mkBool( ) );
arg_def = egraph.mkVar( def_name );
#ifdef PRODUCE_PROOF
if ( config.produce_inter > 0 )
{
// Tag Positive and negative literals
egraph.tagIFormula( arg_def
, egraph.getIPartitions( enode ) );
egraph.tagIFormula( egraph.mkNot( egraph.cons( arg_def ) )
, egraph.getIPartitions( enode ) );
}
#endif
}
#ifdef PRODUCE_PROOF
uint64_t partitions = 0;
if ( config.produce_inter > 0 )
{
partitions = egraph.getIPartitions( enode );
assert( partitions != 0 );
}
#endif
//
// Handle boolean operators
//
if ( enode->isAnd( ) )
cnfizeAnd( new_arg_list, arg_def
#ifdef PRODUCE_PROOF
, partitions
#endif
);
else if ( enode->isOr( ) )
cnfizeOr( new_arg_list, arg_def
#ifdef PRODUCE_PROOF
, partitions
#endif
);
else if ( enode->isIff( ) )
cnfizeIff( new_arg_list, arg_def
#ifdef PRODUCE_PROOF
, partitions
#endif
);
else if ( enode->isXor( ) )
cnfizeXor( new_arg_list, arg_def
#ifdef PRODUCE_PROOF
, partitions
#endif
);
else
{
opensmt_error2( "operator not handled ", enode->getCar( ) );
}
if ( arg_def != NULL )
result = arg_def;
}
assert( egraph.valDupMap1( enode ) == NULL );
egraph.storeDupMap1( enode, result );
}
if ( formula->isNot( ) )
{
// Retrieve definition of argument
Enode * arg_def = egraph.valDupMap1( formula->get1st( ) );
assert( arg_def );
vector< Enode * > clause;
clause.push_back( toggleLit( arg_def ) );
#ifdef PRODUCE_PROOF
if ( config.produce_inter > 0 )
return solver.addSMTClause( clause, egraph.getIPartitions( formula ) );
#endif
return solver.addSMTClause( clause );
}
return true;
}
示例2: a
Enode * Egraph::canonizeDTC( Enode * formula
, bool split_eqs )
{
assert( config.sat_lazy_dtc != 0 );
assert( config.logic == QF_UFLRA
|| config.logic == QF_UFIDL );
list< Enode * > dtc_axioms;
vector< Enode * > unprocessed_enodes;
initDupMap1( );
unprocessed_enodes.push_back( formula );
//
// 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 ( valDupMap1( enode ) != NULL )
{
unprocessed_enodes.pop_back( );
continue;
}
bool unprocessed_children = false;
Enode * arg_list;
for ( arg_list = enode->getCdr( )
; arg_list != enil
; arg_list = arg_list->getCdr( ) )
{
Enode * arg = arg_list->getCar( );
assert( arg->isTerm( ) );
//
// Push only if it is unprocessed
//
if ( valDupMap1( arg ) == NULL )
{
unprocessed_enodes.push_back( arg );
unprocessed_children = true;
}
}
//
// SKip if unprocessed_children
//
if ( unprocessed_children )
continue;
unprocessed_enodes.pop_back( );
Enode * result = NULL;
//
// Replace arithmetic atoms with canonized version
//
if ( enode->isTAtom( )
&& !enode->isIff( )
&& !enode->isUp( ) )
{
// No need to do anything if node is purely UF
if ( isRootUF( enode ) )
{
if ( config.verbosity > 2 )
cerr << "# Egraph::Skipping canonization of " << enode << " as it's root is purely UF" << endl;
result = enode;
}
else
{
LAExpression a( enode );
result = a.toEnode( *this );
if ( split_eqs && result->isEq( ) )
{
#ifdef PRODUCE_PROOF
if ( config.produce_inter != 0 )
opensmt_error2( "can't compute interpolant for equalities at the moment ", enode );
#endif
LAExpression aa( enode );
Enode * e = aa.toEnode( *this );
Enode * lhs = e->get1st( );
Enode * rhs = e->get2nd( );
Enode * leq = mkLeq( cons( lhs, cons( rhs ) ) );
LAExpression b( leq );
leq = b.toEnode( *this );
Enode * geq = mkGeq( cons( lhs, cons( rhs ) ) );
LAExpression c( geq );
geq = c.toEnode( *this );
Enode * not_e = mkNot( cons( enode ) );
Enode * not_l = mkNot( cons( leq ) );
Enode * not_g = mkNot( cons( geq ) );
// Add clause ( !x=y v x<=y )
Enode * c1 = mkOr( cons( not_e
, cons( leq ) ) );
// Add clause ( !x=y v x>=y )
Enode * c2 = mkOr( cons( not_e
, cons( geq ) ) );
// Add clause ( x=y v !x>=y v !x<=y )
Enode * c3 = mkOr( cons( enode
, cons( not_l
, cons( not_g ) ) ) );
//.........这里部分代码省略.........