本文整理汇总了C++中Enode::isArithmeticOp方法的典型用法代码示例。如果您正苦于以下问题:C++ Enode::isArithmeticOp方法的具体用法?C++ Enode::isArithmeticOp怎么用?C++ Enode::isArithmeticOp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enode
的用法示例。
在下文中一共展示了Enode::isArithmeticOp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isRootUF
bool Egraph::isRootUF( Enode * e )
{
assert( e );
assert( config.sat_lazy_dtc != 0 );
assert( config.logic == QF_UFIDL
|| config.logic == QF_UFLRA );
//
// Makes sense only for TAtoms
//
if ( !e->isTAtom( ) )
return false;
//
// There is an arithmetic operator
//
if ( e->isArithmeticOp( ) && !e->isEq( ) )
return false;
//
// Uninterpreted predicates are OK
//
if ( e->isUp( ) )
return true;
assert( e->isEq( ) );
Enode * x = e->get1st( );
Enode * y = e->get2nd( );
//
// We want equalities of the form x=y
//
if ( x->isArithmeticOp( )
|| y->isArithmeticOp( ) )
return false;
//
// And they also have to have at least a member
// that is not interface
//
if ( interface_terms_cache.find( x ) == interface_terms_cache.end( )
|| interface_terms_cache.find( y ) == interface_terms_cache.end( ) )
return true;
return false;
}
示例2: gatherInterfaceTerms
void Egraph::gatherInterfaceTerms( Enode * e )
{
assert( config.sat_lazy_dtc != 0 );
assert( config.logic == QF_UFIDL
|| config.logic == QF_UFLRA );
assert( e );
if ( config.verbosity > 2 )
cerr << "# Egraph::Gathering interface terms" << endl;
vector< Enode * > unprocessed_enodes;
initDup1( );
unprocessed_enodes.push_back( e );
//
// Visit the DAG of the term 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 ( isDup1( enode ) )
{
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 ( !isDup1( arg ) )
{
unprocessed_enodes.push_back( arg );
unprocessed_children = true;
}
}
//
// SKip if unprocessed_children
//
if ( unprocessed_children )
continue;
unprocessed_enodes.pop_back( );
//
// At this point, every child has been processed
//
if ( enode->isUFOp( ) )
{
// Retrieve arguments
for ( Enode * arg_list = enode->getCdr( )
; !arg_list->isEnil( )
; arg_list = arg_list->getCdr( ) )
{
Enode * arg = arg_list->getCar( );
// This is for sure an interface term
if ( ( arg->isArithmeticOp( )
|| arg->isConstant( ) )
&& interface_terms_cache.insert( arg ).second )
{
interface_terms.push_back( arg );
if ( config.verbosity > 2 )
cerr << "# Egraph::Added interface term: " << arg << endl;
}
// We add this variable to the potential
// interface terms or to interface terms if
// already seen in LA
else if ( arg->isVar( ) || arg->isConstant( ) )
{
if ( it_la.find( arg ) == it_la.end( ) )
it_uf.insert( arg );
else if ( interface_terms_cache.insert( arg ).second )
{
interface_terms.push_back( arg );
if ( config.verbosity > 2 )
cerr << "# Egraph::Added interface term: " << arg << endl;
}
}
}
}
if ( enode->isArithmeticOp( )
&& !isRootUF( enode ) )
{
// Retrieve arguments
for ( Enode * arg_list = enode->getCdr( )
; !arg_list->isEnil( )
; arg_list = arg_list->getCdr( ) )
{
Enode * arg = arg_list->getCar( );
//.........这里部分代码省略.........
示例3: isPureUF
bool Egraph::isPureUF( Enode * e )
{
assert( config.sat_lazy_dtc != 0 );
assert( config.logic == QF_UFIDL
|| config.logic == QF_UFLRA );
assert( e );
vector< Enode * > unprocessed_enodes;
initDup1( );
unprocessed_enodes.push_back( e );
//
// Visit the DAG of the term 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 ( isDup1( enode ) )
{
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 ( !isDup1( arg ) )
{
unprocessed_enodes.push_back( arg );
unprocessed_children = true;
}
}
//
// SKip if unprocessed_children
//
if ( unprocessed_children )
continue;
unprocessed_enodes.pop_back( );
//
// At this point, every child has been processed
//
if ( enode->isArithmeticOp( ) )
{
doneDup1( );
return false;
}
assert( !isDup1( enode ) );
storeDup1( enode );
}
doneDup1( );
return true;
}